SA-MP Forums Archive
binding fix+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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: binding fix+nitro (/showthread.php?tid=111481)



binding fix+nitro - jamesbond007 - 02.12.2009

how do i bind a key, lets say the number 2
to fix and add 10x nitro to my server?



Re: binding fix+nitro - Cedimedi - 02.12.2009

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if ((newkeys & KEY_SUBMISSION)) /// This will add 10x NOS to the car and repair it if player is in a car.
    {
    AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
    RepairVehicle(GetPlayerVehicleID(playerid));
    return 1;
    }

greetz


Re: binding fix+nitro - dice7 - 02.12.2009

Don't forget to add
SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0)


Re: binding fix+nitro - _Sami_ - 02.12.2009

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(adminlevel[playerid] < 1) return 0;
else
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_BRIGHTRED, "You have to be in a vehicle to type 2.");
else
if ((newkeys & KEY_SUBMISSION)) /// This will add 10x NOS to the car and repair it if player is in a car.

   AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
  4086 = RepairVehicle(GetPlayerVehicleID(playerid));
	 SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0);

   return 1;
}
C:\Documents and Settings\Administrator\Desktop\gamemodes\lvdm.pwn( 4086) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Warning.



Re: binding fix+nitro - dice7 - 02.12.2009

This is loose indentation
pawn Код:
if(a< something)
    {
       do something else
   do something else part2
}
This is correct indentation
pawn Код:
if(a< something)
{
   do something else
   do something else part2
}



Re: binding fix+nitro - _Sami_ - 02.12.2009

Quote:
Originally Posted by dice7
This is loose indentation
pawn Код:
if(a< something)
    {
       do something else
   do something else part2
}
This is correct indentation
pawn Код:
if(a< something)
{
   do something else
   do something else part2
}
i doesnt understood can u set it as a correct indentation


Re: binding fix+nitro - Djiango - 02.12.2009

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_SUBMISSION) /// This will add 10x NOS to the car and repair it if player is in a car.
    {
        if(adminlevel[playerid] < 1) return 1;
        else if(!IsPlayerInAnyVehicle(playerid)) return 1;
        else
        {
            AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
            RepairVehicle(GetPlayerVehicleID(playerid));
            SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0);
            return 1;
        }
    }
    return 1;
}
About Correct Indention!
http://forum.sa-mp.com/index.php?topic=61893.0


Re: binding fix+nitro - Cedimedi - 02.12.2009

Quote:
Originally Posted by dice7
Don't forget to add
SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0)
pawn Код:
SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0);
makes no sense, RepairVehicle fix the health and the damage.




Re: binding fix+nitro - _Sami_ - 02.12.2009

Quote:
Originally Posted by |∞|-Рцппσĵσ-|∞|
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_SUBMISSION) /// This will add 10x NOS to the car and repair it if player is in a car.
    {
        if(adminlevel[playerid] < 1) return 1;
        else if(!IsPlayerInAnyVehicle(playerid)) return 1;
        else
        {
            AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
            RepairVehicle(GetPlayerVehicleID(playerid));
            SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0);
            return 1;
        }
    }
    return 1;
}
About Correct Indention!
http://forum.sa-mp.com/index.php?topic=61893.0
thanks for giving a site this link