SA-MP Forums Archive
Updating a player's value? - 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: Updating a player's value? (/showthread.php?tid=466334)



Updating a player's value? - Jason_Roul - 27.09.2013

So, let's say a player has 0 bombs.

Bomb = 0.
How could you do it so when you type a command it gives you 1.
Then 2. Then 3 and so on?


Re: Updating a player's value? - RedWolfX - 27.09.2013

This is just an example how it could work.

pawn Код:
if (strcmp("/givemeabomb", cmdtext, true, 10) == 0)
    {
        bomb[playerid] += 1;
        return 1;
    }



Re: Updating a player's value? - ReV. - 27.09.2013

Bomb++; = Increase the value by one.
Bomb += (value) - Increase the value by your selected number.


Re: Updating a player's value? - Jason_Roul - 27.09.2013

Oh, same goes for decreasing, right?


Re: Updating a player's value? - RedWolfX - 27.09.2013

Yeah, just replace the + with a -


Re: Updating a player's value? - Jason_Roul - 27.09.2013

How would I check if the value is 0 or 1?
With if? If so, how?


Re: Updating a player's value? - Fitri - 27.09.2013

pawn Код:
CMD:mybomb(playerid,params[])
{
 new string[100];
 format(string, sizeof(string), "bomb : %d",bomb[playerid] );
 SendClientMessage(playerid,-1,string);
 return 1;
}