Server freezing when using /kick
#1

OK, I don't know whats wrong, but every time I use the /kick command, my server freezes, looses connection, etc for a few seconds..

I'm hopeing someone can find the problem in the code..

pawn Код:
dcmd_kick(playerid,params[])
{
    if(pInfo[playerid][Level] < 1)
    {
        return SendClientMessage(playerid,COLOR_RED,"You must be level 1 to kick someone!");
    }
    new giveplayerid,reason[80];
    if(sscanf(params,"ds",giveplayerid,reason))
    {
        SendClientMessage(playerid,COLOR_WHITE,"Usage: /kick (id) [reason]");
        return 1;
    }
    if(!IsPlayerConnected(giveplayerid))
    {
      SendClientMessage(playerid,COLOR_RED,"ERROR: Invalid ID!");
      return 1;
    }
    if(giveplayerid == playerid)
    {
      SendClientMessage(playerid,COLOR_RED,"ERROR: You cannot kick yourself.");
      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,reason);
    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;
}
Thanks
Reply


Messages In This Thread
Server freezing when using /kick - by _Vortex - 15.09.2009, 01:08
Re: Server freezing when using /kick - by Calgon - 15.09.2009, 02:44
Re: Server freezing when using /kick - by XCultz - 15.09.2009, 03:38
Re: Server freezing when using /kick - by Correlli - 15.09.2009, 04:55
Re: Server freezing when using /kick - by _Vortex - 15.09.2009, 18:11
Re: Server freezing when using /kick - by Correlli - 15.09.2009, 18:18
Re: Server freezing when using /kick - by _Vortex - 15.09.2009, 18:43
Re: Server freezing when using /kick - by Correlli - 15.09.2009, 19:03
Re: Server freezing when using /kick - by whooper - 15.09.2009, 19:28
Re: Server freezing when using /kick - by _Vortex - 15.09.2009, 19:30

Forum Jump:


Users browsing this thread: 4 Guest(s)