Noob question
#1

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?
Reply
#2

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;
}
Reply
#3

error 001: expected token: ";", but found "-="
Error line:

pawn Код:
new random_money -= 1000+random(1001);
Reply
#4

Try:
pawn Код:
GivePlayerMoney(i,-random_money);
Reply
#5

Thanks,working.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)