AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help me with changelevel (https://forums.alliedmods.net/showthread.php?t=324892)

Arje 05-30-2020 20:30

Help me with changelevel
 
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



fysiks 05-30-2020 21:06

Re: Help me with changelevel
 
The exclamation point means NOT. So, your code is essentially saying "if the user is NOT an admin, then execute the changelevel command".

supertrio17 05-31-2020 11:18

Re: Help me with changelevel
 
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 :)

Arje 05-31-2020 11:56

Re: Help me with changelevel
 
Quote:

Originally Posted by fysiks (Post 2703241)
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 (Post 2703241)
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!


All times are GMT -4. The time now is 17:06.

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