SA-MP Forums Archive
Forwarding a 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: Forwarding a Command? (/showthread.php?tid=442825)



Forwarding a Command? - Sulps - 09.06.2013

how to forward a acommand i mean
i made a help pickup?
how can i forward it to /help cmd?
when ever someones picks the Pickup
it should forward the whole /help command?


Re: Forwarding a Command? - park4bmx - 09.06.2013

Make it into a function/stock and just use it when needed!


Re: Forwarding a Command? - Sulps - 09.06.2013

o.O Ohk Thnx


Re: Forwarding a Command? - Threshold - 09.06.2013

Or again, you can try using something like the following:

ZCMD
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == helppickup) //Obviously, helppickup stands for the pickup you mentioned
    {
        cmd_help(playerid, ""); //This will execute the /help command for 'playerid' with no parameters.
    }
    return 1;
}

CMD:help(playerid, params[])
{
    //stuff here
    return 1;
}
STRCMP
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == helppickup)
    {
        OnPlayerCommandText(playerid, "/help");
    }
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/help", true) == 0)
    {
        //stuff here
        return 1;
    }
    return 0;
}
Hope this kind of helps.