13.12.2010, 18:20
Example:
pawn Код:
new adminPlayer[20];
forward BanHim(playerid);
pawn Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
if(IsPlayerAdmin(playerid))
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Admin Menu?", "Ban Player (Minutes)", "ok", "Cancel");
adminPlayer[playerid] = clickedplayerid;
}
return 0;
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response)
{
switch(dialogid)
{
case 1:
{
switch(listitem)
{
case 0: ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Admin Menu", "Enter the time to the player get banned", "Ban", "Cancel");
}
}
case 2:
{
new playerwhogetbanned[MAX_PLAYER_NAME], string[44];
GetPlayerName(adminPlayer[playerid], playerwhogetbanned, sizeof(playerwhogetbanned));
format(string, sizeof(string), "Muhahah %s will be banned in %d mins",playerwhogetbanned, inputtext);
SendClientMessageToAll(0xFFFF00AA, string);
SetTimer("BanHim",inputtext ,false); //Inputtext = Minutes, not milliseconds
adminPlayer[playerid] = 0;
}
}
}
return 1;
}
pawn Код:
public BanHim(playerid)
{
Ban(adminPlayer[playerid]);
}