{ 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_RED, string); Kick(giveplayerid); } return 1; } } else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified."); return 1; } |
forward KickPlayer(playerid);
public KickPlayer(playerid) return Kick(playerid);
//Then when you want to kick someone with a message:
SendClientMessage(blah);
SetTimerEx("KickPlayer", 500, "i", id);
Kick() was changed/fixed in 0.3x to close the connection immediately. So if you want send a message you have to kick with a small delay. Something like this should work:
pawn Код:
|
forward KickPlayer(playerid); public KickPlayer(playerid) return Kick(playerid); 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_RED, string); SendClientMessage(blah); // what would go where (blah) is? (playerid)? SetTimerEx("KickPlayer", 500, "i", id); } return 1; } } else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified."); return 1; } |
SendClientMessage(blah); // what would go where (blah) is?
SetTimerEx("KickPlayer", 500, "i", id);
SetTimerEx("KickPlayer", 500, "i", giveplayerid);
C:\Users\Josh\Desktop\Server422 - Copy\gamemodes\NGRP2.pwn(3436 : warning 202: number of arguments does not match definition C:\Users\Josh\Desktop\Server422 - Copy\gamemodes\NGRP2.pwn(41381) : error 035: argument type mismatch (argument 3) C:\Users\Josh\Desktop\Server422 - Copy\gamemodes\NGRP2.pwn(90302) : warning 203: symbol is never used: "RconAttempts" Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Error. |
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_RED, string); SendClientMessage(playerid); SetTimerEx("KickPlayer", 500, "i", playerid); } return 1; } } else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified."); return 1; } |