server restarted.
#1

Server got restarted when I kick someone...

PHP код:
CMD:kick(playerid, params[])
{
    if(
PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error: {FFFFFF}Wrong command!! {FF0000}Check availables commands from here `{FFFFFF}/cmds{FF0000}`.");
    new 
pName[MAX_PLAYER_NAME],tName[MAX_PLAYER_NAME],targetid, string[128];
    if(!
aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error: {FFFFFF}You must be ADMIN ON DUTY to kick someone.");
    if(
sscanf(params, "us[128]", targetid, params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /kick [playerid] [reason]");
    if(!
IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error: {FFFFFF}INVAILD PLAYER ID / NAME.");
    if(
PlayerInfo[playerid][pAdmin] < PlayerInfo[targetid][pAdmin]) return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error: {FFFFFF}Player has a higher admin level than you. [CAN'T KICKED]!");
    
GetPlayerName(playerid,pName,sizeof(pName));
    
GetPlayerName(targetid,tName,sizeof(tName));
    
Kick(targetid);
    
format(string, sizeof(string), "{FB00FF}[KICKED]: PLAYER %s(%d) has been KICKED by Admin %s(%d), REASON: %s.", tName,targetid, pName,playerid, params);
    
SendClientMessageToAll(-1, string);
    return 
1;
} 
Reply
#2

Try this

PHP код:
CMD:kick(playerid, params[]) 
{ 
    if(
PlayerInfo[playerid][pAdmin] < 1) 
        return 
SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error: {FFFFFF}Wrong command!! {FF0000}Check availables commands from here `{FFFFFF}/cmds{FF0000}`."); 
    
    new 
        
pName[MAX_PLAYER_NAME],
        
tName[MAX_PLAYER_NAME],
        
targetid, 
        
string[128], 
        
reason[80]
    ; 
    
    if(!
aDuty[playerid]) 
        return 
SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error: {FFFFFF}You must be ADMIN ON DUTY to kick someone."); 
    if(
sscanf(params, "us[80]", targetid, reason)) 
        return 
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /kick [playerid] [reason]"); 
    if(!
IsPlayerConnected(targetid)) 
        return 
SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error: {FFFFFF}INVAILD PLAYER ID / NAME."); 
    if(
PlayerInfo[playerid][pAdmin] < PlayerInfo[targetid][pAdmin]) 
        return 
SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error: {FFFFFF}Player has a higher admin level than you. [CAN'T KICKED]!"); 
    
    
GetPlayerName(playerid,pName,sizeof(pName)); 
    
GetPlayerName(targetid,tName,sizeof(tName)); 
    
Kick(targetid); 
    
format(string, sizeof(string), "{FB00FF}[KICKED]: PLAYER %s(%d) has been KICKED by Admin %s(%d), REASON: %s.", tName,targetid, pName,playerid, reason); 
    
SendClientMessageToAll(-1, string); 
    return 
1; 
} 
Reply
#3

now The player got KICKED but The message is don't showen why?
Reply
#4

This is bug of SA-MP. You need put the timer. If you don't know tell me and i explain
Reply
#5

Put this timer at your command Kick.

PHP код:
SetTimerEx("Kicking",5200,false,"i",targetid); 
PHP код:
forward Kicking(playerid);
public 
Kicking(playerid)
{
    
Kick(playerid);
} 
Reply
#6

Thank you guys Now it's worked <3 I used your timer @RedRex Ty too
Reply


Forum Jump:


Users browsing this thread: