/givemoney crashes my server. -
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;
}