SetVehPos?
#1

Im trying to make a command where you do /up and it brings the player up 50 feet (or what ever its measured in) but when i try to do SetVehPos(vehid,X, Y , Z+50) it crashes my pawn. Here is the script working. But if ur in a car it just brings you up 50 feet without car.
pawn Код:
iif (strcmp("/up", cmdtext, true, 8 ) == 0)
{
        new Float:X, Float:Y, Float:Z;
        new vehicleid = GetPlayerVehicleID(playerid);
        GetPlayerPos(playerid, X, Y, Z);
        SetPlayerPos(playerid,X, Y, Z+50);
        SetVehiclePos(vehicleid, X, Y, Z+50);
        return 1;
  }
        return 1;
  }
Reply
#2

https://sampwiki.blast.hk/wiki/SetVehiclePos
Reply
#3

Quote:
Originally Posted by Jakku
Посмотреть сообщение
It still teleports the player without car
Reply
#4

pawn Код:
if (strcmp("/up", cmdtext, true, 8 ) == 0)
{
        new Float:X, Float:Y, Float:Z;
        new vehicleid = GetPlayerVehicleID(playerid);
        GetPlayerPos(playerid, X, Y, Z);
        if(IsPlayerInAnyVehicle(playerid)) {
            SetVehiclePos(vehicleid, X, Y, Z+50);
        }
        else {
            SetPlayerPos(playerid,X, Y, Z+50);
        }
        return 1;
}
Try that.
Reply
#5

pawn Код:
if (strcmp("/up", cmdtext, true, 8 ) == 0)
{
    new Float:X, Float:Y, Float:Z;
    new vehicleid = GetPlayerVehicleID(playerid);
    GetPlayerPos(playerid, X, Y, Z);
    if(vehicleid == 0)
    {
        SetPlayerPos(playerid, X, Y, Z+50.0);
    }
    else
    {
        GetVehiclePos(vehicleid, X, Y, Z);
        SetVehiclePos(vehicleid,X, Y, Z+50);
        PutPlayerInVehicle(playerid,vehicleid,0);
    }
    return 1;
}
Reply
#6

thanks Tee
Reply
#7

No Problem.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)