15.09.2009, 01:08
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..
Thanks
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;
}