Raised This Month: $ Target: $400
 0% 

playermodels


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
FlyingHorse
Senior Member
Join Date: Apr 2010
Location: Under your bed.
Old 05-21-2010 , 20:34   playermodels
Reply With Quote #1

Why doesn't this work? ..

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

new cvar_on

public plugin_init()
{
    
register_plugin("Jailbreak Models""1.0""Drekes")
    
    
RegisterHam(Ham_Spawn"player""Event_Playerspawn"1)
}

public 
plugin_precache()
{
    
cvar_on register_cvar("jb_models""1")
    
    if(
get_pcvar_num(cvar_on))
    {
        
precache_model("models/player/guard/guardct1.mdl")
        
precache_model("models/player/prisoner/prisonert1.mdl")
    }
}


public 
Event_Playerspawn(id)
    
set_task(0.5"set_models"id)
    
public 
set_models(id)
{
    if(!
is_user_alive(id) || cs_get_user_team(id) == CS_TEAM_SPECTATOR)
        return 
PLUGIN_HANDLED
        

    
if(cs_get_user_team(id) == CS_TEAM_CT)
        
cs_set_user_model(id"models/player/guard/guardct1.mdl")
        
    else if(
cs_get_user_team(id) == CS_TEAM_T)
        
cs_set_user_model(id"models/player/prisoner/prisonert1.mdl")
        
    return 
PLUGIN_HANDLED

FlyingHorse is offline
Send a message via Skype™ to FlyingHorse
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-21-2010 , 20:49   Re: playermodels
Reply With Quote #2

1. Precache the models regardless of what the cvar value is.
Check the cvar value before setting the model.

2. The model path uses a special format:
models/player/model_name_here/model_name_here.mdl

If you don't follow that format, it won't work.

3. In cs_set_user_model(), you only use the "model_name_here", not the whole file path.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
FlyingHorse
Senior Member
Join Date: Apr 2010
Location: Under your bed.
Old 05-22-2010 , 12:31   Re: playermodels
Reply With Quote #3

exolent, that's what i did, what do you mean? :S do i need 3 _'s or what's your point?
FlyingHorse is offline
Send a message via Skype™ to FlyingHorse
JaGareN
Senior Member
Join Date: Mar 2009
Old 05-22-2010 , 12:52   Re: playermodels
Reply With Quote #4

The cvar have to be in plugin_init or I am I wrong?
JaGareN 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 03:32.


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