[NEED] if pressed 2, get x10 nitro
#1

I saw in a server when you press 2 you get x10 nitro, how can I do this?
Reply
#2

-OnPlayerKeyStateChange
-KEY_SUBMISSION
-AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);

If you can't figure out how to do it from what i gave you, request it at the script request thread.
Reply
#3

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys == KEY_SUBMISSION)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
        }
    }
    return 1;
}
you also would want IsValidNosVehcile, search for it.
Reply
#4

Код:
new bool: NitroActive[MAX_PLAYERS];

IsPlayerInInvalidNosVehicle(playerid,vehicleid)
{
  #define MAX_INVALID_NOS_VEHICLES 29
  new InvalidNosVehicles[MAX_INVALID_NOS_VEHICLES] =
  {
		581,523,462,521,463,522,461,448,468,586,
		509,481,510,472,473,493,595,484,430,453,
		452,446,454,590,569,537,538,570,449
  };
  vehicleid = GetPlayerVehicleID(playerid);
  if(IsPlayerInVehicle(playerid,vehicleid))
  {
		for(new i = 0; i < MAX_INVALID_NOS_VEHICLES; i++)
		{
	  	if(GetVehicleModel(vehicleid) == InvalidNosVehicles[i])
	  	{
	    	return true;
	  	}
		}
  }
  return false;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{

  	if(newkeys == KEY_SUBMISSION)
	{
		if(IsPlayerInAnyVehicle(playerid))
		{
			if(!IsPlayerInInvalidNosVehicle(playerid, GetPlayerVehicleID(playerid)))
		 	{
		 	  if(NitroActive[playerid] == false)
		 	  {
	  			AddVehicleComponent(GetPlayerVehicleID(playerid),1010);
		  		SendClientMessage(playerid,COLOR_BASIC,"Nitro: On.");
		  		GameTextForPlayer(playerid,"+Nitro!", 1000, 1);
				  PlayerPlaySound(playerid, 1137, 0.0, 0.0, 0.0);
	  			NitroActive[playerid] = true;
				}
			}
			else
			{
		 	  SendClientMessage(playerid, COLOR_RED, "Can't Add Nitro to this Vehicle.");
			}
		}
	} 
}
there it is. works fine thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)