First of all, you don't have to use return value in every function because the compiler add return 0 at the end of it.
Personal, i use it after i use return PLUGIN_HANDLED and you are using an old compiler. I recommend you version 1.9
This is how your plugin should look to don't be so hardcoded [NOT TESTED]
PHP Code:
#include <amxmodx>
#include <zombieplague>
#include <cstrike>
#include <hamsandwich>
new const g_szHuman[][] = //using this method is more easy to precache models and you can use loops to check if user has a specific flag
{
"fondator_ct",
"owner_ct",
"co-owner_ct",
"head-admin_ct" //and so on
}
new const g_szZombie[][] =
{
"zombie_source",
"another_skin",
"another_skin2",
"another_skin3"
}
new const g_szAcces[][] =
{
"abcdefghjklmnoprsitu", //fondator
"abcdefghijklmnopqrsux", //owner
"abcdefijmnopqrsuv", //co-owner
"abcdefijmnopqy" //head-admin
}
public plugin_init() {
register_plugin("XVSkins †", "5.0", "oTm4n3")
register_logevent("round_start", 2, "1=Round_Start") // you have to reset players models
return PLUGIN_CONTINUE
}
public plugin_precache() {
//create 2 strings
new szHuman[64];
new szZombie[64];
for(new i = 0; i < sizeof(g_szHuman); i++) // if you don't know what loops are -> https://wiki.alliedmods.net/Pawn_tutorial#For_Loops
{
formatex(szHuman, charsmax(szHuman), "models/player/%s/%s.mdl", g_szHuman[i]); // format the string with model location to precache it
precache_model(szHuman); // use the string to precache the model
formatex(szZombie, charsmax(szZombie), "models/player/%s/%s.mdl", g_szZombie[i]); // doing same thing as above for zombies model
precache_model(szZombie);
}
}
public round_start(id)
{
if(is_user_alive(id))
cs_reset_user_model(id);
}
public zp_user_infected_post(id) // this is a predefinited function from zombieplague library
{
if(!is_user_alive(id)) // you must check if the player is alive first of all (every time in situations like this)
return PLUGIN_HANDLED;
for(new i = 0; i < sizeof(g_szAcces); i++ )
{
if(get_user_flags(id) & read_flags(g_szAcces[i])) // check if the player has the flag
{
switch(zp_get_user_zombie(id)) // i didn t find anything about this native, but let's say it will return 1 if player is zombie and 0 if human
{
case 1: cs_set_user_model(id, g_szZombie[i]); // set zombie model if he's zombie
case 0: cs_set_user_model(id, g_szHuman[i]); // set human model if he's human
default: cs_reset_user_model(id);
}
}
else
{
cs_reset_user_model(id); // reset user model if he s not an admin (this can overlap with other plugin that are doing same thing)
}
}
return PLUGIN_CONTINUE;
}
I recommend you to use this api to set players model:
https://forums.alliedmods.net/showthread.php?t=161255
Also, if you model have a T model (model_nameT.mdl) you can do something like this:
https://forums.alliedmods.net/showpo...78&postcount=6
i hope i helped you