Jump Vehicle w/ Image
#1

Im using a normal jump script. And i need to make it kinda advance.

Here are some examples.

When im below an object.


If i press Y to jump. I want to jump my vehicle without hitting in a object.


IS THERE ANY SCRIPT LIKE THIS?
Reply
#2

Urghh this?
pawn Код:
if(newkeys & KEY_YES)
{
      new veh = GetPlayerVehicleID(playerid);
      new Float:x,Float:y,Float:z;
      GetVehiclePos(veh,x,y,z);
      SetVehiclePos(veh,x,y,z+3);
      return 1;
}
Reply
#3

Quote:
Originally Posted by newbienoob
Посмотреть сообщение
Urghh this?
pawn Код:
if(newkeys & KEY_YES)
{
      new veh = GetPlayerVehicleID(playerid);
      new Float:x,Float:y,Float:z;
      GetVehiclePos(veh,x,y,z);
      SetVehiclePos(veh,x,y,z+3);
      return 1;
}
Man can you add that to this?

Quote:

if (newkeys & KEY_HORN)
{
if(IsPlayerInAnyVehicle(playerid))
{
new VehicleID,Float:B;
VehicleID = GetPlayerVehicleID(playerid);
GetVehicleZAngle(VehicleID,B);
SetVehicleZAngle(VehicleID,B);
SetVehicleVelocity(VehicleID, 0.0, 0.0, 0.2);
SetVehicleAngularVelocity(VehicleID,0,0,0);
}
}

I think its more better if i use that in flip.
Reply
#4

pawn Код:
if (newkeys & KEY_HORN)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        new VehicleID,Float:B;
        VehicleID = GetPlayerVehicleID(playerid);
        GetVehicleZAngle(VehicleID,B);
        SetVehicleZAngle(VehicleID,B);
        SetVehicleVelocity(VehicleID, 0.0, 0.0, 0.2);
        SetVehicleAngularVelocity(VehicleID,0,0,0);
    }
    return 1;
}
if(newkeys & KEY_YES)
{
      new veh = GetPlayerVehicleID(playerid);
      new Float:x,Float:y,Float:z;
      GetVehiclePos(veh,x,y,z);
      SetVehiclePos(veh,x,y,z+3);
      return 1;
}
Reply
#5

Quote:
Originally Posted by newbienoob
Посмотреть сообщение
pawn Код:
if (newkeys & KEY_HORN)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        new VehicleID,Float:B;
        VehicleID = GetPlayerVehicleID(playerid);
        GetVehicleZAngle(VehicleID,B);
        SetVehicleZAngle(VehicleID,B);
        SetVehicleVelocity(VehicleID, 0.0, 0.0, 0.2);
        SetVehicleAngularVelocity(VehicleID,0,0,0);
    }
    return 1;
}
if(newkeys & KEY_YES)
{
      new veh = GetPlayerVehicleID(playerid);
      new Float:x,Float:y,Float:z;
      GetVehiclePos(veh,x,y,z);
      SetVehiclePos(veh,x,y,z+3);
      return 1;
}
OMG! Finally. thanks man! +Rep You know this is a good script for stunt mode. sometimes if they fall out of boundary they just jump and boom! on the ground baby
Reply
#6

It is NOT jumping. It is setting your position. Please choose a more appropriate title next time.
Reply
#7

I don't see how any of the code posted will help you avoid hitting objects.

You would need to loop through all objects that are close to the player, and make sure none of them are at jumping height. If they are don't allow the jump. This would be difficult because most objects are different sizes.

In fact i think the code above could spawn you inside some objects. I'd rather bounce off an object than risk getting stuck in one.

pawn Код:
if(IsPlayerInAnyVehicle(playerid))
    {
        new VehicleID,Float:B;
        VehicleID = GetPlayerVehicleID(playerid);
        GetVehicleZAngle(VehicleID,B);
        SetVehicleZAngle(VehicleID,B);
        SetVehicleVelocity(VehicleID, 0.0, 0.0, 0.2);
        SetVehicleAngularVelocity(VehicleID,0,0,0);
    }
^^ I don't think that will work as expected, that will stop the vehicle from moving in every direction except z by 0.2. IMO car jumps should keep the car traveling. Also something pointless in the above code is getting the angle and setting it to the same value

Better version:

pawn Код:
new VehicleID = GetPlayerVehicleID(playerid);
if(VehicleID)
{
    new Float:fVelocity[3];
    GetVehicleVelocity(VehicleID, fVelocity[0], fVelocity[1], fVelocity[2]);
    SetVehicleVelocity(VehicleID, fVelocity[0], fVelocity[1], fVelocity[2]+0.2);
}
EDIT: Something else i just thought of; you should add anti-abuse for car jumping, if you spam the jump button it will appear as if your flying.
Reply
#8

Quote:
Originally Posted by iggy1
Посмотреть сообщение
I don't see how any of the code posted will help you avoid hitting objects.

You would need to loop through all objects that are close to the player, and make sure none of them are at jumping height. If they are don't allow the jump. This would be difficult because most objects are different sizes.

In fact i think the code above could spawn you inside some objects. I'd rather bounce off an object than risk getting stuck in one.

pawn Код:
if(IsPlayerInAnyVehicle(playerid))
    {
        new VehicleID,Float:B;
        VehicleID = GetPlayerVehicleID(playerid);
        GetVehicleZAngle(VehicleID,B);
        SetVehicleZAngle(VehicleID,B);
        SetVehicleVelocity(VehicleID, 0.0, 0.0, 0.2);
        SetVehicleAngularVelocity(VehicleID,0,0,0);
    }
^^ I don't think that will work as expected, that will stop the vehicle from moving in every direction except z by 0.2. IMO car jumps should keep the car traveling. Also something pointless in the above code is getting the angle and setting it to the same value

Better version:

pawn Код:
new VehicleID = GetPlayerVehicleID(playerid);
if(VehicleID)
{
    new Float:fVelocity[3];
    GetVehicleVelocity(VehicleID, fVelocity[0], fVelocity[1], fVelocity[2]);
    SetVehicleVelocity(VehicleID, fVelocity[0], fVelocity[1], fVelocity[2]+0.2);
}
EDIT: Something else i just thought of; you should add anti-abuse for car jumping, if you spam the jump button it will appear as if your flying.
Thanks help me alot!! It's fine its freeroam stunts and everything
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)