Returning Command with parameters (ZCMD) - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Returning Command with parameters (ZCMD) (
/showthread.php?tid=212360)
Returning Command with parameters (ZCMD) -
randomkid88 - 17.01.2011
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
Re: Returning Command with parameters (ZCMD) -
*IsBack - 17.01.2011
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;
}
Re: Returning Command with parameters (ZCMD) -
randomkid88 - 17.01.2011
Thanks, thats what I had basically except without the invalid player id check. Thanks again!