I am still learning coding, so I built this monstrosity out of a few plugins to make terrorists always respawn and never have any weapons. It works, but the problem is that after a round ends, I get an overflow error. Is there anyone out there willing to help me optimize this plugin? Thank you all in advance.
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <amxmisc>
#include <fun>
#define RESPAWN_DELAY 2.0
#define TEAM_T 1
public plugin_init()
{
register_plugin("CT Respawn", "1.2", "hleV")
register_clcmd("say /respawn", "PlayerCmdRespawn")
RegisterHam(Ham_Killed, "player", "PlayerKilled", 1)
register_event("CurWeapon","knife","b","1=1")
}
public PlayerKilled(id)
{
if(is_user_alive(id))
return HAM_IGNORED
if(get_user_team(id) == TEAM_T)
set_task(RESPAWN_DELAY, "PlayerRespawn", id)
return HAM_IGNORED
}
public PlayerCmdRespawn(id)
{
if(get_user_team(id) == TEAM_T)
set_task(RESPAWN_DELAY, "PlayerRespawn", id)
else
client_print(id, print_chat, "Only Terrorists.")
return PLUGIN_HANDLED
}
public PlayerRespawn(id)
{
if(!is_user_alive(id))
ExecuteHamB(Ham_CS_RoundRespawn, id)
}
public knife(id)
{
if(get_user_team(id) == TEAM_T){
new wpID = read_data(2)
if(wpID != CSW_KNIFE)
{
strip_user_weapons(id)
give_item(id, "weapon_knife")
engclient_cmd(id, "weapon_knife")
}
}
}