Problem with disabling commands
#1

I made some DM zones for my server and disabled all the commands that are in the gamemode but i want to forbide some of the cmds which are in the admin system as a fs (ladmin4v2). I use the code from this topic https://sampforum.blast.hk/showthread.php?tid=79784

Thanks in advance
Reply
#2

Good question...I currently need to know how to disabe FS commands as well.

I did use something similar on my FS to what was shown in the link you provided but still having two sets of commands turned off simultaneously would have you using something that will turn them off for both when activated.
Reply
#3

PHP код:
Top of your script:
new 
InDM[MAX_PLAYERS]; 
Under onplayerconnect:
InDM[playerid] = 0;
Under onplayerspawn:
InDM[playerid] = 0;
If 
he is in DM and uses the commandadd this line to your cmd.
CMD:test(playerid,params[])
        {
        if(
InDM[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,"You cant use commands in DM");
        return 
1;
        }
It sets him to DMZone with InDM[playerid]=1;
CMD:dm(playerid,params[])
        {
        if(
InDM[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,"You cant use commands in DM");
        
GivePlayerWeapon(playerid24,500);
        
GivePlayerWeapon(playerid,25,500);
        
InDM[playerid]=1;
        return 
1;
        } 
Reply
#4

Thanks for -1 rep. only tried to help.
Reply
#5

I haven't given you any reputation yet.. I will try this code

PS: I did all this in your code but my problem is how to forbide commands in the filterscript as well as in the gamemode with the same code? Because if i disable the cmds from the gamemode and the fs it doesn't work. Only these which are in the file where the DM teleport is work
Reply
#6

If you need to block the commands in both a gamemode and a filterscript, use a PVar.

https://sampwiki.blast.hk/wiki/SetPlayerPVar
https://sampwiki.blast.hk/wiki/GetPlayerPVar

Basically the same thing, just a little slower - but that's the price you have to pay to be able to access things across multiple scripts.

Also, Can4ns, work on your indentation!
Reply
#7

Did you read what is it on the links : There is currently no text in this page, you can search for this page title in other pages or edit this page.

Give examples please (if it is not a problem)
Reply
#8

Oh right, my fault! I forgot the names of the functions, silly me!

https://sampwiki.blast.hk/wiki/SetPVarInt
https://sampwiki.blast.hk/wiki/GetPVarInt

There are examples on the Wiki page.
Reply
#9

Thank you buy I am not so good at pawno and my question might anger you but can you show me how exactly i can link the gamemode and the fs to forbide both the commands from the gm and fs

Thanks in advance and sorry for my too many questions
Reply
#10

pawn Код:
CMD:dmzone(playerid, params[])
{
    if(GetPVarType(playerid, "DMZONE") != 0) // are they already in a dm zone?
        return SendClientMessage(playerid, COLOR, "You're already in a DM zone silly child!");
   
    // if they weren't in a DM zone, the code below this will be executed
    SetPVarInt(playerid, "DMZONE", 1); // set the pvar to show that they're in a DM zone
    SendClientMessage(playerid, COLOR, "Welcome to the DM zone!");
    return 1;
}

CMD:testcommand(playerid, params[])
{
    if(GetPVarType(playerid, "DMZONE") != 0) // are they in a dm zone?
        return SendClientMessage(playerid, COLOR, "You cannot use this command while in a DM zone."); // yes, send them a message; they cannot use this command
   
    // if they aren't in a DM zone, execute some code
    SendClientMessage(playerid, COLOR, "Test message");
    return 1;
}

// When you remove a player from a DM zone, make sure you add "DeletePVar(playerid, "DMZONE");" to your code as it will make it so they aren't registered in a DM zone and delete the pvar, obviously by the title     

// You can use "GetPVarType(playerid, "DMZONE")" in filterscripts as data from a PVar is in a server's memory
You need to read all of the comments, everything is explained.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)