AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   playermodels (https://forums.alliedmods.net/showthread.php?t=127499)

FlyingHorse 05-21-2010 20:34

playermodels
 
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



Exolent[jNr] 05-21-2010 20:49

Re: playermodels
 
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.

FlyingHorse 05-22-2010 12:31

Re: playermodels
 
exolent, that's what i did, what do you mean? :S do i need 3 _'s or what's your point? :o

JaGareN 05-22-2010 12:52

Re: playermodels
 
The cvar have to be in plugin_init or I am I wrong?


All times are GMT -4. The time now is 03:32.

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