09.03.2014, 15:51
When im kicking/banning a player.. i doesnt shown the reason
it only shown the "Server Closed The Connection"
Kick/Skick/Ban Script:
it only shown the "Server Closed The Connection"
Kick/Skick/Ban Script:
Код:
CMD:kick(playerid, params[]) { if (PlayerInfo[playerid][pAdmin] >= 1) { 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) has been kicked by %s, reason: %s (%d-%d-%d)", GetPlayerNameEx(giveplayerid), playerip, GetPlayerNameEx(playerid), reason,month,day,year); format(string, sizeof(string), "ADMCMD: %s has been kicked by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason); SendClientMessageToAllEx(COLOR_LIGHTRED, string); Kick(playerid); } return 1; } } else SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!"); return 1; } CMD:skick(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] >= 1) { new string[128], giveplayerid, reason[64]; if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /skick [playerid/partofname] [reason]"); if(IsPlayerConnected(giveplayerid)) { if(PlayerInfo[giveplayerid][pAdmin] < PlayerInfo[playerid][pAdmin]) { new playerip[32]; GetPlayerIp(giveplayerid, playerip, sizeof(playerip)); format(string, sizeof(string), "AdmCmd: %s(IP:%s) was silent kicked by %s, reason: %s", GetPlayerNameEx(giveplayerid), playerip, GetPlayerNameEx(playerid), reason); Log("logs/kick.log", string); format(string, sizeof(string), "AdmCmd: %s was silent kicked by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason); ABroadCast(COLOR_LIGHTRED,string,1); Kick(giveplayerid); } return 1; } else SendClientMessage(playerid, COLOR_GRAD1, "Invalid player specified."); } return 1; } CMD:ban(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] >= 2) { new string[128], giveplayerid, reason[64]; if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ban [playerid/partofname] [reason]"); if(IsPlayerConnected(giveplayerid)) { if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin]) { if(AdminDuty[playerid] == 1) { new username[MAX_PLAYER_NAME]; GetPVarString(playerid, "TempNameName", username, sizeof(username)); SetPVarInt(playerid, "TempName", 0); SetPlayerName(playerid, username); } format(string, sizeof(string), "AdmCmd: %s has been auto-banned, reason: Trying to /ban a higher admin.", PlayerInfo[playerid][pAdminName]); ABroadCast(COLOR_YELLOW,string,1); PlayerInfo[playerid][pBanned] = 1; new ip[32]; GetPlayerIp(playerid,ip,sizeof(ip)); AddBan(ip); Kick(playerid); return 1; } else { new playerip[32]; GetPlayerIp(giveplayerid, playerip, sizeof(playerip)); if(AdminDuty[giveplayerid] == 1) { new username[MAX_PLAYER_NAME]; GetPVarString(giveplayerid, "TempNameName", username, sizeof(username)); SetPVarInt(giveplayerid, "TempName", 0); SetPlayerName(giveplayerid, username); format(string, sizeof(string), "AdmCmd: %s(IP:%s) was banned by %s, reason: %s", PlayerInfo[giveplayerid][pAdminName], playerip, GetPlayerNameEx(playerid), reason); Log("logs/ban.log", string); format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", PlayerInfo[giveplayerid][pAdminName], GetPlayerNameEx(playerid), reason); } else { format(string, sizeof(string), "AdmCmd: %s(IP:%s) was banned by %s, reason: %s", GetPlayerNameEx(giveplayerid), playerip, GetPlayerNameEx(playerid), reason); Log("logs/ban.log", string); format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason); } SendClientMessageToAllEx(COLOR_LIGHTRED, string); PlayerInfo[giveplayerid][pBanned] = 1; new ip[32]; GetPlayerIp(giveplayerid,ip,sizeof(ip)); AddBan(ip); Kick(giveplayerid); return 1; } } else SendClientMessage(playerid, COLOR_GRAD1, "Invalid player specified."); } return 1; }