SA-MP Forums Archive
superspeed in car - 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)
+--- Thread: superspeed in car (/showthread.php?tid=656329)



superspeed in car - Jaua10 - 13.07.2018

I im trying to make a cmd, when i im driving i want to push left click and gives me super speed by each clickn, i got this:

PHP код:
CMD:superspeed(playeridparams[]) 
    {
        if(
IsPlayerConnected(playerid))
        {
            if (
PlayerInfo[playerid][pAdmin] >= 5)
            {
                if(
IsPlayerInAnyVehicle(playerid))
                {
                    if (
speed[playerid] == 0)
                    {
                        
SendClientMessage(playeridCOLOR_SUCCESS"Super Speed has been Enabled !");
                        
speed[playerid] = 1;
                        }
                        else if (
speed[playerid] == 1)
                        {
                        
speed[playerid] = 0;
                        
SendClientMessage(playeridCOLOR_FAILED"Super Speed has been Disabled !");
                    }
                }
                else
                {
                    
SendClientMessage(playeridCOLOR_CORRECTION"You are not in a car !");
                }
            }
            else
            {
                
SendClientMessage(playeridCOLOR_CORRECTION"You are not authorized to use this command !");
            }
        }
        return 
1;
    } 
i dont know why is not working if i dont have any error


Re: superspeed in car - coool - 13.07.2018

You have to use SetVehicleVelocity


Re: superspeed in car - Florin48 - 13.07.2018

you need this in OnPlayerKeyStateChange, or something, I think there are more ways to make a speed boost.
PHP код:
if(newkeys KEY_FIRE)
        {
if(
speed[playerid] == 1)
            {
                new 
Float:v[3];
                if(
GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
                {
                    
GetVehicleVelocity(GetPlayerVehicleID(playerid), v[0],v[1],v[2]);
                    
SetVehicleVelocity(GetPlayerVehicleID(playerid), v[0]*1.8,v[1]*1.8,v[2]*1.8 );
                }
            }




Re: superspeed in car - Lokii - 13.07.2018

Quote:
Originally Posted by Florin48
Посмотреть сообщение
you need this in OnPlayerKeyStateChange, or something, I think there are more ways to make a speed boost.

if(speed[playerid] == 1)
{
new Float:v[3];
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
GetVehicleVelocity(GetPlayerVehicleID(playerid), v[0],v[1],v[2]);
SetVehicleVelocity(GetPlayerVehicleID(playerid), v[0]*1.8,v[1]*1.8,v[2]*1.8 );
}
}
Why use cells tho?


Re: superspeed in car - Florin48 - 13.07.2018

Quote:
Originally Posted by Lokii
Посмотреть сообщение
Why use cells tho?
because that's what I wanted, I see it works well and left it like this, anyway it's just used by admins.


Re: superspeed in car - Jaua10 - 13.07.2018

its working now, thanks