#include <a_samp>
#define COLOR 0xEE66EEFF
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext,"/teleport",true))
{
if(IsPlayerInAnyVehicle(playerid))
{
SetVehiclePos(GetPlayerVehicleID(playerid),0.0,0.0,200.0);
SendClientMessage(playerid, COLOR, "Teleportation Successful");
}
else
{
SetPlayerPos(playerid,653.954895,-1223.468139,17.173387); // teleports the player
SendClientMessage(playerid, COLOR, "Teleportation Successful");
}
}
if(!strcmp(cmdtext, "/drift1",true))
{
if(IsPlayerInAnyVehicle(playerid))
{
SetVehiclePos(GetPlayerVehicleID(playerid),0,0,200); //EDIT IT!
SendClientMessage(playerid, COLOR, "Teleportation succesful");
}
else
{
SetPlayerPos(playerid,0,0,200); //EDIT IT!
SendClientMessage(playerid, COLOR, "Teleportation succesful");
}
}
return 0;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext,"/teleport",true)==0) { // /center is what the player enter into the text field
if(IsPlayerInVehicle(playerid,GetPlayerVehicleID(playerid))) { //Checks if player is inside a vehicle
SetVehiclePos(GetPlayerVehicleID(playerid),0.0,0.0,200.0); // Teleports the vehicle
SendClientMessage(playerid, 0xEE66EEFF, "Teleportation Successful");
} else {
SetPlayerPos(playerid,653.954895,-1223.468139,17.173387); // teleports the player
SendClientMessage(playerid, 0xEE66EEFF, "Teleportation Successful");
}
return 1;
}
if (strcmp(cmdtext,"/teleport",true)==0) { // /center is what the player enter into the text field
if(IsPlayerInVehicle(playerid,GetPlayerVehicleID(playerid))) { //Checks if player is inside a vehicle
SetVehiclePos(GetPlayerVehicleID(playerid),0.0,0.0,200.0); // Teleports the vehicle
SendClientMessage(playerid, 0xEE66EEFF, "Teleportation Successful");
} else {
SetPlayerPos(playerid,653.954895,-1223.468139,17.173387); // teleports the player
SendClientMessage(playerid, 0xEE66EEFF, "Teleportation Successful");
}
return 1;
}
return 0;
}
Originally Posted by Kwarde
Yeah but mine one is clearer. xD
|
stock TeleportPlayer(playerid,Float:x,Float:y,Float:z,text[]="You have been teleported",color=0xFFFFFFFF)
{
If(IsPlayerInAnyVehicle(playerid))SetVehiclePosition(GetPlayerVehicleID(playerid),x,y,z));
else SetPlayerPos(playerid,x,y,z);
return SendClientMessage(playerid,color,text);
}
public OnPlayerCommandText(playerid,cmdtext[])
{
if(!strcmp(cmdtext[1],"drift1",true))return TeleportPlayer(playerid,0.0,0.0,0.0,"You've been teleported the drift area 1",0xFFAAFFFF);
if(!strcmp(cmdtext[1],"drift2",true))return TeleportPlayer(playerid,0.0,0.0,0.0,"You've been teleported the drift area 2",0xAAFFAAFF);
return 0;
}