SA-MP Forums Archive
subtracting from a 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: subtracting from a value (/showthread.php?tid=619552)



subtracting from a value - MrCesar - 19.10.2016

Hello guys, how to properly code this?
Код:
CMD:usecoca(playerid, params[])
{
	if(PlayerInfo[playerid][Cocaine] >=2)
	{
	    SendClientMessage(playerid, -1, "you just used 2 grams of cocaine");
	    PlayerInfo[playerid][Cocaine]  // how to take 2 cocaine from him?
 	}
 	else SendClientMessage(playerid, -1, "you dont have enough coca");
}
thanks!


Re: subtracting from a value - Threshold - 19.10.2016

PlayerInfo[playerid][Cocaine] -= 2;

Код:
variable -= amount; // Will deduct 'amount' from the 'variable'.



Re: subtracting from a value - MrCesar - 19.10.2016

Quote:
Originally Posted by Threshold
Посмотреть сообщение
PlayerInfo[playerid][Cocaine] -= 2;

Код:
variable -= amount; // Will deduct 'amount' from the 'variable'.
thanks!