SA-MP Forums Archive
How to disable command with 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: How to disable command with filterscript (/showthread.php?tid=530544)



How to disable command with filterscript - bobsona - 07.08.2014

Hello!
I want to create filterscript that prohibit the use of a command that is defined in the gamemode.
I can not access the PWN file of the gamemode and therefore I must figure out a way to disable the use of this command on all players.
Any ideas?

P.S. Sorry for my English, I'm Bulgarian.

Server: 0.3z-R3


Re: How to disable command with filterscript - Champ - 07.08.2014

there is a function introduced earlier in sa-mp version:

SetPVarInt(playerid, "varname", value);

These can be used for connecting gamemode and filterscripts.

For more info. Click here :
https://sampwiki.blast.hk/wiki/Per-player_variable_system


Re: How to disable command with filterscript - bobsona - 07.08.2014

Can you give me some examples?
I'm new in scripting.
If I want to disable the command "/command1" for all players, what I must do?


Re: How to disable command with filterscript - Champ - 07.08.2014

i didn't get what you wanted but still i am giving you a example of heal command..

if player is in dm area. you can disable heal command.

pawn Код:
new inDM[MAX_PLAYERS]; // to detect if player in dm or not.

public OnPlayerConnect(playerid)
{
    SetPVarInt(playerid, "canHeal", 1);
    return 1;
}

CMD:dm1(playerid, params[])
{
    SetPlayerPos(playerid, x,y,z); // your desired coords
    SetPVarInt(playerid, "canHeal", 0);
    return 1;
}
and now the filterscript of a heal command.

pawn Код:
#define FILTERSCRIPT

CMD:heal(playerid, params[])
{
    if(GetPVarInt(playerid, "canHeal") == 1) SetPlayerHealth(playerid, 100);
    else return SendClientMessage(playerid, -1, "You can't heal in DM area"):
    return 1;
}
Hope, you now understand how it works. If you have still any other problem. Just PM me.
EDIT: I am using Zcmd here just for example.


Re: How to disable command with filterscript - bobsona - 07.08.2014

I'll try to explain again. Maybe the problem comes from my bad English.
I have a command that restarts all cars in the server.
All players in the server can use this command and they take advantage of this and write it a hundred times and server crashes. I want to make sure that they can not use this command, but as I said I don't have the pwn file of the gamemode.
I am looking for a way to disable the command with filterscript.


Re: How to disable command with filterscript - Champ - 07.08.2014

i don't think you can script without pwn file. as you have to put pvars in both script. You can either de_amx it and do little editing. I am sure you can't disabled gamemode command without having pwn file of it. :/

Suggestion: Just add a rule that if anyone did this bug will be banned or something like that.


Re: How to disable command with filterscript - Clad - 07.08.2014

Quote:
Originally Posted by bobsona
Посмотреть сообщение
I'll try to explain again. Maybe the problem comes from my bad English.
I have a command that restarts all cars in the server.
All players in the server can use this command and they take advantage of this and write it a hundred times and server crashes. I want to make sure that they can not use this command, but as I said I don't have the pwn file of the gamemode.
I am looking for a way to disable the command with filterscript.
Copy from your GameMode the define variables and place it in the FilterScript, After that, Change the commands from regular players to admins.


Re: How to disable command with filterscript - bobsona - 07.08.2014

Actually it turned out that the command is defined in one of the filterscripts, not in the gamemode.
But I don't have the pwn of this filterscript so I removed it from server.cfg
Thanks for all help!


Re: How to disable command with filterscript - Stinged - 07.08.2014

Why do you delete the pwn files ._.


Re: How to disable command with filterscript - bobsona - 07.08.2014

I did not delete them, I just do not have them.

@Champ
So far I have banned at least 10 people. This does not help.