CMD:kick(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pHelper] >= 2)
{
new string[128], giveplayerid, reason[64];
if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /kick [playerid] [reason]");
if(IsPlayerConnected(giveplayerid))
{
if(PlayerInfo[giveplayerid][pAdmin] >= PlayerInfo[playerid][pAdmin] && (PlayerInfo[giveplayerid][pHelper] >= 2 || PlayerInfo[giveplayerid][pAdmin] > 0) && playerid != giveplayerid)
{
format(string, sizeof(string), "AdmCmd: %s has been auto-kicked, reason: Trying to /kick a higher admin.", GetPlayerNameEx(playerid));
ABroadCast(COLOR_YELLOW,string, (PlayerInfo[playerid][pAdmin] == 1) ? (1) : (2));
Kick(playerid);
return 1;
}
else
{
new year, month,day;
getdate(year, month, day);
new playerip[32];
GetPlayerIp(giveplayerid, playerip, sizeof(playerip));
format(string, sizeof(string), "AdmCmd: %s (IP:%s) was kicked by %s, reason: %s (%d-%d-%d)", GetPlayerNameEx(giveplayerid), playerip, GetPlayerNameEx(playerid), reason,month,day,year);
Log("logs/kick.log", string);
if(PlayerInfo[playerid][pAdmin] == 1) Log("logs/moderator.log", string);
format(string, sizeof(string), "AdmCmd: %s was kicked by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
SendClientMessageToAllEx(COLOR_LIGHTRED, string);
Kick(giveplayerid);
}
return 1;
}
}
else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
return 1;
}
if(PlayerInfo[giveplayerid][pAdmin] >= PlayerInfo[playerid][pAdmin] && (PlayerInfo[giveplayerid][pHelper] >= 2 || PlayerInfo[giveplayerid][pAdmin] > 0) && playerid != giveplayerid)
if(PlayerInfo[giveplayerid][pAdmin] < PlayerInfo[playerid][pAdmin] && (PlayerInfo[giveplayerid][pHelper] >= 2 || PlayerInfo[giveplayerid][pAdmin] > 0) && playerid != giveplayerid)
|
Change:
PHP код:
PHP код:
|
|
Ikbenremco is perfectly correct.
also, if u want to display a kick message before the kick, make a separate kick function, as samp , since 0.3x, has this issue, that if it reads KICK anywhere, it directly kicks the player. so if u do sendclientmessage("blabla bla bla bla"); Kick(giveplayerid); it wont display the message. it will directly kick the player. but if u make some function (example KickFunc) then if u type sendclientmessage("blabla bla bla bla"); KickFunc(giveplayerid); then it displays whatever has to be displayed, and kicks the player in the end. cheers ![]() |
|
Ikbenremco is perfectly correct.
also, if u want to display a kick message before the kick, make a separate kick function, as samp , since 0.3x, has this issue, that if it reads KICK anywhere, it directly kicks the player. so if u do sendclientmessage("blabla bla bla bla"); Kick(giveplayerid); it wont display the message. it will directly kick the player. but if u make some function (example KickFunc) then if u type sendclientmessage("blabla bla bla bla"); KickFunc(giveplayerid); then it displays whatever has to be displayed, and kicks the player in the end. cheers ![]() |
|
Can you tell me how to exactly do this? Sorry for being such a noob, but can you tell me where to make the functions and stuff.
|
CMD:kick(playerid,params[])
{
new string[128];
new ID;
new cmdreason[100];
if(sscanf(params,"us[100]",ID,cmdreason))
{
SendClientMessage(playerid,COLOR_ERROR,"USAGE: /adkick (Player Name/ID) (Reason)");
return 1;
}
if(!IsPlayerConnected(ID))
{
format(string,sizeof(string),"The player ID (%d) is not connected to the server. You cannot kick them.",ID);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
Kicking[ID] =1;
format(string,sizeof(string),"[ADMIN] %s(%d) has kicked %s(%d) from the server. Reason: %s.",PlayerName(playerid),playerid,PlayerName(ID),ID,cmdreason);
SendClientMessageToAll(COLOR_ADMIN,string);
format(string,sizeof(string),"9[ADMIN] Administrator has kicked %s(%d) from the server. Reason: %s.",PlayerName(ID),ID,cmdreason);
IRC_GroupSay(gGroupID,IRC_CHANNEL,string);
SetTimer("KickPlayer",700,0);
return 1;
}