Coord tele
#1

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
Reply
#2

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;
}
Reply
#3

SAme... I teleport to blueberry =/
Reply
#4

removed
Reply
#5

same....
Reply
#6

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);
}
Reply
#7

Try Jefff's command. Your problem is that you aren't using floats:
pawn Код:
new x, y, z;
It should be like:
pawn Код:
new Float:x, Float:y, Float:z;
Reply
#8

I spawn still at blueberry acres, plz help
Reply
#9

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.
Reply
#10

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)