Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: EK.IceFlake on Apr 13, 2015, 05:40 AM

Title: Is there some kind of trick to place variables inside CPlayer class?
Post by: EK.IceFlake on Apr 13, 2015, 05:40 AM
Hi guys!
I wanna know if it is possible to add variables inside player class without using global variables. What I mean is something like this:
function CPlayer::InitLittleDudes()
{
    public AdminLevel;
}
then able to use
player.AdminLevelThe code above was just an example since afaik public doesnt exist in squirrel. Again, I do not want to use something like
function CPlayer::InitLittleDudes()
{
    AdminLevel <- null;
}
Thanks!
Title: Re: Is there some kind of trick to place variables inside CPlayer class?
Post by: DizzasTeR on Apr 13, 2015, 05:46 AM
Class members can be used anywhere no? So why are you doing

AdminLevel <- null;
just use

AdminLevel = null;
and then later on assign it whatever you want.

[ Atleast that's what I understood what you are trying to do. ]
Title: Re: Is there some kind of trick to place variables inside CPlayer class?
Post by: EK.IceFlake on Apr 13, 2015, 06:11 AM
Quote from: Doom_Killer on Apr 13, 2015, 05:46 AMClass members can be used anywhere no? So why are you doing

AdminLevel <- null;
just use

AdminLevel = null;
and then later on assign it whatever you want.

[ Atleast that's what I understood what you are trying to do. ]
Ok ill try that... but remember, im adding that from inside a function in the class since I dont have full access to that class.
Title: Re: Is there some kind of trick to place variables inside CPlayer class?
Post by: Gudio on Apr 13, 2015, 06:49 AM
Click me. (http://forum.vc-mp.org/?topic=257.msg1425#msg1425)
Use (https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fimg.vc-mp.pl%2Fimages%2F6IzpjWLG.png&hash=374c1a4ab9d3016537c65b2543935a5fbf579ed2) next time...
Title: Re: Is there some kind of trick to place variables inside CPlayer class?
Post by: EK.IceFlake on Apr 13, 2015, 07:51 AM
Quote from: Gudio on Apr 13, 2015, 06:49 AMClick me. (http://forum.vc-mp.org/?topic=257.msg1425#msg1425)
Use (https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fimg.vc-mp.pl%2Fimages%2F6IzpjWLG.png&hash=374c1a4ab9d3016537c65b2543935a5fbf579ed2) next time...
I knew that way and even used it, but I dont like having to use a "()" after something like MyInfo
Title: Re: Is there some kind of trick to place variables inside CPlayer class?
Post by: Thijn on Apr 13, 2015, 05:07 PM
It's either that or nothing at all.
Title: Re: Is there some kind of trick to place variables inside CPlayer class?
Post by: . on Apr 13, 2015, 05:26 PM
Quote from: NE.CrystalBlue on Apr 13, 2015, 05:40 AMI wanna know if it is possible to add variables inside player class without using global variables. What I mean is something like this:

I've been working on something like that my self. Perhaps the devs could port the code from my repository to add this feature:
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fs16.postimg.org%2Fibp77s4b5%2FUntitled.jpg&hash=d155e60bee400d5830d2b11def73fcbc455474a1) (http://postimg.org/image/ibp77s4b5/)

It's a very important feature and to be honest I can see tons of uses for something like this.