I'm trying to write a plugin so you can say /afk and you join spectators but it keeps your team and model so when you type /back you join the team you were on with the same model. Maybe my mistake is obvious but I can't get the plugin to choose the right team. I also need help with the get model and set model commands. This is the code I have so far.
Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
public plugin_init()
{
register_plugin("AFK and Back","0.1","twistedeuphoria")
register_clcmd("say","say_event")
return PLUGIN_CONTINUE
}
public say_event(id)
{
new sid[2]
new team[32]
new model[32]
sid[0] = id
num_to_str(id,sid,2)
new said[192]
read_args(said,191)
new name[32]
get_user_name(id,name,31)
if(containi(said,"/afk") != -1)
{
if (is_user_alive(id))
{
cs_get_user_model(id,model[id],4)//How do I use this?
team[id] = get_user_team(id)
user_kill(id)
client_print(0,print_chat,"*DEAD* %s : I'll be back...",name)
client_cmd(id,"jointeam 6")
}
}
if(containi(said,"/back") != -1)
{
client_print(0,print_chat,"%s : I'm back....",name)
if(team[id] == 1)
client_cmd(id,"jointeam 1")
else
client_cmd(id,"jointeam 2")
cs_set_user_model(id,model[id])//Need help here too.
}
}
Thank you for your time.