AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   give access only in some cases (https://forums.alliedmods.net/showthread.php?t=314215)

Nutu_ 02-08-2019 16:20

give access only in some cases
 
is there a possibilty to give to someone access only in some cases?
lets give an example, amx_slay, if you are a normal player you dont have access, but what if i add in a vipmenu the option to slay someone, am i able to give him permission to slay him without giving him slay flag?

thEsp 02-08-2019 16:27

Re: give access only in some cases
 
Use custom flags for command as well for VIP (for instance, 'z' is default for players,give VIPs 'x' flag)

DjSoftero 02-08-2019 16:29

Re: give access only in some cases
 
in plmenu.sma change an if statement on line 508 from this
PHP Code:

if (!cmd_access(idlevelcid1))
        return 
PLUGIN_HANDLED 

to this
PHP Code:

//global variable
can_slay[id]

if (!
cmd_access(idlevelcid1) && can_slay[id])
        return 
PLUGIN_HANDLED

public client_disconnet(id) {
        
can_slay[id] = 0


all you have to do now is create some sort of way to change the can_slay[index] variable to true on certain occasions.

Nutu_ 02-08-2019 16:30

Re: give access only in some cases
 
well, i think i got this but will the VIP be able to use amx_slay? cuz i dont want give him that permission, only when he uses it by vipmenu
EDIT: djsoftero, i just gave amx_slay as an example, that's not the command i'd like to give

thEsp 02-08-2019 16:33

Re: give access only in some cases
 
Quote:

Originally Posted by Nutu_ (Post 2638741)
well, i think i got this but will the VIP be able to use amx_slay? cuz i dont want give him that permission, only when he uses it by vipmenu

When you chose a item it automatically writes to client's cmd "slay ...".
But you can use a boolean which checks if command is executed by menu, switch it to true on
PHP Code:

menu_display 

and switch it to false on
PHP Code:

menu_destroy 

prop.

DjSoftero 02-08-2019 16:39

Re: give access only in some cases
 
Quote:

Originally Posted by Nutu_ (Post 2638741)
I just gave amx_slay as an example, that's not the command I'd like to give

Apply the same principle to other commands.


All times are GMT -4. The time now is 07:39.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.