23.04.2014, 14:11
You know...Like fuel system.
PHP код:
if(GetPlayerSpeed(playerid) > 0)
{
if(PRESSED(KEY_LEFT))
{
PlayerInfo[playerid][Turning] = 1;
}
else
{
PlayerInfo[playerid][Turning] = 0;
}
if(PRESSED(KEY_JUMP))
{
PlayerInfo[playerid][Turning] = 1;
}
else
{
PlayerInfo[playerid][Turning] = 0;
}
if(PRESSED(KEY_RIGHT))
{
PlayerInfo[playerid][Turning] = 1;
}
else
{
PlayerInfo[playerid][Turning] = 0;
PHP код:
public MainTimer()
{
new string[128];
new Float:x, Float:y, Float:z;
for(new i=0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(i);
if(!IsBicycle(vehicleid) && Fuel[vehicleid] > 0)
{
if(GetPlayerSpeed(i) > 0)
{
if(TireInfo[vehicleid][Front_Left_Tire] != 0 || TireInfo[vehicleid][Front_Right_Tire] != 0 || TireInfo[vehicleid][Rear_Right_Tire] != 0 || TireInfo[vehicleid][Rear_Left_Tire] != 0)
{
if(PlayerInfo[i][Turning] == 1)
{
new string0[100],string1[100],string2[100],string3[100];
TireInfo[vehicleid][Front_Left_Tire] -= random(TireInfo[vehicleid][Front_Left_Tire]);
TireInfo[vehicleid][Front_Right_Tire] -= random(TireInfo[vehicleid][Front_Right_Tire]);
TireInfo[vehicleid][Rear_Left_Tire] -= random(TireInfo[vehicleid][Rear_Left_Tire]);
TireInfo[vehicleid][Rear_Right_Tire] -= random(TireInfo[vehicleid][Rear_Right_Tire]);
format(string0 , sizeof(string0) , "{33ff66}%d {ff0000} priekine kaire padanga.",TireInfo[vehicleid][Front_Left_Tire]); ///ERORR
format(string1 , sizeof(string1) , "{33ff66}%d {ff0000} priekine desine padanga.",TireInfo[vehicleid][Front_Right_Tire]); ///ERORR
format(string2 , sizeof(string2) , "{33ff66}%d {ff0000} galine kaire padanga.",TireInfo[vehicleid][Rear_Left_Tire]); ///ERORR
format(string3 , sizeof(string3) , "{33ff66}%d {ff0000} galine desine padanga.",TireInfo[vehicleid][Rear_Right_Tire]); ///ERORR
SendClientMessage(i,COLOR_RED,string0);
SendClientMessage(i,COLOR_RED,string1);
SendClientMessage(i,COLOR_RED,string2);
SendClientMessage(i,COLOR_RED,string3);
}
}
}
//////////////////////////////////////////////
Fuel[vehicleid] -= GetPlayerSpeed(i)/1000.0;
////////////////////////////////////////////////////////////////
if(TireInfo[vehicleid][Front_Left_Tire] <= 0)
{
new panels, doors, lights, tires;
GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
UpdateVehicleDamageStatus(vehicleid, panels, doors, lights, (tires | 0b1000));
}
if(TireInfo[vehicleid][Front_Right_Tire] <= 0)
{
new panels, doors, lights, tires;
GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
UpdateVehicleDamageStatus(vehicleid, panels, doors, lights, (tires | 0b0010));
}
if(TireInfo[vehicleid][Rear_Left_Tire] <= 0)
{
new panels, doors, lights, tires;
GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
UpdateVehicleDamageStatus(vehicleid, panels, doors, lights, (tires | 0b0100));
}
if(TireInfo[vehicleid][Rear_Right_Tire] <= 0)
{
new panels, doors, lights, tires;
GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
UpdateVehicleDamageStatus(vehicleid, panels, doors, lights, (tires | 0b0001));
}
}
}
}
}