SA-MP Forums Archive
/pay Command Help. - 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: /pay Command Help. (/showthread.php?tid=95014)



/pay Command Help. - indy-greg - 02.09.2009

I don't know why this doesn't work. I don't get any errors but the player doesn't get paid the amount the other player puts in and the player giving the money doesn't get a decrease in the chosen amount. Please help me out guys & girls.

pawn Код:
dcmd(pay, 3,cmdtext);

pawn Код:
dcmd_pay(playerid,params[]){
    new giveid, cash;
    if (sscanf(params, "ud",giveid,cash))
    {
        return SendClientMessage(playerid,COLOR_YELLOW,"/pay [ID] [amount]");
    }
    else if(!IsPlayerConnected(giveid))
    {
        return SendClientMessage(playerid,COLOR_RED,"Wrong ID");
    }
    else if(playerid==giveid)
    {
        return SendClientMessage(playerid,COLOR_RED,"You cannt pay yourself");
    }
    else if(cash>GetPlayerMoney(playerid) || cash<0)
    {
        return SendClientMessage(playerid,COLOR_RED,"You don't have so much money");
    }
    else
    {
        GivePlayerMoney(playerid, -cash);
        GivePlayerMoney(giveid, cash);
    }
    return 1;
}