AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [ Solved ] Player rights and sound (https://forums.alliedmods.net/showthread.php?t=76426)

xPaw 08-24-2008 11:20

[ Solved ] Player rights and sound
 
[ Solved, Thanks Exolent ;) ]

Arkshine 08-24-2008 11:26

Re: Player rights and sound
 
Quote:

i tryed to make
Show your code. ;)

xPaw 08-24-2008 11:34

Re: Player rights and sound
 
PHP Code:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Adm Connect Sound"
#define VERSION "1.0"
#define AUTHOR "xPaw"


public plugin_init()
    
register_plugin(PLUGINVERSIONAUTHOR)

public 
plugin_precache()
{
    
precache_sound("sounds/misc/admin.mp3")
    
precache_sound("sounds/misc/headadmin.mp3")
    
precache_sound("sounds/misc/vip.mp3")
}
    
public 
client_connect(id)
{
    if(
get_user_flags(id) && ADMIN_RESERVATION)
        
client_cmd(0"mp3 play sounds/misc/vip.mp3")
        
    if(
get_user_flags(id) && ADMIN_RCON)
        
client_cmd(0"mp3 play sounds/misc/headadmin.mp3")
        
    if(
get_user_flags(id) && ADMIN_ADMIN)
        
client_cmd(0"mp3 play sounds/misc/admin.mp3")



Dunn0 08-24-2008 12:26

Re: Player rights and sound
 
try do this with false and true somethink like if user connects and got flag reservation play sound else if user got reservation && ADMIN_RCON dont play i think u get idea :P

Exolent[jNr] 08-24-2008 12:31

Re: Player rights and sound
 
1. Cache the get_user_flags() value.
2. The correct way to check flags is (flags & ADMIN_*). Only 1 &.
3. Use else if() statements so that the ones after wont be used.

Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN "Adm Connect Sound" #define VERSION "1.0" #define AUTHOR "xPaw" public plugin_init()     register_plugin(PLUGIN, VERSION, AUTHOR) public plugin_precache() {     precache_sound("sounds/misc/admin.mp3")     precache_sound("sounds/misc/headadmin.mp3")     precache_sound("sounds/misc/vip.mp3") }     public client_connect(id) {     new flags = get_user_flags(id)         if(flags & ADMIN_RESERVATION)     {         // player had reservation flag         client_cmd(0, "mp3 play sounds/misc/vip.mp3")     }     else if(flags & ADMIN_RCON)     {         // player didn't have reservation but has rcon         client_cmd(0, "mp3 play sounds/misc/headadmin.mp3")     }     else if(flags & ADMIN_ADMIN)     {         // player didn't have reservation or rcon, but still is an admin         client_cmd(0, "mp3 play sounds/misc/admin.mp3")     } }

xPaw 08-24-2008 12:37

Re: Player rights and sound
 
okay thanks, but if i'm headadmin i got reservation anyway, and its says i'm vip o.O ?
i need to make there check, rcon, admin and then reservation, right ?

Exolent[jNr] 08-24-2008 12:41

Re: Player rights and sound
 
That won't work correctly because VIP players with reservation will be detected with ADMIN_ADMIN.

xPaw 08-24-2008 12:42

Re: Player rights and sound
 
i make not ADMIN_KICK, not ADMIN_ADMIN, just mine error

Exolent[jNr] 08-24-2008 12:43

Re: Player rights and sound
 
Then, yes. Do rcon, kick, then reservation.

xPaw 08-24-2008 12:44

Re: Player rights and sound
 
okay thanks, +k


All times are GMT -4. The time now is 03:10.

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