How to disable command with filterscript
#1

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

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

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?
Reply
#4

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

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

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

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

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

Why do you delete the pwn files ._.
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)