server restarted. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: server restarted. (
/showthread.php?tid=657082)
server restarted. -
Man43 - 31.07.2018
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;
}
Re: server restarted. -
AndreProgrammer - 31.07.2018
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;
}
Re: server restarted. -
Man43 - 31.07.2018
now The player got KICKED but The message is don't showen why?
Re: server restarted. -
AndreProgrammer - 31.07.2018
This is bug of SA-MP. You need put the timer. If you don't know tell me and i explain
Re: server restarted. -
RedRex - 31.07.2018
Put this timer at your command Kick.
PHP код:
SetTimerEx("Kicking",5200,false,"i",targetid);
PHP код:
forward Kicking(playerid);
public Kicking(playerid)
{
Kick(playerid);
}
Re: server restarted. -
Man43 - 31.07.2018
Thank you guys Now it's worked <3 I used your timer @RedRex Ty too