Raised This Month: $ Target: $400
 0% 

Set player skin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
danielo_o
Member
Join Date: Mar 2011
Old 04-14-2013 , 09:26   Set player skin
Reply With Quote #1

I tried to set player skin depending on his name

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

public plugin_init() 

    
register_plugin("x""x""x")
    
RegisterHam(Ham_Spawn"player""fw_PlayerSpawn_Post"1


public 
plugin_precache() {
    
precache_model("models/player/leetsakalu/leetsakalu.mdl")
        
precache_model("models/player/leetsakalu/leetsakaluT.mdl")
        return 
PLUGIN_CONTINUE
}
public 
fw_PlayerSpawn_Post(id
{
            new 
CsTeams:userTeam cs_get_user_team(id)
        new 
name[32
        
get_user_name(idname31)
            if(
userTeam == CS_TEAM_CT
            {
         if( 
equal(name"SaKaLu") || equal(name"danniel")) 
            {        
             
cs_set_player_model(id"leetsakalu");  
            }
            }
                return 
PLUGIN_CONTINUE

It doesn't set my skin. I'm using Zp 4.3 fix 5a.
danielo_o is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 04-14-2013 , 09:29   Re: Set player skin
Reply With Quote #2

1. Learn how to indent code, that is terrible
2. Stop returning anything in plugin_precache, it's useless
3. Check if the user is alive in Ham_Spawn handler, chances are the player ID was incorrect and the plugin stopped working due to an error
4. Check errors in your error log

5. ZP probably overwrites your model changes anyway

Last edited by Backstabnoob; 04-14-2013 at 09:29.
Backstabnoob is offline
Bos93
Veteran Member
Join Date: Jul 2010
Old 04-14-2013 , 09:57   Re: Set player skin
Reply With Quote #3

cs_set_player_model is not working on the ZP, use zp_override_user_model
__________________
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
danielo_o
Member
Join Date: Mar 2011
Old 04-14-2013 , 10:42   Re: Set player skin
Reply With Quote #4

This won't work too.
Quote:
#include <amxmodx>
#include <zombieplague>

new const ModelVip[] = "leetsakalu"

public plugin_precache()
{
precache_player_model(ModelVip)
}

public zp_user_humanized_post(id)
{
new name[32]
get_user_name(id, name, 31)
if( equal(name, "SaKaLu") || equal(name, "danniel") && !zp_get_user_survivor(id)) zp_override_user_model(id, ModelVip);
}

precache_player_model(const modelname[])
{
static longname[128]
formatex(longname, charsmax(longname), "models/player/%s/%s.mdl", modelname, modelname)
precache_model(longname)

copy(longname[strlen(longname)-4], charsmax(longname) - (strlen(longname)-4), "T.mdl")
if (file_exists(longname)) precache_model(longname)
}
danielo_o 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 10:47.


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