SA-MP Forums Archive
[HELP] Extra Speed - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Extra Speed (/showthread.php?tid=207908)



[HELP] Extra Speed - Larsey123IsMe - 07.01.2011

/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;
}



Re: [HELP] Extra Speed - bhaveshnande - 07.01.2011

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);


Re: [HELP] Extra Speed - Larsey123IsMe - 07.01.2011

Not like that...


Re: [HELP] Extra Speed - veyron - 07.01.2011

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


Re: [HELP] Extra Speed - Voldemort - 07.01.2011

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


Re: [HELP] Extra Speed - veyron - 07.01.2011

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)