Question!
#1

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!
Reply
#2

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

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

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
Reply
#5

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);
Reply
#6

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)