Commands creating random crashes..
#1

Hey, I just coded new /kick and /ban commands, and they (seem) to be randomly making the gamemode restart, cause it never did this before xD

And since im a noob (lul) I need help

Heres the commands.

pawn Код:
dcmd_kick(playerid,params[])
{
    new tmp[256], tmp2[256], Index;     tmp = strtok(params,Index), tmp2 = strtok(params,Index);
    new giveplayerid;
    if(pInfo[playerid][Level] < 1)
    {
        return SendClientMessage(playerid,COLOR_RED,"ERROR: You must be level 1 to kick someone.");
    }
    if(giveplayerid == playerid)
    {
      SendClientMessage(playerid,COLOR_RED,"ERROR: You cannot kick yourself.");
      return 1;
    }
    if(!strlen(params))
    {
        SendClientMessage(playerid,COLOR_WHITE,"Usage: /kick (id) [reason]");
        return 1;
    }
    if(!IsPlayerConnected(giveplayerid))
    {
      SendClientMessage(playerid,COLOR_RED,"ERROR: Invalid ID!");
      return 1;
    }

    new string[128],name[24];
    GetPlayerName(giveplayerid,name,24);
    SendClientMessage(playerid,COLOR_RED,string);
    format(string,128,"%s(%d) has been kicked by %s(%d). Reason: %s.",name,giveplayerid,ReturnPlayerName(playerid),playerid,params[strlen(tmp)+1]);
    SendClientMessageToAll(COLOR_RED,string);
    SendClientMessage(giveplayerid,COLOR_RED,"SERVER: You have been kicked from the server.");
    SetPlayerPos(giveplayerid,10000,10000,10000);
   
    ResetPlayerWeapons(giveplayerid);
    GivePlayerWeapon(giveplayerid,10,1);
    SetPlayerWeather(giveplayerid,150);
    SetPlayerSkin(giveplayerid,77);
    Kick(giveplayerid);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)