[HELP] Extra Speed
#1

/speed = He goes 0.3 faster then normal speed
/normal = Turn the super speed of...

But the porblem is that he goes 3.0 just to north and he go 3.0 just one time when i type "/speed"

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/speed", cmdtext, true, 10) == 0)
    {
        new Float:x, Float:y, Float:z;
        GetVehicleVelocity(GetPlayerVehicleID(playerid), x, y, z);
        SetVehicleVelocity(GetPlayerVehicleID(playerid) ,x ,y+0.3 ,z);
        return 1;
    }
   
    if (strcmp("/normal", cmdtext, true, 10) == 0)
    {
        new Float:x, Float:y, Float:z;
        GetVehicleVelocity(GetPlayerVehicleID(playerid), x, y, z);
        SetVehicleVelocity(GetPlayerVehicleID(playerid) ,x ,y ,z);
        return 1;
    }
    return 0;
}
Reply
#2

In your
Код:
if (strcmp("/speed", cmdtext, true, 10) == 0)
    {
        new Float:x, Float:y, Float:z;
        GetVehicleVelocity(GetPlayerVehicleID(playerid), x, y, z);
        SetVehicleVelocity(GetPlayerVehicleID(playerid) ,x ,y+0.3 ,z);
        return 1;
    }
I guess it should be
SetVehicleVelocity(GetPlayerVehicleID(playerid) ,x=0.3 ,y+0.3 ,z+0.3);
Reply
#3

Not like that...
Reply
#4

you need to use sin and cos
pawn Код:
new Float:a,Float:x,Float:y,Float:z;
GetVehicleZAngle(GetPlayerVehicleID(playerid),a);
GetVehicleVelocity(GetPlayerVehicleID(playerid),x,y,z);
SetVehicleVelocity(GetPlayerVehicleID(i),x + (0.3 * floatsin(-a, degrees)),y + (0.3 * floatcos(-a, degrees)),z);
replace 3 if you want it to be slower/faster
e: repaired the code
Reply
#5

You cant boost speed, unless set timer with repeating to its each 25ms sets your speed

Like its gets your speed at /speed cmd and each 25ms sets that speed + your 0.3, but you need to use
SetVehicleVelocity(GetPlayerVehicleID(playerid) ,x*0.3 ,y*0.3 ,z*0.3);

Because car never can go in one direction its goes X,Y,Z at same time
Reply
#6

you're wrong, thats why sin and cos is needed
your code only makes car jump up and move diagonally
repaired the code i posted (angle had to be negative and float)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)