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

entity color


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nutu_
AlliedModders Donor
Join Date: Mar 2016
Location: Germany
Old 03-28-2020 , 15:14   entity color
Reply With Quote #1

PHP Code:
public cmdLockBlock(id)
{
    if (!
g_boolCanBuild && g_iLockBlocks)
    {
        
client_print(idprint_center"%L"LANG_SERVER"FAIL_LOCK");
        return 
PLUGIN_HANDLED;
    }
    
    if (!
access(idFLAGS_LOCK) || (g_isZombie[id] && !access(idFLAGS_OVERRIDE)))
        return 
PLUGIN_HANDLED;
    
    new 
entbodypart
    get_user_aiming 
(id,ent,bodypart)
    
    new 
szTarget[7], szClass[10];
    
entity_get_string(entEV_SZ_targetnameszTarget6);
    
entity_get_string(entEV_SZ_classnameszClass9);
    if (!
ent || !is_valid_ent(ent) || is_user_alive(ent) || ent == g_iEntBarrier || !equal(szClass"func_wall") || equal(szTarget"ignore"))
        return 
PLUGIN_HANDLED;
    
    
ExecuteForward(g_fwLockEnt_Preg_fwDummyResultident);
    
    switch (
g_iLockBlocks)
    {
        case 
0:
        {
            if (!
BlockLocker(ent) && !IsMovingEnt(ent))
            {
                
LockBlock(entid);
                
set_pev(ent,pev_rendermode,kRenderTransColor)
                
set_pev(ent,pev_rendercolor,Float:{LOCKED_COLOR})
                
set_pev(ent,pev_renderamt,Float:{LOCKED_RENDERAMT})
                
client_cmd(id"spk %s"LOCK_OBJECT);
                
            }
            else if (
BlockLocker(ent))
            {
                
UnlockBlock(ent)
                
set_pev(ent,pev_rendermode,kRenderNormal)
                
client_cmd(id"spk %s"LOCK_OBJECT);
            }
        }
        case 
1:
        {
            if (!
BlockLocker(ent) && !IsMovingEnt(ent))
            {
                if (
g_iOwnedEntities[id]<g_iLockMax || !g_iLockMax)
                {
                    
LockBlock(entid)
                    
g_iOwnedEntities[id]++
                    
set_pev(ent,pev_rendermode,kRenderTransColor)
                    
set_pev(ent,pev_rendercolor,g_fColor[g_iColor[id]])
                    
set_pev(ent,pev_renderamt,Float:{LOCKED_RENDERAMT})
                    
                    
client_print(idprint_center"%L [ %d / %d ]"LANG_SERVER"BUILD_CLAIM_NEW"g_iOwnedEntities[id], g_iLockMax)
                    
client_cmd(id"spk %s"LOCK_OBJECT);
                }
                else if (
g_iOwnedEntities[id]>=g_iLockMax)
                {
                    
client_print(idprint_center"%L"LANG_SERVER"BUILD_CLAIM_MAX"g_iLockMax)
                    
client_cmd(id"spk %s"LOCK_FAIL);
                }
            }
            else if (
BlockLocker(ent))
            {
                if (
BlockLocker(ent) == id || access(idFLAGS_OVERRIDE))
                {
                    
g_iOwnedEntities[BlockLocker(ent)]--
                    
set_pev(ent,pev_rendermode,kRenderNormal)
                    
                    
client_print(BlockLocker(ent), print_center"%L [ %d / %d ]"LANG_SERVER"BUILD_CLAIM_LOST"g_iOwnedEntities[BlockLocker(ent)], g_iLockMax)
                    
                    
UnlockBlock(ent)
                    
client_cmd(id"spk %s"LOCK_OBJECT);
                }
                else
                {
                    
client_print(idprint_center"%L"LANG_SERVER"BUILD_CLAIM_FAIL")
                    
client_cmd(id"spk %s"LOCK_FAIL);
                }
            }    
        }
    }
    
    
ExecuteForward(g_fwLockEnt_Postg_fwDummyResultident);
    
    return 
PLUGIN_HANDLED

all i want is that, if user has admin_level_h, the entity is colored, if he doesnt, it just claimed the entity but does not colorize it, i've tried something but didnt worked, any idea?
__________________
a simple act of caring creates an endless ripple.
Nutu_ is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-28-2020 , 15:21   Re: entity color
Reply With Quote #2

Code:
set_pev(ent,pev_rendermode,kRenderTransColor) set_pev(ent,pev_rendercolor,Float:{LOCKED_COLOR}) set_pev(ent,pev_renderamt,Float:{LOCKED_RENDERAMT})

Code:
set_pev(ent,pev_rendermode,kRenderTransColor) set_pev(ent,pev_rendercolor,g_fColor[g_iColor[id]]) set_pev(ent,pev_renderamt,Float:{LOCKED_RENDERAMT})

Simply check the user's flags before using these.
__________________

Last edited by OciXCrom; 03-28-2020 at 15:22.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Nutu_
AlliedModders Donor
Join Date: Mar 2016
Location: Germany
Old 03-28-2020 , 15:34   Re: entity color
Reply With Quote #3

oh thanks, i checked user's flag somewhere else, solved
__________________
a simple act of caring creates an endless ripple.
Nutu_ 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 09:02.


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