View Full Version : Why my model didn`t change ?
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_cvar("Savior_version", VERSION, FCVAR_SERVER|FCVAR_SPONLY)
register_event("DeathMsg", "death_event", "a")
}
public plugin_precache()
{
if( get_pcvar_num(qigong_enable) == 1 )
{
precache_model("models/player/goku/goku.mdl")
}
}
public death_event()
{
new cts[32], ts[32], ctsnum = 0, tsnum = 0
new iPlayers[32], iNum, id, playername[32];
new origin[3], srco[3];
get_players(iPlayers, iNum);
for (new i = 0; i < iNum; i++)
{
id = iPlayers[i];
if (!is_user_connected(id) || !is_user_alive(id))
continue
g_UsingPower[id] = false;
switch (cs_get_user_team(id))
{
case TEAM_T: ts[tsnum++] = id
case TEAM_CT: cts[ctsnum++] = id
default:
{
return PLUGIN_CONTINUE
}
}
if (tsnum > 1 || ctsnum > 1)
{
return PLUGIN_CONTINUE
}
}
if (ctsnum != 1 || tsnum != 1)
{
return PLUGIN_CONTINUE
}
g_Savior = cts[0]
if( get_pcvar_num(model_enable) == 1 )
{
cs_set_user_model(g_Savior, "goku");
}
client_print(0, print_chat, "model changed");
}
else
{
g_Savior = 0
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
When I was the last CT, and I kill a T, the client_print worked, but my model didn`t change. I want to change my model to goku when I kill someone
Thanks
i Doubt this is right
if( get_pcvar_num(qigong_enable) == 1 )
Because this aint a pcvar
register_cvar("Savior_version", VERSION, FCVAR_SERVER|FCVAR_SPONLY)
and I think
ts[tsnum++] = id
cts[ctsnum++] = id
Does'nt actually add something to tsnum and ctsnum
i Doubt this is right
if( get_pcvar_num(qigong_enable) == 1 )
Because this aint a pcvar
register_cvar("Savior_version", VERSION, FCVAR_SERVER|FCVAR_SPONLY)
Really thanks!!!
RedRobster
06-21-2010, 05:17
And, I think it takes a round before your model will switch. I don't think it switches right away. Atleast my experiences with cs_set_user_model() have led me to believe that.
And, I think it takes a round before your model will switch. I don't think it switches right away. Atleast my experiences with cs_set_user_model() have led me to believe that.
Depends on ur code.
Is it working epic?
RedRobster
06-21-2010, 12:52
Depends on ur code.
Could you give me an example of what would make it change right away?
Is it working epic?
I have tested it, it seems register_cvar("Savior_version", VERSION, FCVAR_SERVER|FCVAR_SPONLY) doesn`t anti a pcvar
And, I think it takes a round before your model will switch. I don't think it switches right away. Atleast my experiences with cs_set_user_model() have led me to believe that.
more code is :
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_cvar("Savior_version", VERSION, FCVAR_SERVER|FCVAR_SPONLY)
register_event("DeathMsg", "death_event", "a")
register_logevent("RoundStart", 2, "1=Round_Start")
register_logevent("RoundEnd", 2, "0=World triggered", "1=Round_End")
}
public plugin_precache()
{
if( get_pcvar_num(qigong_enable) == 1 )
{
precache_model("models/player/goku/goku.mdl")
}
}
public death_event()
{
new cts[32], ts[32], ctsnum = 0, tsnum = 0
new iPlayers[32], iNum, id, playername[32];
new origin[3], srco[3];
get_players(iPlayers, iNum);
for (new i = 0; i < iNum; i++)
{
id = iPlayers[i];
if (!is_user_connected(id) || !is_user_alive(id))
continue
g_UsingPower[id] = false;
switch (cs_get_user_team(id))
{
case TEAM_T: ts[tsnum++] = id
case TEAM_CT: cts[ctsnum++] = id
default:
{
return PLUGIN_CONTINUE
}
}
if (tsnum > 1 || ctsnum > 1)
{
return PLUGIN_CONTINUE
}
}
if (ctsnum != 1 || tsnum != 1)
{
return PLUGIN_CONTINUE
}
g_Savior = cts[0]
if( get_pcvar_num(model_enable) == 1 )
{
cs_set_user_model(g_Savior, "goku");
}
client_print(0, print_chat, "model changed");
}
else
{
g_Savior = 0
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
public RoundStart()
{
if (!g_round)
g_round = true
}
public RoundEnd()
{
g_round = false
if( is_user_connected(g_Savior) && g_Savior != 0 && get_pcvar_num(model_enable) == 1 )
{
cs_reset_user_model(g_Savior)
}
g_Savior = 0
}
qigong_enable doesnt exists as a pcvar?
Kreation
06-22-2010, 09:00
new qigong_enable;
public plugin_init()
{
qigong_enable = register_cvar("Your Cvar", "Your value");
}
win.
qigong_enable doesnt exists as a pcvar?
as well as model_enable
THE WHOLE CODE :)
EDIT: Because someone think I post the whole code here in search of fixing....so, I have to delete it to prove I just need scripting help
Kreation
06-22-2010, 11:04
I doubt anyone will do it for you, you post here to get scripting help, not for someone to fix it for you.
I doubt anyone will do it for you, you post here to get scripting help, not for someone to fix it for you.
You are right,
as you think I want to fix my code, I will delete my .sma file to prove I just want to scripting help.
You win, haha
NO if() statements in plugin_precache!
I doubt anyone will do it for you, you post here to get scripting help, not for someone to fix it for you.
Just because someone posts their full code does not mean they want everything done for them. Sometimes it is necessary to see the whole code becuase some problems can come from other parts of the code. We often ask for the full code and rarely get it so he was helping us out! :)
NO if() statements in plugin_precache!
Just because someone posts their full code does not mean they want everything done for them. Sometimes it is necessary to see the whole code becuase some problems can come from other parts of the code. We often ask for the full code and rarely get it so he was helping us out! :)
Thank you :up:
I will try
vBulletin® v3.8.7, Copyright ©2000-2024, vBulletin Solutions, Inc.