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
__________________