Quote:
Originally Posted by Ananisiki
I spawn still at blueberry acres, plz help
|
pawn Код:
CMD:telcoor(playerid, params[]){
new
Float: x,
Float: y,
Float: z;
if(sscanf(params, "fff", x, y, z)) return SendClientMessage(playerid, -1, "USAGE: /telcoor [X] [Y] [Z]");
if(IsPlayerInAnyVehicle(playerid)){
new vID = GetPlayerVehicleID(playerid);
SetVehiclePos(vID, x, y, z);
} else {
SetPlayerPos(playerid, x, y, z);
}
new string[256];
format(string, sizeof(string), "Teleported to: %f, %f, %f", x, y, z);
SendClientMessage(playerid, -1, string);
return 1;
}
Just tested it, working...
Also, to fix your code...
pawn Код:
CMD:coordteleport(playerid, params[])
{
new Float: x, Float: y, Float: z; //---Changed to floats
if(sscanf(params, "fff", x, y, z)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /coordteleport(XPos) (Ypos) (ZPos)"); // Changed iii to fff
if(IsPlayerInAnyVehicle(playerid))
{
SetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);
} else { //------------------------------------------------------------Now you wont be booted from the car
SetPlayerPos(playerid, x, y, z);
}
new string[128];
format(string, sizeof string, "You have been teleported to coordinates %f, %f, %f.", x, y, z);
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
You were getting booted from the car because you were teleporting yourself, then teleporting the car.