Returning Command with parameters (ZCMD)
#1

I have a dialog that shows up when you click a player that lists several admin functions. Under OnDialogResponse, I want to be able to execute commands and use the clickedplayerid as a parameter. For example
pawn Код:
//Dialog Response
switch(listitem)
{
     case 0:
     {
          return cmd_kick(playerid, params);
except replacing params with the clickedplayerid. If there is a better way of doing this, let me know but this appears to be the most simple. Thanks
Reply
#2

do a global variable:
pawn Код:
new ClickID[MAX_PLAYERS];

public OnPlayerClickPlayer(/*...*/)
{
ClickID[playerid] = clickedplayerid;
}

public OnDialogResponse(/*...*/);
{
switch(listitem)
{
     case 0:
     {
          if(ClickID[playerid] != INVALID_PLAYER_ID)
          {
               cmd_kick(playerid, ClickID[playerid]);
               ClickID[playerid] = INVALID_PLAYER_ID;
          }
Reply
#3

Thanks, thats what I had basically except without the invalid player id check. Thanks again!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)