Raised This Month: $51 Target: $400
 12% 

Help me with changelevel


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Arje
Senior Member
Join Date: Apr 2020
Location: Córdoba, Argentina
Old 05-30-2020 , 20:30   Help me with changelevel
Reply With Quote #1

Hi ! I would like only the admins when I put say /d2, the server changelevel de_dust2, i try this?¿

PHP Code:
#include <amxmodx>
#include <amxmisc>


public plugin_init()
{
    
register_plugin("Je Je""1.0""Je")

    
register_clcmd("say /d2""mapita")
    
}

public 
mapita(id)
{
    if(!
is_user_admin(id) )
    {    
    
server_cmd"changelevel de_dust2" )
    }
    return 
PLUGIN_CONTINUE

Arje is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-30-2020 , 21:06   Re: Help me with changelevel
Reply With Quote #2

The exclamation point means NOT. So, your code is essentially saying "if the user is NOT an admin, then execute the changelevel command".
__________________
fysiks is offline
supertrio17
Senior Member
Join Date: May 2020
Location: Serbia
Old 05-31-2020 , 11:18   Re: Help me with changelevel
Reply With Quote #3

PHP Code:
#include <amxmodx>
#include <amxmisc>

#define COMMAND "changelevel de_dust2"
#define DATA_FLAG "j"

public plugin_init()
{
    
register_plugin("Je Je""1.2""Je")
    
register_clcmd("say /d2""change_map")
    
}

public 
change_map(id)
{
    if (
has_flag(idDATA_FLAG))
    {
        
server_cmd(COMMAND)
    }

Tested and working

Btw, I added so you can change which flag you want your admin to have so he can use this command. Otherwise even VIP's could change your map, because most of VIP's have flag "t" or "q" wich are considered as admin flags

Last edited by supertrio17; 05-31-2020 at 11:21.
supertrio17 is offline
Arje
Senior Member
Join Date: Apr 2020
Location: Córdoba, Argentina
Old 05-31-2020 , 11:56   Re: Help me with changelevel
Reply With Quote #4

Quote:
Originally Posted by fysiks View Post
The exclamation point means NOT. So, your code is essentially saying "if the user is NOT an admin, then execute the changelevel command".
you're right my mistake

Quote:
Originally Posted by fysiks View Post
Tested and working

Btw, I added so you can change which flag you want your admin to have so he can use this command. Otherwise even VIP's could change your map, because most of VIP's have flag "t" or "q" wich are considered as admin flags
thanks ! great detail, it works correctly!
Arje 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 06:09.


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