Coord tele -
Ananisiki - 05.05.2014
pawn Код:
CMD:coordteleport(playerid, params[])
{
new x, y, z;
if(sscanf(params, "iii", x, y, z)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /coordteleport(XPos) (Ypos) (ZPos)");
SetPlayerPos(playerid, x, y, z);
if(IsPlayerInAnyVehicle(playerid))
{
SetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);
}
new string[128];
format(string, sizeof string, "You have been teleported to coordinates %d, %d, %d.", x, y, z);
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
this no work when i type coordteleport 0 0 10 then i move to blueberry and if in vehicle the vehicle move too but i get ejected
Re: Coord tele -
awsomedude - 05.05.2014
Here try this
pawn Код:
CMD:coordteleport(playerid, params[])
{
new x, y, z;
if(sscanf(params, "iii", x, y, z)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /coordteleport(XPos) (Ypos) (ZPos)");
if(IsPlayerInAnyVehicle(playerid)) SetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);
else SetPlayerPos(playerid, x, y, z);
new string[128];
format(string, sizeof string, "You have been teleported to coordinates %d, %d, %d.", x, y, z);
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
Re: Coord tele -
Ananisiki - 05.05.2014
SAme... I teleport to blueberry =/
Re: Coord tele -
awsomedude - 05.05.2014
removed
Re: Coord tele -
Ananisiki - 05.05.2014
same....
Re: Coord tele -
Jefff - 06.05.2014
pawn Код:
CMD:coordteleport(playerid, params[])
{
new Float:Pos[3];
if(sscanf(params, "a<f>[3]", Pos)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /coordteleport (XPos) (Ypos) (ZPos)");
new vID = GetPlayerVehicleID(playerid);
if(vID) SetVehiclePos(vID, Pos[0], Pos[1], Pos[2]);
else SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
new string[128];
format(string, sizeof string, "You have been teleported to coordinates %.4f, %.4f, %.4f.", Pos[0], Pos[1], Pos[2]);
return SendClientMessage(playerid, COLOR_WHITE, string);
}
Re: Coord tele -
SickAttack - 06.05.2014
Try Jefff's command. Your problem is that you aren't using floats:
It should be like:
pawn Код:
new Float:x, Float:y, Float:z;
Re: Coord tele -
Ananisiki - 06.05.2014
I spawn still at blueberry acres, plz help
Re: Coord tele -
Nathan_Taylor - 07.05.2014
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.
Re: Coord tele -
Aerotactics - 07.05.2014
Quote:
Originally Posted by Ananisiki
I spawn still at blueberry acres, plz help
|
These guys are fucking dumbasses.
pawn Код:
CMD:coordteleport(playerid, params[])
{
new x, y, z;
if(sscanf(params, "iii", x, y, z)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /coordteleport(XPos) (Ypos) (ZPos)");
SetPlayerPos(playerid, x, y, z);
if(IsPlayerInAnyVehicle(playerid))
{
new vehicleid = GetPlayerVehicleID(playerid);
SetVehiclePos(vehicleid, x, y, z);
PutPlayerInVehicle(playerid,vehicleid,0);
}
new string[128];
format(string, sizeof string, "You have been teleported to coordinates %d, %d, %d.", x, y, z);
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}