Some little help with Player Info
#1

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;

?
Reply
#2

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

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?
Reply
#4

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)