SA-MP Forums Archive
/givemoney crashes my server. - 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: /givemoney crashes my server. (/showthread.php?tid=387856)



/givemoney crashes my server. - Oscii - 26.10.2012

Hello, whenever i try to use this command on myself or another player it restarts the server :O , Anyone know the problem? <<cmd is below>>


pawn Код:
if(strcmp(cmd, "/givemoney", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /givemoney [playerid/PartOfName] [money]");
                return 1;
            }
            if(GetPVarInt(playerid, "AdminLogged") == 0)
            {
                SendClientMessage(playerid, COLOR_GRAD2, "Your not logged in through the admin panel, /adminlogin.");
                return 1;
            }
            new playa;
            new money;
            playa = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            money = strval(tmp);
            if (PlayerInfo[playerid][pAdmin] >= 10)
            {
                if(IsPlayerConnected(playa))
                {
                    if(playa != INVALID_PLAYER_ID)
                    {
                        GetPlayerName(playerid, name, sizeof(name));
                        CMDLog(name,cmdtext);
                        GivePlayerPCash(playa, money);
                        GetPlayerName(playa, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        if(PlayerInfo[playerid][pAdmin] == 11) { sendername = "Hidden Admin"; }
                        format(string, sizeof(string), "AdmWarning: %s has admin-given %s $%d.", sendername,giveplayer,money);
                        ABroadCast(COLOR_YELLOW,string,1);
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
            }
        }
        return 1;
    }