I want to check if the player is on the team zombiemodel, and if so, switch the player to team humanmodel. TeamInfo is the event, in The Specialists, that gets called when a client switches teams.
I am trying to send the message TeamInfo to the client so that the client's team is switched back to the team humanmodel. The client_print message is sent, so I'm assuming I set everything up correctly, besides the sending of the message.
I know there are a bunch of threads on this, and I've looked at many of them, but I just couldn't find an answer for this. The documentation didn't help either.
Here's two versions attempting to achieve the same result:
This version does nothing as far as I can tell:
Code:
register_event("TeamInfo", "zombie_teams", "b")
public zombies_teams(id)
{
new arg1 = read_data(1)
new teamname[32]
read_data(2, teamname, 31)
//get_user_info(id, "model", teamname, 31)
if(!is_user_bot(id) && equali(teamname, zombiemodel))
{
message_begin(MSG_ONE, get_user_msgid("TeamInfo"), {0,0,0}, id)
write_byte(arg1)
write_string(humanmodel)
message_end()
client_print(id, print_chat, "You are a human!")
}
return PLUGIN_CONTINUE
}
This version at least sends the print_chat message "You are a human!":
Code:
public client_infochanged(id)
{
new teamname[32]
get_user_info(id, "model", teamname, 31)
if(!is_user_bot(id) && equali(teamname, zombiemodel))
{
message_begin(MSG_ONE, get_user_msgid("TeamInfo"), {0,0,0}, id)
write_byte(arg1)
write_string(humanmodel)
message_end()
client_print(id, print_chat, "You are a human!")
}
return PLUGIN_CONTINUE
}