Noob question - 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: Noob question (
/showthread.php?tid=307212)
Noob question -
Face9000 - 29.12.2011
Hello,this seems to be a noob question but i'll ask anyway.
I've this code,is a simply tax system.
pawn Код:
public RandomMoney()
{
new random_money = 1000+random(1001);
for(new i=GetMaxPlayers()-1; i >=0; i--)
{
if(!IsPlayerConnected(i)) continue;
GivePlayerMoney(i,random_money);
new string[128];
format(string, 100, "You paid %d$ in taxes to finance the State.", random_money);
SendClientMessage(i,COLOR_GREEN, string);
}
return 1;
}
There is a problem,instead of REMOVING the random_money to player,it ADD instead..How to fix this?
Re: Noob question -
Luis- - 29.12.2011
pawn Код:
public RandomMoney()
{
new random_money -= 1000+random(1001);
for(new i=GetMaxPlayers()-1; i >=0; i--)
{
if(!IsPlayerConnected(i)) continue;
GivePlayerMoney(i,random_money);
new string[128];
format(string, 100, "You paid %d$ in taxes to finance the State.", random_money);
SendClientMessage(i,COLOR_GREEN, string);
}
return 1;
}
Re: Noob question -
Face9000 - 29.12.2011
error 001: expected token: ";", but found "-="
Error line:
pawn Код:
new random_money -= 1000+random(1001);
Re: Noob question -
Stigg - 29.12.2011
Try:
pawn Код:
GivePlayerMoney(i,-random_money);
Re: Noob question -
Face9000 - 29.12.2011
Thanks,working.