[Help] Teleporting
#1

I have these two commands and it has been very useful for the development for our server:

Код:
CMD:tp(playerid, params[])
{
    new targetid;
    new target[MAX_PLAYER_NAME];
    new Float:x, Float:y, Float:z;
    if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "Usage: /tp [id]");
    GetPlayerName(targetid, target, sizeof(target));
    GetPlayerPos(targetid, x, y, z);
    SetPlayerPos(playerid, x, y, z);
    SendClientMessage(targetid, COLOR_WHITE, "An admin has teleported to you.");
    return 1;
}
and

Код:
CMD:bring(playerid, params[])
{
    new targetid;
    new target[MAX_PLAYER_NAME];
    new Float:x, Float:y, Float:z;
    if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "Usage: /bring [id]");
    GetPlayerName(targetid, target, sizeof(target));
    GetPlayerPos(playerid, x, y, z);
    SetPlayerPos(targetid, x, y, z);
    SendClientMessage(targetid, COLOR_WHITE, "You have been teleported to an admin by an admin.");
    return 1;
}
I want them to both still do the same function, but to take your vehicle. And if it takes your vehicle, it should teleport you about 5 inches away. Is this possible?
Reply
#2

Well you'd need the following functions to do that, you should be able to work out how to use them from the wiki pages:
https://sampwiki.blast.hk/wiki/IsPlayerInAnyVehicle
https://sampwiki.blast.hk/wiki/GetPlayerVehicleID
https://sampwiki.blast.hk/wiki/SetVehiclePos

For the offset, you could do something like SetVehiclePos(vehicleid, x, y + 5, z)
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)