[HELP] Dialog - OnPlayerClickPlayer
#6

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


Messages In This Thread
[HELP] Dialog - OnPlayerClickPlayer - by Larsey123IsMe - 21.12.2010, 23:42
Re: [HELP] Dialog - OnPlayerClickPlayer - by Retardedwolf - 21.12.2010, 23:44
Re: [HELP] Dialog - OnPlayerClickPlayer - by Larsey123IsMe - 21.12.2010, 23:53
Re: [HELP] Dialog - OnPlayerClickPlayer - by mmrk - 22.12.2010, 00:07
Re: [HELP] Dialog - OnPlayerClickPlayer - by Larsey123IsMe - 22.12.2010, 00:24
Re: [HELP] Dialog - OnPlayerClickPlayer - by mmrk - 22.12.2010, 00:29
Re: [HELP] Dialog - OnPlayerClickPlayer - by Larsey123IsMe - 22.12.2010, 00:40
Re: [HELP] Dialog - OnPlayerClickPlayer - by mmrk - 22.12.2010, 00:44
Re: [HELP] Dialog - OnPlayerClickPlayer - by Retardedwolf - 22.12.2010, 00:48
Re: [HELP] Dialog - OnPlayerClickPlayer - by Larsey123IsMe - 22.12.2010, 00:49

Forum Jump:


Users browsing this thread: 2 Guest(s)