Car Hop
#1

Can anyone please make a code for me so my vehicle hops into the sky?
Reply
#2

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/carhop", true) == 0)
    {
      if(IsPlayerInAnyVehicle(playerid))
      {
        new Float:X, Float:Y, Float:Z;
            GetVehicleVelocity(GetPlayerVehicleID(playerid), X,Y,Z);
            SetVehicleVelocity(GetPlayerVehicleID(playerid), X,Y,Z+10);
            return 1;
        }

    }
    else
    {
      SendClientMessage(playerid, 0xFFFFF, "You are not in a vehicle");
        return 1;
    }
    return 0;
}
The scrip hasent been tested. Hope it works
Reply
#3

Thanks I will try it
Reply
#4

Ok, it works, BUT my vehicle stops driving when I use it and then goes into the sky.

Is it possible to make my vehicle continue driving and then jumping?
Reply
#5

pawn Код:
forward CarHop(playerid); // On Top of your script
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/carhop", true) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            SetVehicleVelocity(GetPlayerVehicleID(playerid), 0, 0, 5.0);
            SetTimer("CarHop", 5000, 1);
            return 1;
        }
    }
    else
    {
        SendClientMessage(playerid, 0xFFFFF, "You are not in a vehicle");
        return 1;
    }
    return 0;
}
pawn Код:
public CarHop(playerid) // Put somewhere in your script
{
    SetVehicleVelocity(GetPlayerVehicleID(playerid), 0, 0, 5.0);
    return 1;
}
Script not tested
Reply
#6

Quote:
Originally Posted by <Krys>
pawn Код:
forward CarHop(playerid); // On Top of your script
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/carhop", true) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            SetVehicleVelocity(GetPlayerVehicleID(playerid), 0, 0, 5.0);
            SetTimer("CarHop", 5000, 1);
            return 1;
        }
    }
    else
    {
        SendClientMessage(playerid, 0xFFFFF, "You are not in a vehicle");
        return 1;
    }
    return 0;
}
pawn Код:
public CarHop(playerid) // Put somewhere in your script
{
    SetVehicleVelocity(GetPlayerVehicleID(playerid), 0, 0, 5.0);
    return 1;
}
Script not tested
wtf return 0 allways disables all cmds
Reply
#7

Doesn't work like how I want it
Reply
#8

What do you want it to do exactly, that code should continue you in the direction your going in and hop.
Reply
#9

Well, it doesn't continue the direction. It just stops and hops.
Reply
#10

It continues, but because the hop is so powerful, you can't see it. Try making the z velocity smaller.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)