23.03.2013, 06:19
Explained at the comments.
pawn Код:
if (strcmp("/beach", cmdtext, true, 10) == 0)
{
if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER) // The player is a driver of a vehicle!
{
new iVeh = GetPlayerVehicleID(playerid); // Get's the player's current vehicle ID.
SetVehiclePos(iVeh, 309.7616, -1798.7969, 4.4990); // Set's the vehicle's position.
}
else // The player is not a driver of a vehicle!
{
SetPlayerPos(playerid, 309.7616, -1798.7969, 4.4990); // Set's the player's current position
}
// Sends the player a client message
SendClientMessage(playerid, 0x00FF00, "Welcome to Los Santos Beach!");
new name[MAX_PLAYER_NAME], string[128]; // Create 2 new variables.
GetPlayerName(playerid, name, sizeof(name)); // Get's the player's name.
format(string, sizeof(string), "[TP]: %s has teleported to /beach.", name); // Formats the string.
SendClientMessageToAll(0x0000BBAA, string); // Sends a message to all players
return true;
}