Raised This Month: $ Target: $400
 0% 

How can I give the player a command that only admins can use?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AloongSleep
Junior Member
Join Date: Sep 2022
Old 04-27-2023 , 02:53   How can I give the player a command that only admins can use?
Reply With Quote #1

Good morning, I don't know much about sourcespawn, therefore I don't know how to solve this question, I would like to be able to add commands that only administrators are allowed to common players through a menu, I was looking at pan0s' post on how to add commands that do not have the option to give but it is not very clear to me.
give the following example:

PHP Code:
            if(StrEqual(item"extinguisher"))
            {
                
CheckHavingGunToUseItem(clientitem);
                
ExternalCmd(client"sm_giveext"1);
            }
            else if(
IndexOf(item32"airstrike"9) != -1)
            {
                
int target 0;
                
/* Create an Airstrike. Usage: 
                // sm_strikes <#userid|name> <type: 
                    1=Aim position. 
                    2=On position> 
                    OR vector position <X> <Y> <Z> <angle>
                */
                
char crosshair[] = "crosshair";
                
char position[] = "position";
                if(
IndexOf(item32crosshairsizeof(crosshair)) != -1target 1;
                else if (
IndexOf(item32positionsizeof(position)) != -1target 2;

                
ExternalCmd(client"sm_strikes"target);

            }
       
//<---------- Add an else if(){} here , refer to above. IndexOf(item, 32, "airstrike", 9) != -1 means the item name that has "airstrike", -1 = don't have
            
else CheatCommand(client"give"item); 
This same one from Silvers plugin - Extinguisher & Flamethrower, which is an administrator command, Thanks in advance for the help.
AloongSleep is offline
LinLinLin
Senior Member
Join Date: Sep 2021
Old 04-28-2023 , 02:58   Re: How can I give the player a command that only admins can use?
Reply With Quote #2

maybe use RegAdminCmd() and set the flag like ADMFLAG_CHEATS, this is the level "N" admin.
LinLinLin is offline
AloongSleep
Junior Member
Join Date: Sep 2022
Old 04-28-2023 , 14:21   Re: How can I give the player a command that only admins can use?
Reply With Quote #3

Quote:
Originally Posted by LinLinLin View Post
maybe use RegAdminCmd() and set the flag like ADMFLAG_CHEATS, this is the level "N" admin.
Thank you, it worked correctly for what I was looking for.
AloongSleep is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:14.


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