ZCMD return command
#1

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).
Reply
#2

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.
Reply
#3

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


Forum Jump:


Users browsing this thread: 1 Guest(s)