it fixed the errors, but i still get a bug while running the plugin on line 197 of my script:
Code:
/*================================================================================================
== amx_modelrank
== Created by
== Meta AKA DarlD on the amxmodx forums.
== Visit:<a href="http://www.metagamez.net" target="_blank" rel="nofollow noopener">www.metagamez.net</a>
==================================================================================================
==ChangeLog:
============
==Version 2: Fixed some bugs, changed the code so that it actualy works...
==Version 1: Beta Release
==================================================================================================
== Description: With UT sounds you get "sound events" for the amount of kills you make in
== a row. Same concept with this plugin, exept you dont get an other model for the amount of kills
== you make in a row. Instead, you get differant models with the amount of Frags and Deaths.
== There are 4 "levels";
== 1. Newb - From 0 to 20 kills & less than 10 deaths
== 2. Killer - From 20 to 40 kills & less than 10 deaths
== 3. Pro - From 40 to 60 kills & less than 20 deaths
== 4. l33t - From 60 kills & less than 30 deaths
==================================================================================================
== TRY TO STAY L33T ONE HOLE GAME OF 40 MINUTES!
==================================================================================================
*/
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
public plugin_init()
{
register_plugin("Model Rank", "2.3", "DarlD")
register_concmd("amx_modelrank","func_onoff",ADMIN_KICK,"amx_modelrank <1|0>")
register_concmd("amx_highscore","HS_onoff",ADMIN_KICK,"- set to 1 to enable the highscore level 5...")
register_clcmd("say /test","HS_onOFFTEST",ADMIN_ALL,"TEST")
register_cvar("highscore_cvar","0")
register_cvar("offon","resetModel")
}
// here we define our on off command
public func_onoff(id, lvl, cid)
{
if(!cmd_access(id, lvl, cid,1))
return PLUGIN_HANDLED
new arg[32]
read_argv(1,arg,31)
if (arg[0] == '1')
{
new pstr[1]
pstr[0] = id
set_task (0.1,"resetModel",_,pstr,1)
}
else if(arg[0] == '0')
{
new pstr[1]
pstr[0] = id
set_task (0.1,"normal",_,pstr,1)
}
return PLUGIN_CONTINUE
}
// here we set the command to enable the optional level 5
public HS_onoff(id, lvl, cid)
{
if(!cmd_access(id, lvl, cid,1))
return PLUGIN_HANDLED
new arg[32]
read_argv(1,arg,31)
if (arg[0] == '1')
{
new pstr[1]
pstr[0] = id
set_cvar_num("highscore_cvar",'1')
set_task (0.1,"HS_on",_,pstr,1)
}
else if (arg[0] == '0')
{
new pstr[1]
pstr[0] = id
set_cvar_num("highscore_cvar",'0')
set_task (0.1,"HS_off",_,pstr,1)
}
return PLUGIN_CONTINUE
}
// here we load the models so that we can use them in the plugin :)
public plugin_precache()
{
precache_model("models/player/leet_t/leet_t.mdl")
precache_model("models/player/leet_ct/leet_ct.mdl")
precache_model("models/player/killer_t/killer_t.mdl")
precache_model("models/player/killer_ct/killer_ct.mdl")
precache_model("models/player/pro_t/pro_t.mdl")
precache_model("models/player/pro_ct/pro_ct.mdl")
precache_model("models/player/newb_t/newb_t.mdl")
precache_model("models/player/newb_ct/newb_ct.mdl")
return PLUGIN_CONTINUE
}
// Creating the first level of our Ranking
public resetModel(pstr[])
{
new id = pstr[0]
new frags = get_user_frags(id)
new death = get_user_deaths(id)
if (frags < 19 && death <= 10 )
{
new CsTeams:userTeam = cs_get_user_team(id)
if (userTeam == CS_TEAM_T)
{
cs_set_user_model(id, "newb_t")
set_task(1.0,"level2")
}
else if(userTeam == CS_TEAM_CT)
{
cs_set_user_model(id, "newb_ct")
set_task(1.0,"level2")
}
}
}
// Level 2 here we come!! from here on its mostly copy & paste....
public level2(id)
{
new frags = get_user_frags(id)
new death = get_user_deaths(id)
if (frags > 19 && death <= 15)
{
new CsTeams:userTeam = cs_get_user_team(id)
if (userTeam == CS_TEAM_T)
{
client_print(id,print_chat,"[MR]: Congrats!! You have reached Level 2!")
cs_set_user_model(id, "killer_t")
set_task(1.0,"level3")
}
else if(userTeam == CS_TEAM_CT)
{
client_print(id,print_chat,"[MR]: Congrats!! You have reached Level 2!")
cs_set_user_model(id, "killer_ct")
set_task(1.0,"level3")
}
}
}
// level 3
public level3(id)
{
new frags = get_user_frags(id)
new death = get_user_deaths(id)
if (frags > 39 && death <= 20)
{
new CsTeams:userTeam = cs_get_user_team(id)
if (userTeam == CS_TEAM_T)
{
client_print(id,print_chat,"[MR]: Congrats!! You have reached Level 3!")
cs_set_user_model(id, "pro_t")
set_task(1.0,"level4")
}
else if(userTeam == CS_TEAM_CT)
{
client_print(id,print_chat,"[MR]: Congrats!! You have reached Level 3!")
cs_set_user_model(id, "pro_ct")
set_task(1.0,"level4")
}
}
}
// level 4
public level4(id)
{
new frags = get_user_frags(id)
new death = get_user_deaths(id)
if (frags > 59 && death <= 30)
{
new thing[64]
get_cvar_string("offon",thing,63)
new CsTeams:userTeam = cs_get_user_team(id)
if (userTeam == CS_TEAM_T)
{
client_print(id,print_chat,"[MR]: Congrats!! You have reached Level 4!")
cs_set_user_model(id, "leet_t")
set_task(1.0, thing)
}
else if(userTeam == CS_TEAM_CT)
{
client_print(id,print_chat,"[MR]: Congrats!! You have reached Level 4!")
cs_set_user_model(id, "leet_ct")
set_task(1.0, thing)
}
}
}
// Level 5
public highscore(id)
{
new frags = get_user_frags(id)
new death = get_user_deaths(id)
if (frags >= 0 && death >= 0 )
{
new CsTeams:userTeam = cs_get_user_team(id)
new speed = get_user_maxspeed(id)
if (userTeam == CS_TEAM_T)
{
client_print(id,print_chat,"[MR]: Congrats!! You have reached serious level!")
set_user_maxspeed(id,speed + 2000)
cs_set_user_model(id, "leet_t")
set_task(1.0,"resetModel")
}
else if(userTeam == CS_TEAM_CT)
{
client_print(id,print_chat,"[MR]: Congrats!! You have reached serious level!")
set_user_maxspeed(id,speed + 2000)
cs_set_user_model(id, "leet_ct")
set_task(1.0,"resetModel")
}
}
}
// here we setup the optional level 5 (on)
public HS_on(id)
{
new ONOFF2 = get_cvar_num("highscore_cvar")
if ( ONOFF2 == '1')
{
set_cvar_string("offon","highscore")
}
return PLUGIN_CONTINUE
}
// same as above exept off
public HS_off(id)
{
new ONOFF3 = get_cvar_num("highscore_cvar")
if ( ONOFF3 == '1')
{
set_cvar_string("offon","resetModel")
}
return PLUGIN_CONTINUE
}
public HS_onOFFTEST(id)
{
set_task(1.0,"highscore")
}