Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: KAKAN on Oct 11, 2015, 06:04 PM

Title: player.Alpha again
Post by: KAKAN on Oct 11, 2015, 06:04 PM
So, what does the function player.Alpha does?
I need to use player.SetAlpha(0,0); instead of player.Alpha = 0;
If I use player.Alpha = 0; It prints out the error as:-
Member variable not found.I used Message(player.Alpha); but still the same(^^) error comes.

I want to know what does that player.Alpha do.
Title: Re: player.Alpha again
Post by: MacTavish on Oct 12, 2015, 05:13 AM
If player.Alpha is exists then its just a readonly function

onPlayerSpawn(player)
{
print(player.Alpha);
}

We can change alpha through player.SetAlpha as already discussed here (http://forum.vc-mp.org/?topic=1640.0)
Title: Re: player.Alpha again
Post by: KAKAN on Oct 12, 2015, 06:32 AM
QuoteI used Message(player.Alpha); but still the same(^^) error comes.
Any Idea?
Title: Re: player.Alpha again
Post by: MacTavish on Oct 12, 2015, 07:17 AM
Quote from: KAKAN on Oct 12, 2015, 06:32 AM
QuoteI used Message(player.Alpha); but still the same(^^) error comes.
Any Idea?

You are returning integer in Message since it needs string/instance. Use

Message("alpha: "+player.Alpha);
Title: Re: player.Alpha again
Post by: EK.IceFlake on Oct 12, 2015, 01:46 PM
Make sure player isn't null
(player == null) ? Message("Unknown buddy") : Message(player.Alpha+"");
Title: Re: player.Alpha again
Post by: Thijn on Oct 12, 2015, 04:09 PM
Why all the concatenation with strings. What's wrong with a good old .tostring()?
Title: Re: player.Alpha again
Post by: EK.IceFlake on Oct 13, 2015, 12:31 PM
It exists? Because as far as I remember in the unofficial forum I asked why I got that error and it didn't exist.
Title: Re: player.Alpha again
Post by: KAKAN on Oct 13, 2015, 05:05 PM
Quote from: NE.CrystalBlue on Oct 13, 2015, 12:31 PMIt exists? Because as far as I remember in the unofficial forum I asked why I got that error and it didn't exist.
yea, it does. I use it in my script. Just forgot about it. :/