[HELP] SetTimer
#5

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]);
}
Reply


Messages In This Thread
[HELP] SetTimer - by Larsey123IsMe - 13.12.2010, 18:06
Re: [HELP] SetTimer - by blackwave - 13.12.2010, 18:08
Re: [HELP] SetTimer - by Larsey123IsMe - 13.12.2010, 18:12
Re: [HELP] SetTimer - by blackwave - 13.12.2010, 18:17
Re: [HELP] SetTimer - by Larsey123IsMe - 13.12.2010, 18:20
Re: [HELP] SetTimer - by blackwave - 13.12.2010, 18:27
Re: [HELP] SetTimer - by Larsey123IsMe - 13.12.2010, 18:39
Re: [HELP] SetTimer - by CyNiC - 13.12.2010, 18:43
Re: [HELP] SetTimer - by blackwave - 13.12.2010, 18:43
Re: [HELP] SetTimer - by iggy1 - 13.12.2010, 21:05

Forum Jump:


Users browsing this thread: 1 Guest(s)