I'm trying to make a function which will teleport the player to a random spawn location.
PHP Code:
public teleport_to_spawn(id)
{
new Float:origin[3], entity
entity = find_ent_by_class(random_num(-1, 10), get_user_team(id) == 1 ? "info_player_deathmatch" : "info_player_start")
entity_get_vector(entity, EV_VEC_origin, origin)
set_user_origin(id, origin)
}
This doesn't work. It teleports the player outside the map.