AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   need help with zp lvl code (https://forums.alliedmods.net/showthread.php?t=276603)

shady101 12-24-2015 01:48

need help with zp lvl code
 
So the code i have makes a prefix for players , showing their levels, resets, sresets before their name
example : [level 500] [Reset 5] [Sreset 3] Player: chat


the prefix itself is Green, playername is team color, and the chat is regular color
what i wanted to do was have the same prefix for admins except make admin names White, and their chat green no matter which team they're on
even if name color cant be changed to white or grey, if admin chat is green while dead and alive, and while dead both admins and regular players have [Dead] prefix , that'd be good
Code:

public HookSay(id)
{
    static message[190]
    read_args(message, charsmax(message))
    remove_quotes(message)
 
    if (equal(message, ""))
    return PLUGIN_HANDLED;
 
    if (is_user_alive(id) && (get_user_flags(id) & ADMIN_IMMUNITY))
        zp_colored_print(0, "^x04[-Level %d] [-Reset %d] [-SReset %d]^x02 %s^x01^x04: %s", g_level[id], g_reset[id], g_grandreset[id], g_playername[id], message)
    else
        zp_colored_print(0, "^x04[Dead]^x02 %s^x04 : %s", g_playername[id], message)
    if (is_user_alive(id))
                zp_colored_print(0, "^x04[-Level %d] [-Reset %d] [-SReset %d]^x03 %s^x01 : %s", g_level[id], g_reset[id], g_grandreset[id], g_playername[id], message)
        else
                zp_colored_print(0, "^x04[Dead]^x03 %s^x01 : %s", g_playername[id], message)
       
        return PLUGIN_HANDLED;

}

thats the code, yet so far this is what it looks like : http://images.akamai.steamuserconten...A96FEBE343E58/
and for normal players it looks like this
http://puu.sh/m6VdO/7c33a782bc.jpg

and i have tried plugins with admin prefix, they make the plugin's own prefix ( Levels, Resets , Sresets ) go away and be replaced by [Admin] instead, and thats not what i wanted
i have also tried admin chat colors and it had no effect at all. im not really a coder much so if anyone can help me out with it i'd really appretiate it

siriusmd99 12-24-2015 16:56

Re: need help with zp lvl code
 
PHP Code:

public HookSay(id)
{
    static 
message[190]
    
read_args(messagecharsmax(message))
    
remove_quotes(message)
   
    if (
equal(message""))
    return 
PLUGIN_HANDLED;
   
    if (
is_user_alive(id))
        
zp_colored_print(0"^x04%s[-Level %d] [-Reset %d] [-SReset %d]^x02 %s^x01 : %s",(get_user_flags(id) & ADMIN_IMMUNITY) ? "[ADMIN]" "" ,g_level[id], g_reset[id], g_grandreset[id], g_playername[id], message)
    else
        
zp_colored_print(0"^x04%s[Dead]^x03 %s^x01 : %s", (get_user_flags(id) & ADMIN_IMMUNITY) ? "ADMIN" ""g_playername[id], message)
    
    return 
PLUGIN_HANDLED;



This should put [ADMIN] in front of the message.
From the edit i understood that you wanted this.

shady101 12-25-2015 23:07

Re: need help with zp lvl code
 
Quote:

Originally Posted by siriusmd99 (Post 2375961)
PHP Code:

public HookSay(id)
{
    static 
message[190]
    
read_args(messagecharsmax(message))
    
remove_quotes(message)
   
    if (
equal(message""))
    return 
PLUGIN_HANDLED;
   
    if (
is_user_alive(id))
        
zp_colored_print(0"^x04%s[-Level %d] [-Reset %d] [-SReset %d]^x02 %s^x01 : %s",(get_user_flags(id) & ADMIN_IMMUNITY) ? "[ADMIN]" "" ,g_level[id], g_reset[id], g_grandreset[id], g_playername[id], message)
    else
        
zp_colored_print(0"^x04%s[Dead]^x03 %s^x01 : %s", (get_user_flags(id) & ADMIN_IMMUNITY) ? "ADMIN" ""g_playername[id], message)
    
    return 
PLUGIN_HANDLED;



This should put [ADMIN] in front of the message.
From the edit i understood that you wanted this.




oh no, i just wanted The admin Name to be Grey/White color, and admin chat to be green
and when player or admin is dead, have the [dead] prefix

i do NOT want [admin] prefix like that

siriusmd99 12-26-2015 09:46

Re: need help with zp lvl code
 
PHP Code:

public HookSay(id)
{
    static 
message[190]
    
read_args(messagecharsmax(message))
    
remove_quotes(message)
   
    if (
equal(message""))
    return 
PLUGIN_HANDLED;
   
    if (
get_user_flags(id) & ADMIN_IMMUNITY){
         if(
is_user_alive(id))
           
zp_colored_print(0"^x04[-Level %d] [-Reset %d] [-SReset %d]^x01 %s^x04: %s",    g_level[id], g_reset[id], g_grandreset[id], g_playername[id], message)
         else
        
zp_colored_print(0"^x04[Dead]^x01 %s^x04 : %s"g_playername[id], message)
    }else{
         if (
is_user_alive(id))
        
zp_colored_print(0"^x04[-Level %d] [-Reset %d] [-SReset %d]^x03 %s^x01 : %s"g_level[id], g_reset[id], g_grandreset[id], g_playername[id], message)
    else
        
zp_colored_print(0"^x04[Dead]^x03 %s^x01 : %s"g_playername[id], message)
    }
    return 
PLUGIN_HANDLED;



shady101 12-27-2015 00:45

Re: need help with zp lvl code
 
Quote:

Originally Posted by siriusmd99 (Post 2376428)
PHP Code:

public HookSay(id)
{
    static 
message[190]
    
read_args(messagecharsmax(message))
    
remove_quotes(message)
   
    if (
equal(message""))
    return 
PLUGIN_HANDLED;
   
    if (
get_user_flags(id) & ADMIN_IMMUNITY){
         if(
is_user_alive(id))
           
zp_colored_print(0"^x04[-Level %d] [-Reset %d] [-SReset %d]^x01 %s^x04: %s",    g_level[id], g_reset[id], g_grandreset[id], g_playername[id], message)
         else
        
zp_colored_print(0"^x04[Dead]^x01 %s^x04 : %s"g_playername[id], message)
    }else{
         if (
is_user_alive(id))
        
zp_colored_print(0"^x04[-Level %d] [-Reset %d] [-SReset %d]^x03 %s^x01 : %s"g_level[id], g_reset[id], g_grandreset[id], g_playername[id], message)
    else
        
zp_colored_print(0"^x04[Dead]^x03 %s^x01 : %s"g_playername[id], message)
    }
    return 
PLUGIN_HANDLED;



thank u so much sir


All times are GMT -4. The time now is 18:13.

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