02.12.2009, 09:36
how do i bind a key, lets say the number 2
to fix and add 10x nitro to my server?
to fix and add 10x nitro to my server?
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;
}
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; }
if(a< something)
{
do something else
do something else part2
}
if(a< something)
{
do something else
do something else part2
}
Originally Posted by dice7
This is loose indentation
pawn Код:
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;
}
Originally Posted by dice7
Don't forget to add
SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0) |
SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0);
Originally Posted by |∞|-Рцппσĵσ-|∞|
pawn Код:
http://forum.sa-mp.com/index.php?topic=61893.0 |