SA-MP Forums Archive
Teleporting to wrong vehicle ID? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Teleporting to wrong vehicle ID? (/showthread.php?tid=501367)



Teleporting to wrong vehicle ID? - Dokins - 17.03.2014

This command teleports me to the wrong vehicle ID. I typed vehicleid 9 and it set me to vehicle id 2.

I made this myself, very confused!

pawn Код:
CMD:tptov(playerid, params[])
{
    if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
    new id;
    if(AdminLevel[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You are not authorized to use this command.");
    if(sscanf(params, "d", id)) return SendClientMessage(playerid, COLOUR_GREY, "Usage: /tptov [vehicleid]");
    if(id == INVALID_VEHICLE_ID) return SendClientMessage(playerid, COLOUR_GREY, "That vehicle does not exist.");

    new Float:x, Float: y, Float: z;
    GetVehiclePos(id, x, y, z);

    SetPlayerInterior(playerid, GetVehicleVirtualWorld(id));
    SetPlayerPos(playerid, x, y, z);
    new string[128];
    format(string, sizeof(string), "You have teleported to Vehicle ID: %d", id);
    SendClientMessage(playerid, COLOUR_LIGHTBLUE, string);
    return 1;
}



Re: Teleporting to wrong vehicle ID? - CuervO - 17.03.2014

If your vehicles have custom IDs in most of the cases the ID will not match to the SA:MP ID:

For example, if in your database it haves ID 5, the actual IG ID could be different.


Re: Teleporting to wrong vehicle ID? - Matess - 17.03.2014

You are checking it with /dl? Try printf("%d",id) or change on if(sscanf(params, "i", id))


Re: Teleporting to wrong vehicle ID? - Dokins - 17.03.2014

Yeah, but I'm using the actual vehicle ID to teleport, as in. I make it get vehicle ID 9's position yet it put me at ID 2?


Re: Teleporting to wrong vehicle ID? - VishvaJeet - 18.03.2014

Код:
CMD:tptov(playerid, params[])
{
    new id;
    new Float:x, Float: y, Float: z;
    if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
    if(AdminLevel[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You are not authorized to use this command.");
    if(sscanf(params, "i", id)) return SendClientMessage(playerid, COLOUR_GREY, "Usage: /tptov [vehicleid]");
    if(id == INVALID_VEHICLE_ID) return SendClientMessage(playerid, COLOUR_GREY, "That vehicle does not exist.");

    GetVehiclePos(id, x, y, z);

    SetPlayerVirtualWorld(playerid, GetVehicleVirtualWorld(id));
    SetPlayerPos(playerid, x, y, z);
    new string[128];
    format(string, sizeof(string), "You have teleported to Vehicle ID: %d", id);
    SendClientMessage(playerid, COLOUR_LIGHTBLUE, string);
    return 1;
}