The update_index parameter seems to cause a few issues when used.
Here's a simple test plugin.
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
public plugin_precache()
{
precache_model("models/player/vip/vip.mdl");
}
public plugin_init()
{
register_concmd("amx_model", "cmdModel", ADMIN_ALL, "<name or #userid> [value]");
}
public cmdModel(id, level, cid)
{
if(!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED;
new user[32]; read_argv(1, user, charsmax(user));
new player = cmd_target(id, user, CMDTARGET_ALLOW_SELF);
if(!player)
return PLUGIN_HANDLED;
new value[32]; read_argv(2, value, charsmax(value));
switch(value[0])
{
case '0': cs_set_user_model(player, "vip", false);
case '1': cs_set_user_model(player, "vip", true);
default: cs_reset_user_model(player);
}
client_print(id, print_center, "User: %n || Value: %c", player, value[0]);
return PLUGIN_HANDLED;
}
If you go on cs_assault, use the command amx_model name 0 to set your model without updating the index, use the cameras, then use amx_model name 2 to reset your model, again use the cameras, everything should work fine. Use amx_model name 1, which sets the model and updates the index and use the cameras, the camera origin will either bug out or the server will crash if you try it multiple times.
While we're on the subject of models, I'd also like to request a new native.
PHP Code:
/**
* Returns if a model-lock is set on the client by a previous cs_set_user_model() call.
*
* @param index Client index
*
* @noreturn 1 if a model-lock is set, 0 otherwise
* @error If the client index is not within the range of 1 to
* MaxClients, or the client is not connected, an error will be
* thrown.
*/
native cs_get_user_model_lock(index);