superspeed in car
#1

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
Reply
#2

You have to use SetVehicleVelocity
Reply
#3

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

Reply
#4

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?
Reply
#5

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.
Reply
#6

its working now, thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)