Raised This Month: $ Target: $400
 0% 

Set model


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 06-20-2014 , 15:50   Re: Set model
Reply With Quote #1

I think everything is explained here.
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>

public plugin_init() {
    
    
/*We register some random function to set the model*/
    
register_clcmd("say /model""SomeFunctionWhereWeSetTheModel")
    
    
/*We register the example spawn function, where we reset the model*/
    
RegisterHam(Ham_Spawn"player""PlayerSpawnFunction"1)
}

/*First you have to precache the model with it's exact dirrectory. If it's a player mode, it has to be 
in the "player" folder. You need to remember, that the engine sets the models depending on the folder they are in.
I mean that you can't get two models in one folder.
Now to precache it.*/
public plugin_precache()
{
    
precache_model("models/player/OurModel/OurModel.mdl")
    
/*You see the name and the directory of the model
    Remember, we need the folder's name to set it!*/
}

/*Here is the example function where we set the model*/
public SomeFunctionWhereWeSetTheModel(id)
{
    
/*Important check when setting model*/
    
if(is_user_alive(id))
    {
        
/*The native to set it*/
        
cs_set_user_model(id"OurModel"/*We get the folder's nameee!*/
    
}
}

/*Here is your example spawn function, where we reset the player's model*/
public PlayerSpawnFunction(id)
{
    
/*The check*/
    
if(is_user_alive(id))
    {
        
/*The native to get the original player model*/
        
cs_reset_user_model(id)
    }
}
//That's all 
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 06-21-2014 , 02:06   Re: Set model
Reply With Quote #2

Don't use cs_set_user_model,will cause SVC_BAD when many players are connected.

Last edited by HamletEagle; 06-21-2014 at 02:06.
HamletEagle 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 21:14.


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