Nitro-REALESED
#1

Hi guyz.I tried to make when i press the KEY_FIRE to start the nitro and when i realese the KEY_FIRE the nitro ends.How to do that ?
Reply
#2

Can you show what you tried?
Reply
#3

Код:
if(PRESSED(KEY_FIRE))
	{
       if(IsPlayerInAnyVehicle(playerid))
	   {
	      AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
  	   }
	}
	else if(RELEASED(KEY_FIRE))
    {
	   if(IsPlayerInAnyVehicle(playerid))
	   {
	      RemoveVehicleComponent(0,1010);
  	   }
	}
Reply
#4

pawn Код:
if(PRESSED(KEY_FIRE))
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
        }
        else if(RELEASED(KEY_FIRE))
        {
            if(IsPlayerInAnyVehicle(playerid))
            {
                RemoveVehicleComponent(0,1010);
            }
        }
    }
Reply
#5

It isnt working
Reply
#6

Someone ?
Reply
#7

Код:
if(PRESSED(KEY_FIRE))
{
	if(IsPlayerInAnyVehicle(playerid))
	{
		AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
	}
}
else if(RELEASED(KEY_FIRE))
{
	if(IsPlayerInAnyVehicle(playerid))
	{
		RemoveVehicleComponent(0,1010);
	}
}
Is RemoveVehicleComponent is right?

I see in samp wiki and this RemoveVehicleComponent(1,1010); // 1 is vehicleid
Reply
#8

Here you are

PHP код:
#define HOLDING(%0) \
    
((newkeys & (%0)) == (%0))
    
#define RELEASED(%0) \
    
(((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
    
public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if(
HOLDING(KEY_FIRE))
    {
        if(
IsPlayerInAnyVehicle(playerid))
        {
            
AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
        }
    }
    else if(
RELEASED(KEY_FIRE))
    {
        if(
IsPlayerInAnyVehicle(playerid))
        {
            
RemoveVehicleComponent(GetPlayerVehicleID(playerid), 1010);
        }
    }
    return 
1;

Reply
#9

Thanks Alexis ! : )
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)