SA-MP Forums Archive
ZCMD return command - 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)
+--- Thread: ZCMD return command (/showthread.php?tid=547863)



ZCMD return command - Derexi - 25.11.2014

How can I return a zcmd command in my script with parameters? So if someone clicks on a player's name, it returns a zcmd command (/stats) that I've already made but with a parameter (the clicked player's ID).


Re: ZCMD return command - dominik523 - 25.11.2014

pawn Код:
CMD:a(playerid, params[])
    return cmd_ahelp(playerid, params);

CMD:ahelp(playerid, params[])
{
    ....
}
EDIT: Try to do something like this:
pawn Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    new message[6];
    format(message, sizeof(message), "%d", clickedplayerid);
    return cmd_stats(playerid, message);
}
I did not test that code, the best thing you can do is to try with that and see what will happen.


Re: ZCMD return command - Abagail - 25.11.2014

You can do something like this. This supports commands in other scripts.

pawn Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
     if(IsPlayerConnected(playerid) && IsPlayerConnected(clickedplayerid))
     {
          CallLocalFunction("cmd_stats", "id", playerid, clickedplayerid);
          return true;
     }
     return 1;
}