I have a problem with my plugin. When i launched my server it gave me this:
Code:
[CSTRIKE] Player out of range (0)
[AMXX] Run time error 10 (plugin "slayer.amxx") (native "cs_get_user_team")
Here's the code:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#define PLUGIN "Team Slayer"
#define VERSION "1.0"
#define AUTHOR "Sh!nE*"
new slayed_t, slayed_ct, slayed_all
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_concmd("amx_slayer", "slay_cmd", ADMIN_SLAY, " <@CT @T @ALL>")
set_task(1.0, "check_slay")
}
public slay_cmd(id, level, cid)
{
if (!cmd_access(id, level, cid, 3))
return PLUGIN_HANDLED
new Arg1[5]
read_argv(1, Arg1, 4)
if (Arg1[0] == '@')
{
new Team = 0
if (equali(Arg1[1], "CT"))
{
Team = 2
}
else if (equali(Arg1[1], "T"))
{
Team = 1
}
else if (equali(Arg1[1], "ALL"))
{
Team = 3
new players[32], num
get_players(players, num)
new i
for (i=0; i<num; i++)
{
if (Team == 1)
{
slayed_t = 1
}
else if(Team == 2)
{
slayed_ct = 1
}
else if(Team == 3)
{
slayed_all = 1
}
}
}
}
return PLUGIN_HANDLED
}
public check_slay(id)
{
new CsTeams:team = cs_get_user_team(id)
if(slayed_t == 1)
{
if(team == CS_TEAM_T)
{
user_slap(id, 9999, 0)
slayed_t = 0
return PLUGIN_CONTINUE
}
}
if(slayed_ct == 1)
{
if(team == CS_TEAM_CT)
{
user_slap(id, 9999, 0)
slayed_ct = 0
return PLUGIN_CONTINUE
}
}
if(slayed_all == 1)
{
user_slap(id, 9999, 0)
slayed_all = 0
return PLUGIN_CONTINUE
}
set_task(1.0, "check_slay")
return PLUGIN_CONTINUE
}
Please help me, i'm new to scripting. This is one of my first plugins.
I think i messed up with set_task
Sorry for my bad english.