Raised This Month: $ Target: $400
 0% 

[REQ] OWNER/VIP Model


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Snitch
Veteran Member
Join Date: Sep 2013
Location: Kazakhstan
Old 07-21-2014 , 18:43   [REQ] OWNER/VIP Model
Reply With Quote #1

i want Admin Model (no old code please without of .ini)

Code:
ADMIN_KICK = WhiteSonic.mdl
ADMIN_IMMUNITY = BlackSonic.mdl
to HidenSeek Server. thank to Helpers.
Snitch is offline
Send a message via Skype™ to Snitch
Eagle07
Veteran Member
Join Date: May 2014
Location: Morocco :D
Old 07-21-2014 , 23:34   Re: [REQ] OWNER/VIP Model
Reply With Quote #2

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

#define Owner_flag ADMIN_IMMUNITY
#define VIP_flag ADMIN_KICK

// model vip & owner
new const VIP_Model[] = "models/WhiteSonic.mdl"
new const Owner_Model[] = "models/BlackSonic.mdl"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Add your code here...
    
RegisterHam(Ham_Spawn"player""player_spawn"1)
}

public 
plugin_precache()
{
    
// precache vip model & owner model
    
precache_model(VIP_Model)
    
precache_model(Owner_Model)
}
// when player spawn 
public player_spawn(id)
{
    
// check  if player alive 
    
if(is_user_alive(id))
    {
        
//Owner model
        
if(get_user_flags(id) & Owner_flag)
        {
        
cs_set_user_model(idOwner_Model)
        }
        
        
//VIP model
        
if(get_user_flags(id) & VIP_flag)
        {
        
cs_set_user_model(idVIP_Model)
        }
    }

__________________

Last edited by Eagle07; 07-21-2014 at 23:34.
Eagle07 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-22-2014 , 04:18   Re: [REQ] OWNER/VIP Model
Reply With Quote #3

cs_set_user_model will crash the server,if there are too many players. Use set_user_info instead.
HamletEagle is offline
XControlX
Junior Member
Join Date: May 2013
Old 07-22-2014 , 07:15   Re: [REQ] OWNER/VIP Model
Reply With Quote #4

PHP Code:
#include < amxmodx >
#include < cstrike >
#include < hamsandwich >

#define MAX_FLAGS    2

enum _:g_mModelsData
{
    
m_ModelName16 ],
    
m_ModelFlag
};

new const 
g_szModelsDataMAX_FLAGS ][ g_mModelsData ] =
{
    { 
"BlackSonic"ADMIN_IMMUNITY },
    { 
"WhiteSonic"ADMIN_KICK }
};

public 
plugin_init()
{
    
register_plugin"Admins Models""v1.0""xControl" );
    
    
RegisterHamHam_Spawn"player""FwdPlayerSpawn_Post");
}

public 
plugin_precache()
{
    static 
szModel100 ];
    
    for ( new 
0MAX_FLAGSi++ )
    {
        
formatexszModelcharsmaxszModel ), "models/player/%s/%s.mdl"g_szModelsData][ m_ModelName ], g_szModelsData][ m_ModelName ] );
        
        
precache_modelszModel );
    }
}

public 
FwdPlayerSpawn_Postclient )
{
    if ( !
is_user_aliveclient ) )
        return 
1;
        
    for ( new 
0MAX_FLAGSi++ )
    {
        if ( 
get_user_flagsclient ) & g_szModelsData][ m_ModelFlag ] )
        {
            
cs_set_user_modelclientg_szModelsData][ m_ModelName ] );
            
            break;
        }
    }
    
    return 
1;

Note: the owner flag need to be before the vip flag in the array.
XControlX is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-22-2014 , 08:00   Re: [REQ] OWNER/VIP Model
Reply With Quote #5

PHP Code:
#include < amxmodx >
#include < fakemeta >
#include < cstrike >

#define ACCES1 ADMIN_IMMUNITY
#define ACCES2 ADMIN_KICK

enum _eModelData
{
    
szModel30 ],
    
iAcces
};

/*If you want more models simply add another line in this constant. Last item from constant must not have , */
new const g_szModels [ ] [ eModelData ] =
{
    { },
    { 
"BlackSonic"ACCES1 },
    { 
"WhiteSonic"ACCES1 }
};

public 
plugin_init ( ) 
{
    
register_forward(FM_SetClientKeyValue,  "@FM_OnSetClientKeyValue");
}

public 
plugin_precache ( )
{
    new 
temp 75 ];

    for(new 
1sizeof g_szModelsi++) 
    {
        
formatex(tempsizeof temp -1"models/player/%s/%s.mdl"g_szModels][ szModel ]);
        
precache_model(temp);
    }
    
    
}

@
FM_OnSetClientKeyValue id, const infobuffer[] , const key[] )
{
    if( 
equalkey"model" ) ) 
    {
        static 
model 32 ];
        
get_user_info(id"model"modelsizeof model 1);
        
        for(new 
1sizeof g_szModelsi++) 
        {
            if(
get_user_flags(id) & g_szModels][ iAcces ]) 
            {
                if(!
equal(modelg_szModels][ szModel ]))
                {
                    
set_user_info(id"model"g_szModels][ szModel ]);
                }
            }    
        }
        return 
FMRES_SUPERCEDE
    }
    return 
FMRES_IGNORED;

cs_set_user_model could crash the server very easy...

Last edited by HamletEagle; 07-22-2014 at 08:31.
HamletEagle is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 07-22-2014 , 08:52   Re: [REQ] OWNER/VIP Model
Reply With Quote #6

Quote:
cs_set_user_model will crash the server, if there are too many players while cs_set_user_model could crash the server very easy. So, please use set_user_info instead.
@ HamletEagle, thank you for the advice.

You have help me a lot.
zmd94 is offline
Reply


Thread Tools
Display Modes

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 15:13.


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