Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: Kewun on Sep 06, 2016, 05:55 PM

Title: how to make your own player.YourOwnFunction = blah?
Post by: Kewun on Sep 06, 2016, 05:55 PM
i want to create a fines limit

player.Fines = 5

but how do i create the .Fines thing?

array? please show me a example pls ;c
Title: Re: how to make your own player.YourOwnFunction = blah?
Post by: . on Sep 06, 2016, 05:57 PM
You cannot achieve this on the official plugin because the official plugin may create more than one instance of the internal Player class. Therefore, your member property will always start from the initial value. Which could lead to inconsistent behavior.

Please see this topic (http://forum.vc-mp.org/?topic=2997.0) for more info.
Title: Re: how to make your own player.YourOwnFunction = blah?
Post by: Kewun on Sep 06, 2016, 05:58 PM
because i use ini and WriteIniInteger("stats.ini","playerfines", player.Name, +1 ) doesnt work
Title: Re: how to make your own player.YourOwnFunction = blah?
Post by: KAKAN on Sep 06, 2016, 05:58 PM
for adding a function
Use this: CPlayer::YourOwnFunction(){}
CPlayer is the player class.
For adding variables( can be used to add functions too ), use: CPlayer.rawnewmember("VarName",value);
I might be incorrect. I've not used them since many days :p
Title: Re: how to make your own player.YourOwnFunction = blah?
Post by: Kewun on Sep 06, 2016, 06:00 PM
Quote from: KAKAN on Sep 06, 2016, 05:58 PMfor adding a function
Use this: CPlayer::YourOwnFunction(){}
CPlayer is the player class.
For adding variables( can be used to add functions too ), use: CPlayer.rawnewmember("VarName",value);
I might be incorrect. I've not used them since many days :p
yeah, but after usign FindPlayer(0).Fines = 5 it doesnt set i t remains 0
Title: Re: how to make your own player.YourOwnFunction = blah?
Post by: . on Sep 06, 2016, 06:01 PM
Quote from: Kewun on Sep 06, 2016, 05:58 PMbecause i use ini and WriteIniInteger("stats.ini","playerfines", +1 ) doesnt work

Wait... what daf...
Title: Re: how to make your own player.YourOwnFunction = blah?
Post by: . on Sep 06, 2016, 06:02 PM
Quote from: KAKAN on Sep 06, 2016, 05:58 PMFor adding variables( can be used to add functions too ), use: CPlayer.rawnewmember("VarName",value);

Please read my initial post regarding member variables.
Title: Re: how to make your own player.YourOwnFunction = blah?
Post by: Kewun on Sep 06, 2016, 06:04 PM
 i readed
Title: Re: how to make your own player.YourOwnFunction = blah?
Post by: . on Sep 06, 2016, 06:06 PM
Quote from: Kewun on Sep 06, 2016, 06:04 PMi readed

Wasn't addressed to you. But oh well.
Title: Re: how to make your own player.YourOwnFunction = blah?
Post by: Kewun on Sep 06, 2016, 06:11 PM
so i will have use your squirrel plugin instead to make it work if i understand right? ok ill try then
Title: Re: how to make your own player.YourOwnFunction = blah?
Post by: . on Sep 06, 2016, 06:13 PM
Quote from: Kewun on Sep 06, 2016, 06:11 PMso i will have use your squirrel plugin instead to make it work if i understand right? ok ill try then

My advice? Don't! That plugin is not for your average vc:mp scripter. You need to be an experienced programmer to make use of it. Take that as a warning or as an advice. Your choice.
Title: Re: how to make your own player.YourOwnFunction = blah?
Post by: Kewun on Sep 06, 2016, 06:16 PM
k
Title: Re: how to make your own player.YourOwnFunction = blah?
Post by: KAKAN on Sep 07, 2016, 04:55 AM
Quote from: . on Sep 06, 2016, 06:02 PM
Quote from: KAKAN on Sep 06, 2016, 05:58 PMFor adding variables( can be used to add functions too ), use: CPlayer.rawnewmember("VarName",value);

Please read my initial post regarding member variables.
It was working when I tried it last time.
http://pastebin.com/VznhwQrR
Take a look there, someone said that it was working fine.
Title: Re: how to make your own player.YourOwnFunction = blah?
Post by: Kewun on Sep 07, 2016, 05:08 AM
il try