SA-MP Forums Archive
2 Questions - 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: 2 Questions (/showthread.php?tid=340020)



2 Questions - TheArcher - 05.05.2012

Hello everybody. I have 2 quick questions.

1° Is possible to force a command to a player?
2° Is possible to play more sounds at once per player? (Streaming one)


AW: 2 Questions - vyper - 05.05.2012

1 - yes

2 - some sounds are compatible with others but I don't think all


Re: 2 Questions - SuperViper - 05.05.2012

1)

If you're using ZCMD, then you could simply do

pawn Код:
cmd_commandname(playerid, "");
unless the command has parameters in which case you would have to fill out the "" with the parameters.

As for strcmp, I'm not entirely sure but I guess you could do this

pawn Код:
CallLocalFunction("OnPlayerCommandText", "ds", playerid, "");
and just like I said for ZCMD, replace the "" with parameters.


2)

I don't believe so.


Re: 2 Questions - TheArcher - 05.05.2012

@SuperViper i don't need a command processor. I just need to FORCE a command to a player

E.g FoceCommandPlayer(0, "/help"); on that case the ID 0 will execute the command automaticaly.


Re: 2 Questions - SuperViper - 05.05.2012

If you actually read my post, you would see that I explained how to do it for both ZCMD and strcmp. Here's a function/macro though to force a command for a player.


strcmp:

pawn Код:
#define ForcePlayerCommand(%0, %1) CallRemoteFunction("OnPlayerCommandText", "ds", %0, %1)
ForcePlayerCommand(playerid, cmdtext[])


ZCMD:

pawn Код:
ForcePlayerCommand(playerid, cmd[], params[] = "")
{
    new functionName[32];
    format(functionName, sizeof(functionName), "cmd_%s", cmd);
    CallRemoteFunction(functionName, "ds", playerid, params);
}
ForcePlayerCommand(playerid, cmd[], params[] = "")

params is optional


Re: 2 Questions - TheArcher - 05.05.2012

@SuperViper Tested & Worked. I've never think about CallRemoteFunction XD.