SA-MP Forums Archive
Some little help with Player Info - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Some little help with Player Info (/showthread.php?tid=373399)



Some little help with Player Info - CaTaLinU - 30.08.2012

if i have defined something, lets take an example like down

pExample and etc

if PlayerInfo[playerid][pExample] = 0;

and i want to increase with 1, on a command

what i need to do?

like this

PlayerInfo[playerid][pExample] += 1;

?


Re: Some little help with Player Info - Jack.7331 - 30.08.2012

You can do that, or to increase or decrease by one, you can do PlayerInfo[playerid][pExample]++; or --; in the place of the ++.


Re: Some little help with Player Info - CaTaLinU - 30.08.2012

if PlayerInfo[playerid][pExample] = 0

and on a command i will set

PlayerInfo[playerid][pExample] ++;

then that info will be PlayerInfo[playerid][pExample] = 1


both variants, of you and mine, are correct?


Re: Some little help with Player Info - Jack.7331 - 30.08.2012

if(PlayerInfo[playerid][pExample] == 0)
{
PlayerInfo[playerid][pExample]++;
}
else
{
printf("pExample == %d", PlayerInfo[playerid][pExample]);
}
Yeah.


Re: Some little help with Player Info - nGen.SoNNy - 30.08.2012

Also if you want to read and write something directly to database you can make a function like:
pawn Код:
stock GetPlayerExample(playerid)
and then use it like
pawn Код:
GetPlayerExample(playerid) + 1