22.12.2010, 00:29
You don't need to check if player is connected.
pawn Код:
#include <a_samp>
new ClickedPlayer[MAX_PLAYERS];
//-------------------------------Dialog-----------------------------------------
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
if(IsPlayerAdmin(playerid))
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Admin Menu", "Kick Player", "Select", "Cancel");
ClickedPlayer[playerid] = clickedplayerid;
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new pName[MAX_PLAYER_NAME];
new tName[MAX_PLAYER_NAME];
new string[128];
GetPlayerName(playerid,pName,sizeof(pName));
GetPlayerName(ClickedPlayer[playerid],tName,sizeof(tName));
//List of commands--------------------------------------------------------------
if(dialogid == 1)
{
if(!response) return SendClientMessage(playerid, 0xFF0C29FF,"You have cancelled.");
else
{
if(listitem == 0) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Kick Player", "Type in the kick reason", "Kick Player", "Cancel");
}
}
//Kick Player-------------------------------------------------------------------
if(dialogid == 2)
{
if(!response)return SendClientMessage(playerid, 0xFF0C29FF,"You have cancelled.");
else
{
format(string,sizeof(string), "{Admin Kick} %s(%d) %s", tName, ClickedPlayer[playerid], inputtext); //ClickedPlayerName, ClickedPlaterID, inputtext
SendClientMessageToAll(0x0080A1FF, string);
Kick(ClickedPlayer[playerid]);
return 1;
}
}
return 1;
}