SA-MP Forums Archive
run command from gamemode in filterscript - 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: run command from gamemode in filterscript (/showthread.php?tid=484683)



run command from gamemode in filterscript - mrxqware - 01.01.2014

Happy new Year everyone!

Best wishes to all.

I've got a question; is there a way to run a command from a gamemode in a filterscript?
For example when a player uses /hello (from the filterscript) it will run also /commands (described in the gamemode).


Re: run command from gamemode in filterscript - Eliminator - 01.01.2014

You mean when he types /hello it shows him the Commands?
Well if that ok

Quote:

if (strcmp("/hello", cmdtext, true, 10) == 0)
{
PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
SendClientMessage(playerid, COLOR_BLUE, "------- Server Commands ------");
SendClientMessage(playerid, COLOR_BLUE, "[INFO]{00FFFF} ");
SendClientMessage(playerid, COLOR_BLUE, "[INFO]{00FFFF} ");
SendClientMessage(playerid, COLOR_BLUE, "[INFO]{00FFFF} ");
SendClientMessage(playerid, COLOR_BLUE, "[INFO]{00FFFF} ");
SendClientMessage(playerid, COLOR_BLUE, "[INFO]{00FFFF} ");
SendClientMessage(playerid, COLOR_BLUE, "[INFO]{00FFFF} ");
SendClientMessage(playerid, COLOR_BLUE, "[INFO]{00FFFF}");
SendClientMessage(playerid, COLOR_BLUE, "[INFO]{00FFFF} ");

return 1;



}

Just paste this under OnPlayerCommandText


Re: run command from gamemode in filterscript - newbienoob - 01.01.2014

Just load the filterscript?


Re: run command from gamemode in filterscript - mrxqware - 01.01.2014

Ty for the answers, but it's not where I'm looking for.

For example when I create a filterscript for driving lessons, I would like to run the command /getlic which is described in the gamemode. So I do not have to import the whole saving system in my filterscript to set Playerinfo[playerid][pDriverlic] = 1.

Is that possible?


Re: run command from gamemode in filterscript - mrxqware - 01.01.2014

Does anyone know how to do this?


Re: run command from gamemode in filterscript - Konstantinos - 01.01.2014

https://sampwiki.blast.hk/wiki/CallRemoteFunction

In the first parameter use: cmd_getlic
In the second parameter use: "is"
In the last one (arguments) use the playerid and the params you want for that command.


Re: run command from gamemode in filterscript - mrxqware - 01.01.2014

Ty for the answer. Should I do:

CallRemoteFunction("cmd_getlic", "is", playerid");

Will this automatically call the command /getlic listed in the gamemode from the filterscript?


Re: run command from gamemode in filterscript - Konstantinos - 02.01.2014

Yes, it calls a public function in any script you use.
pawn Код:
CallRemoteFunction("cmd_getlic", "is", playerid, "");



AW: run command from gamemode in filterscript - BigETI - 02.01.2014

Just return 0 at your filterscript. The server will think, that the command does not exist and proceeds to other scripts including your game mode.