SA-MP Forums Archive
Add nitro? - 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: Add nitro? (/showthread.php?tid=331653)



Add nitro? - Gooday - 05.04.2012

How to add nitro in ALL the cars:

This doesnt work:

pawn Код:
CMD:nitro(playerid, params[])
{
   if(GetPlayerSkin(playerid) == 59 || GetPlayerSkin(playerid) == 285 || GetPlayerSkin(playerid) == 282 || GetPlayerSkin(playerid) == 281 || GetPlayerSkin(playerid) == 283 || GetPlayerSkin(playerid) == 288)
    {
   if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "(INFO) You are not in a vehicle!");
   new vehicleid = GetPlayerVehicleID(playerid);
   AddVehicleComponent(154, 1010); // x10 nitro
   SendClientMessage(playerid, COLOR_GOLD, "(INFO) Your vehicle has been equipped with a nitro!");
   }
   else return SendClientMessage(playerid, COLOR_RED, "(INFO) You are not a BCSD Officer!");
   return (1);
}



Re: Add nitro? - Jonny5 - 05.04.2012

change this
pawn Код:
new vehicleid = GetPlayerVehicleID(playerid);
   AddVehicleComponent(154, 1010); // x10 nitro
to this
pawn Код:
new vehicleid = GetPlayerVehicleID(playerid);
   AddVehicleComponent(vehicleid , 1010); // x10 nitro
you where only adding it to veh 154

as a side note you may want to make sure a vehicle can use nitro and also see if it
already has it.

regards,


Re: Add nitro? - .FuneraL. - 05.04.2012

Top of Script :

pawn Код:
new TuneCar[MAX_PLAYERS];
Command :

pawn Код:
CMD:nitro(playerid, params[])
{
   if(GetPlayerSkin(playerid) == 59 || GetPlayerSkin(playerid) == 285 || GetPlayerSkin(playerid) == 282 || GetPlayerSkin(playerid) == 281 || GetPlayerSkin(playerid) == 283 || GetPlayerSkin(playerid) == 288)
    {
   if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "(INFO) You are not in a vehicle!");
   TuneCar[playerid] = GetPlayerVehicleID(playerid);
   AddVehicleComponent(TuneCar[playerid], 1010); // x10 nitro
   SendClientMessage(playerid, COLOR_GOLD, "(INFO) Your vehicle has been equipped with a nitro!");
   }
   else return SendClientMessage(playerid, COLOR_RED, "(INFO) You are not a BCSD Officer!");
   return (1);
}
Try This.


Re: Add nitro? - Wickeed - 05.04.2012

Try this:
pawn Код:
CMD:nitro(playerid, params[])
{
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xFF0000AA,"You are not in a vehicle!");
    if(GetVehicleComponentInSlot(GetPlayerVehicleID(playerid),GetVehicleComponentType(1010)) != 1010) // Check if the vehicle has no nitro
    {
        AddVehicleComponent(GetPlayerVehicleID(playerid),1010);
        PlayerPlaySound(playerid,1133,0.0,0.0,0.0);
    }
    return 1;
}
This working for me


Re: Add nitro? - Jonny5 - 05.04.2012

why does he need an array for this?
its just a waste!!!!


Re: Add nitro? - Bogdan1992 - 05.04.2012

Quote:
Originally Posted by Jonny5
Посмотреть сообщение
change this
pawn Код:
new vehicleid = GetPlayerVehicleID(playerid);
   AddVehicleComponent(154, 1010); // x10 nitro
to this
pawn Код:
new vehicleid = GetPlayerVehicleID(playerid);
   AddVehicleComponent(vehicleid , 1010); // x10 nitro
you where only adding it to veh 154

as a side note you may want to make sure a vehicle can use nitro and also see if it
already has it.

regards,
This!


Re: Add nitro? - SkyWings - 05.04.2012

Quote:
Originally Posted by Jonny5
Посмотреть сообщение
change this
pawn Код:
new vehicleid = GetPlayerVehicleID(playerid);
   AddVehicleComponent(154, 1010); // x10 nitro
to this
pawn Код:
new vehicleid = GetPlayerVehicleID(playerid);
   AddVehicleComponent(vehicleid , 1010); // x10 nitro
you where only adding it to veh 154

as a side note you may want to make sure a vehicle can use nitro and also see if it
already has it.

regards,
This script is working, i tested it.