binding fix+nitro
#1

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

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

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

Код:
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.
Reply
#5

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

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

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

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.

Reply
#9

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)