Raised This Month: $ Target: $400
 0% 

Simple player model. [Please check]


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
happy_2012
Senior Member
Join Date: Aug 2012
Old 10-18-2015 , 13:41   Simple player model. [Please check]
Reply With Quote #1

Hey guys,
I just randomly coded this plugin, and I just wanted to know if it has a good quality and would actually function properly?

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

new Array:g_ArrPlayerModel;
new const 
g_szPlayerModel[][] = { "model_one""model_two" };

public 
plugin_precache()
{
    
g_ArrPlayerModel ArrayCreate(321);
    
    new 
Index;
    for(
Index 0Index sizeof g_szPlayerModelIndex++)
        
ArrayPushString(g_ArrPlayerModelg_szPlayerModel[index]);
    
    new 
Path[100];
    for(
Index 0Index ArraySize(g_ArrPlayerModel); Index++)
    {
        
ArrayGetString(g_ArrPlayerModelIndexPathcharsmax(Path));
        
format(Pathcharsmax(Path), "models/player/%s/%s.mdl"PathPath);
        
precache_model(Path);
        
        
format(Pathcharsmax(Path), "models/player/%s/%sT.mdl"PathPath);
        if( 
file_exists(Path) )
            
precache_model(Path);
    }
}

public 
plugin_init()
{
    
register_plugin("Model Set""1.0""Chilimax");
    
    
RegisterHam(Ham_Spawn"player""Ham_PlayerSpawn_Post"true);
}

public 
Ham_PlayerSpawn_Post(Index)
{
    if( !
is_user_alive(Index) || !cs_get_user_team(Index) )
        return;
    
    new 
Model[32];
    
ArrayGetString(g_ArrPlayerModelrandom_num(0ArraySize(g_ArrPlayerModel) - 1), Modelcharsmax(Model));
    
cs_set_user_model(IndexModel);

And what about this one, too?
PHP Code:
#include < amxmodx >
#include < cstrike >
#include < hamsandwich >

new const g_szPlayerModel[][] = { "model_one""model_two" };

public 
plugin_precache()
{
    new 
Path[100];
    for(
Index 0Index sizeof g_szPlayerModelIndex++)
    {
        
formatex(Pathcharsmax(Path), "models/player/%s/%s.mdl"g_szPlayerModel[Index], g_szPlayerModel[Index]);
        
precache_model(Path);
        
        
formatex(Pathcharsmax(Path), "models/player/%s/%sT.mdl"g_szPlayerModel[Index], g_szPlayerModel[Index]);
        if( 
file_exists(Path) )
            
precache_model(Path);
    }
}

public 
plugin_init()
{
    
register_plugin("Model Set""1.0""Chilimax");
    
    
RegisterHam(Ham_Spawn"player""Ham_PlayerSpawn_Post"true);
}

public 
Ham_PlayerSpawn_Post(Index)
{
    if( !
is_user_alive(Index) || !cs_get_user_team(Index) )
        return;
    
    new 
Model[32];
    
GetRandomModel(random_num(0sizeof g_szPlayerModel), Modelcharsmax(Model));
    
cs_set_user_model(IndexModel);
}

GetRandomModel(iRandomModel[], iLen)
{
    new 
Index;
    for(
Index 0Index sizeof g_szPlayerModelIndex++)
    {
        if( 
iRandom == Index )
            return 
formatex(ModeliLen"%s"g_szPlayerModel[iRandom]);
    }
    
    return -
1;

__________________
Discord contacts:
I rarely look at private messages here, but I am very active on Discord!

Last edited by happy_2012; 10-18-2015 at 13:57. Reason: New code
happy_2012 is offline
 



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


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