PDA

View Full Version : Updating a player's value?


Jason_Roul
27/09/2013, 12:27 PM
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?

RedWolfX
27/09/2013, 12:31 PM
This is just an example how it could work.


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

ReV.
27/09/2013, 12:34 PM
Bomb++; = Increase the value by one.
Bomb += (value) - Increase the value by your selected number.

Jason_Roul
27/09/2013, 12:37 PM
Oh, same goes for decreasing, right?

RedWolfX
27/09/2013, 12:37 PM
Yeah, just replace the + with a -

Jason_Roul
27/09/2013, 12:39 PM
How would I check if the value is 0 or 1?
With if? If so, how?

Fitri
27/09/2013, 02:38 PM
CMD:mybomb(playerid,params[])
{
new string[100];
format(string, sizeof(string), "bomb : %d",bomb[playerid] );
SendClientMessage(playerid,-1,string);
return 1;
}