SA-MP Forums Archive
How to create cmd for penalty.. - 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: How to create cmd for penalty.. (/showthread.php?tid=247810)



How to create cmd for penalty.. - GBLTeam - 10.04.2011

How to create a cmd like /givemoney which gives you money... But i want to create a command which
when i type /paricna id 3000 to deprive -3000 to that player ?

pawn Код:
if(strcmp(cmd, "/paricna", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "Koriscenje: /paricna [ID Igraca/Dio Imena] [novac]");
                return 1;
            }
            new playa;
            new money;
            playa = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            money = strval(tmp);
            if (PlayerInfo[playerid][pAdmin] >= 3)
            {
                if(IsPlayerConnected(playa))
                {
                    if(playa != INVALID_PLAYER_ID)
                    {
                        SafeGivePlayerMoney(playa, -money);
                        GetPlayerName(playa, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        format(string, 256, "[ADMIN] %s je dao %s-u novac $%d.", sendername,giveplayer,money);
                        ABroadCast(COLOR_YELLOW,string,1);
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   niste ovlasteni da koristite tu komandu!");
            }
        }
        return 1;
    }