SA-MP Forums Archive
Question! - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Question! (/showthread.php?tid=175989)



Question! - ColdXX - 11.09.2010

Ok so the question is not a question lol :P

I have in my GM some DM areas and Speed Boost and Bunny Hop!
I turned off Speed Boost and other commands in DM Areas and all works fine!

Now i have made a FS with some minigames (Last Man Standing) where i also want to Disable those commands /v /l /s and stuff!

How can i do that without Including the FS in the GM?

Thanks!


Re: Question! - PotH3Ad - 11.09.2010

Use PVars: https://sampwiki.blast.hk/wiki/Per-player_variable_system

"PVars can be shared/accessed across gamemode scripts and filterscripts, making it easier to modularise your code."


Re: Question! - ColdXX - 11.09.2010

Shit,what i hate the most. Can u like give me an example of how can i do it?


Re: Question! - PotH3Ad - 11.09.2010

Hope this helps

pawn Код:
CMD:v(playerid, params[])
{
    //The player can't use this cmd while in a DM
    if(GetPVarInt(playerid, "InDM") == 1) return SendClientMessage(playerid, 0xFAFAFAFA, "You can't use this command while in a DM!");
    return 1;
}

//When the player enter's a game set the pvar to true
//Ex: SetPVarInt(playerid, "InDM", 1);
//You will want to set it to 0 when the player exits the dm game

//You will want to use PVars in both the GM and the FS



Re: Question! - ColdXX - 11.09.2010

Ahh i see! Thanks!

Oh btw ermm i have this in ma GM

new DmArea[MAX_PLAYERS];

In any other teleport command i have this: if(DmArea[playerid] = 1) return SendClientMessage(playerid,....bla bla);
(While im in DM Area i cant teleport,but type /exitdm);

So can i use the same thing in teh FS?

And while player in the Minigun add this? if(DmArea[playerid] = 1) return SendClientMessage(playerid,....bla bla);


Re: Question! - Rachael - 11.09.2010

if you want to disable commands that are in the gamemode, just put OnPlayerCommandText in the filterscript, and return 1 after detecting the command.
pawn Код:
public OnPlayerCommandText(playerid,cmdtext[])
{
    new cmd[128],idx;
    cmd = strtok(cmdtext, idx);
    if(!strcmp(cmd,"/s",true))
    {
         SendClientMessage(playerid,0xFFAAFF00,"Command disabled for event");
         return 1; //return 1 will stop the callback in your GM
     }
     return 0;
}
obviously it depends what command system you use.

If you only want to block the commands for the players in the minigame, then assuming your filterscript keeps track of the players, it is quite easy to put in a check before the 'return 1;' above that will 'return 0;' if they are not involved in the minigame.


Re: Question! - ColdXX - 11.09.2010

but i have many cmds,and doing that its simple BS