SA-MP Forums Archive
What's the problem? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: What's the problem? (/showthread.php?tid=152928)



What's the problem? - Ihsan_Cingisiz - 06.06.2010

Hello, i'm making a drugs system but i have a problem.
I the player uses '/usedrug weed' he uses it but i can't
do -1 weed, it stay 10 weed when i use. What's the problem?
Quote:

if (strcmp("/usedrug weed", cmdtext, true, 10) == 0)
{
new pWeed = Weed[playerid];
new pStoned = PlayerStoned[playerid];
new string4[256];
new string6[256];
if(pWeed < 1) {
SendClientMessage(playerid, COLOR_RED, "[P-RP]: You don't have any weed on you.");
return 0;
}
if(pWeed > 1) {
pWeed -=1;
pStoned = 1;
format(string4, sizeof(string4), "[P-RP]: You smoke some weed.", pWeed);
format(string6, sizeof(string6), "[P-RP]: Condition : Stoned", pStoned);
SendClientMessage(playerid, COLOR_GREEN, string4);
SendClientMessage(playerid, COLOR_GREEN, string6);
return 1;
}
}





Re: What's the problem? - Jochemd - 06.06.2010

Use this

Quote:

if (strcmp("/usedrug weed", cmdtext, true, 10) == 0)
{
new pWeed = Weed[playerid];
new pStoned = PlayerStoned[playerid];
new string4[256];
new string6[256];
if(pWeed < 1) {
SendClientMessage(playerid, COLOR_RED, "[P-RP]: You don't have any weed on you.");
return 0;
}
if(pWeed > 1) {
pWeed =pWeed-1;
pStoned = 1;
format(string4, sizeof(string4), "[P-RP]: You smoke some weed.", pWeed);
format(string6, sizeof(string6), "[P-RP]: Condition : Stoned", pStoned);
SendClientMessage(playerid, COLOR_GREEN, string4);
SendClientMessage(playerid, COLOR_GREEN, string6);
return 1;
}
}




Re: What's the problem? - Ihsan_Cingisiz - 06.06.2010

Solved, i must do -1 from the real variable..
Thanks anyway!