Hello guys,
I have a problem. I am using a plugin that fixing glock bug after spawn.
But Some friends said me that "there are 2 bugs". And I am here to fix this problems with all of you
First bug;
After spawn; "If the user kills before plugin deletes his glock, It falls to ground. Everyone can take it from ground.
Second bug;
After spawn; "If the user drops the glock before plugin deletes his glock. It falls to ground. Everyone can take it from ground. Same things
I want to fix this problems like that "When the user kill, Will remove his glock automatic.
And When the user uses drop, Will not drop

Thanks for helping
PHP Code:
#include <amxmodx>
#include <reapi>
public plugin_init() {
register_plugin("Auto Weapon", "1.0", "PurposeLess")
RegisterHookChain(RG_CBasePlayer_Spawn, "RGC_BasePlayerSpawn", 1)
}
public RGC_BasePlayerSpawn(id)
{
remove_task(id)
remove_task(id+1907)
if(is_user_alive(id))
{
rg_remove_all_items(id)
rg_give_item(id, "weapon_knife")
if(get_member(id, m_iTeam) == TEAM_CT)
{
rg_give_item(id, "weapon_usp")
rg_give_item(id, "weapon_p90")
rg_give_item(id, "weapon_deagle")
rg_give_item(id, "weapon_m4a1")
rg_give_item(id, "weapon_awp")
rg_give_item(id, "weapon_ak47")
rg_set_user_bpammo(id, WEAPON_M4A1, 200)
rg_set_user_bpammo(id, WEAPON_AWP, 200)
rg_set_user_bpammo(id, WEAPON_AK47, 200)
rg_set_user_bpammo(id, WEAPON_USP, 100)
rg_set_user_bpammo(id, WEAPON_P90, 200)
rg_set_user_bpammo(id, WEAPON_DEAGLE, 100)
}
else if(get_member(id, m_iTeam) == TEAM_TERRORIST)
{
if(task_exists(id)) remove_task(id)
if(task_exists(id+1907)) remove_task(id+1907)
set_task(0.1, "glock_control", id + 1907, "", 0, "b")
set_task(1.5, "removetask", id)
engclient_cmd(id, "weapon_knife")
}
}
}
public glock_control(TaskId)
{
new id = TaskId -= 1907
if(is_user_alive(id))
{
if(rg_has_item_by_name(id, "weapon_glock18"))
{
rg_remove_item(id, "weapon_glock18")
if(task_exists(id)) remove_task(id)
if(task_exists(id+1907)) remove_task(id+1907)
}
}
else {
if(task_exists(id)) remove_task(id)
if(task_exists(id+1907)) remove_task(id+1907)
}
}
public removetask(id)
{
if(task_exists(id)) remove_task(id)
if(task_exists(id+1907)) remove_task(id+1907)
}