// This is where the plugin is initialized
public plugin_init()
{
// Create a custom entity.
// Not sure what's the exact classname for the said
// spawn point entity, so I used "spawn_point".
new ent = create_entity("spawn_point");
// Set its coordinates.
// Can be any values, like 99999.9, 99999.9, 99999.9.
entity_set_origin(ent, Float:{13561.0, 64262.0, 4362346.0});
// Now we set the coordinates of where the entity
// teleports the player to.
entity_set_vector(ent, EV_VEC_vuser1, Float:{53252.0, 252523.0, 12312.0});
// Alter the entity's classname.
// This should get rid of its initial function to work
// as a spawn point for players. If not, some additional
// actions should be made to identify this entity as not
// a spawn point.
entity_set_string(ent, EV_SZ_classname, "my_teleport");
// There are other properties that need to be set, like entity's model
// (invisible), size, if it's solid or not, etc. But I don't find it necessary
// to do this here since it's only an example.
// Now we hook the event when
// "player" entity touches "my_teleport" entity.
register_touch("my_teleport", "player", "OnPlayerTouchTeleport");
}
// This is called when player touches teleporter
public OnPlayerTouchTeleport(ent, client)
{
// All what's left is to teleport the player to
// the desired coordinates.
new Float:origin[3];
entity_get_vector(ent, EV_VEC_vuser1, origin);
entity_set_origin(client, origin);
}