All pastes #424315 Raw Edit

Stuff

public text v1 · immutable
·published 2007-04-04 18:25 UTC
rendered paste body
PUT THIS ON TOP OF YOUR CODE:

enum TELEPORT_LOCATIONS
{
	short_name[MAX_STRING],
	long_name[MAX_STRING],
	Float:float_x,
	Float:float_y,
	Float:float_z,
	Float:z_angle,
	interior_id,
	bool:allow_vehicles,
	bool:announce
}

new teleport_location[][TELEPORT_LOCATIONS] = {
	{"carlot", "The Carlot Drift Race", 2326.8938, 1393.4534, 42.5247, 0.0000, 0, true, true},
};


PUT THIS IN ONPLAYERCOMMANDTEXT:
	for (new locationid = 0; locationid < sizeof(teleport_location); locationid++)
	{
	    new command[MAX_STRING];

		format(command, sizeof(command), "/%s", teleport_location[locationid]);

	    if (strcmp(cmdtext, command, true) == 0)
	    {
	    	if (player_info[playerid][authed] == true && IsPlayerSpawned(playerid))
			{
		        if (GetPlayerState(playerid) == 2 && teleport_location[locationid][allow_vehicles] == true)
		        {
		            SetVehiclePos(GetPlayerVehicleID(playerid), teleport_location[locationid][float_x], teleport_location[locationid][float_y], teleport_location[locationid][float_z]);
                    SetVehicleZAngle(GetPlayerVehicleID(playerid), teleport_location[locationid][z_angle]);
				}
				else if (GetPlayerState(playerid) == 3 && teleport_location[locationid][allow_vehicles] == true)
				{
				    SendClientMessage(playerid, COLOR_WHITE, "Server: You can't teleport vehicle as passenger!");
				    
				    return 1;
				}
		        else
		        {
		        	SetPlayerPos(playerid, teleport_location[locationid][float_x], teleport_location[locationid][float_y], teleport_location[locationid][float_z]);
					SetPlayerFacingAngle(playerid, teleport_location[locationid][z_angle]);
				}

				SetCameraBehindPlayer(playerid);
				SetPlayerInterior(playerid, teleport_location[locationid][interior_id]);

				if (teleport_location[locationid][announce] == true)
				{
				    new announce_msg[MAX_STRING];

					format(announce_msg, sizeof(announce_msg), "%s has entered %s, type /%s to join!", player_info[playerid][nickname], teleport_location[locationid][long_name], teleport_location[locationid][short_name]);

				    SendClientMessageToAll(COLOR_YELLOW, announce_msg);
				}
			}

			return 1;
		}
	}