public CheckGas()
{
new string[256];
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
new vehicle = GetPlayerVehicleID(i);
if(Gas[vehicle] >= 1)
{
if(Gas[vehicle] <= 10)
{
PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0);
if(gGas[i] == 1) {
GameTextForPlayer(i,"~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~Fuel is low",5000,3);
}
}
if(gGas[i] == 1) {
if(IsAPlane(vehicle) || IsABoat(vehicle) || IsABike(vehicle) || IsAHarvest(vehicle) || IsADrugHarvest(vehicle) || IsASweeper(vehicle))
{
format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~Fuel:~w~ N/A");
}
else
{
format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~Fuel:~w~ %.1f",Gas[vehicle]);
}
GameTextForPlayer(i,string,20500,3); }
if(IsAPlane(vehicle) || IsABoat(vehicle) || IsABike(vehicle) || IsAHarvest(vehicle) || IsADrugHarvest(vehicle) || IsASweeper(vehicle) || engineOn[vehicle] == 0) { }
else { Gas[vehicle] -= 0.1; }
}
else
{
NoFuel[i] = 1;
TogglePlayerControllable(i, 0);
GameTextForPlayer(i,"~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~No fuel in Vehicle",1500,3);
}
}
}
}
return 1;
}
public CheckGas()
{
new string[256];
//for(new i=0;i<MAX_PLAYERS;i++)
for(new i=0;i<MAX_VEHICLES;i++)
{
if(IsPlayerConnected(i))
{
//if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
if(engineOn[GetPlayerVehicleID(playerid)])
{
new vehicle = GetPlayerVehicleID(i);
if(Gas[vehicle] >= 1)
{
if(Gas[vehicle] <= 10)
{
PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0);
if(gGas[i] == 1) {
GameTextForPlayer(i,"~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~Fuel is low",5000,3);
}
}
if(gGas[i] == 1) {
if(IsAPlane(vehicle) || IsABoat(vehicle) || IsABike(vehicle) || IsAHarvest(vehicle) || IsADrugHarvest(vehicle) || IsASweeper(vehicle))
{
format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~Fuel:~w~ N/A");
}
else
{
format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~Fuel:~w~ %.1f",Gas[vehicle]);
}
GameTextForPlayer(i,string,20500,3); }
if(IsAPlane(vehicle) || IsABoat(vehicle) || IsABike(vehicle) || IsAHarvest(vehicle) || IsADrugHarvest(vehicle) || IsASweeper(vehicle) || engineOn[vehicle] == 0) { }
else { Gas[vehicle] -= 0.1; }
}
else
{
NoFuel[i] = 1;
TogglePlayerControllable(i, 0);
GameTextForPlayer(i,"~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~No fuel in Vehicle",1500,3);
}
}
}
}
return 1;
}
for(new i=0;i<MAX_VEHICLES;i++) { if(IsPlayerConnected(i)) { |
if(engineOn[GetPlayerVehicleID(playerid)]) { new vehicle = GetPlayerVehicleID(i); |
new vehicle = GetPlayerVehicleID(i); if(engineOn[vehicle]) { |
можно new string[64];
вот так 3 пасажира в 3 раза быстрее бензин жрать будет |
мде что-то я в другую сторону попёр. этот код тебе совсем не подходит! тебе нужно все машины проверять и к ним создать нужные переменные. ещё отдельно делай инфу для игроков.
|
new perem[MAX_VEHICLES];
perem[vehicleid] = 1;
perem[vehicleid] = 0;
if(perem[i] == 1)
{
//тогда тут действие
}
public CheckGas() { new string[256]; new sendername[MAX_PLAYER_NAME]; for(new c=0;c<CAR_AMOUNT;c++) { new engine,lights,alarm,doors,bonnet,boot,objective; GetVehicleParamsEx(c,engine,lights,alarm,doors,bonnet,boot,objective); if(Gas[c] >= 1) { if(engine && !IsAPlane© && !IsABoat© && !IsArmyAir© && !IsAVeloBike© && !IsAHarvest© && !IsADrugHarvest© && !IsASweeper©) { Gas[c]--; } } else { for(new i=0;i<MAX_PLAYERS;i++) { if(IsPlayerInAnyVehicle(i)) { if(GetPlayerVehicleID(i) == c) { if(PlayerInfo[i][pMaskuse] == 1) { format(string, sizeof(string), "* Двигатель заглох (( Незнакомец ))"); } else { GetPlayerName(i, sendername, sizeof(sendername)); format(string, sizeof(string), "* Двигатель Заглох (( %s ))", sendername); } ProxDetector(30.0, i, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); SendClientMessage(i,COLOR_GREY," (( В автомобиле кончился бензин! Вызовите механика или заправьтесь из своей канистры! ))"); } } } SetVehicleParamsEx(c,false,lights,alarm,doors,bonnet,boot,objective); } } return 1; }
public CheckGas()
{
new string[256];
new sendername[MAX_PLAYER_NAME];
for(new c=0;c<CAR_AMOUNT;c++)
{
// new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(c,engine,lights,alarm,doors,bonnet,boot,objective);
if(Gas[c] >= 1)
{
if(Gas[c] <= 10)
{
//PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
if(gGas[c] == 1) {
//GameTextForPlayer(playerid,"~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~Fuel is low",5000,3);
}
}
if(gGas[c] == 1) {
if(IsAPlane(c) || IsABoat(c) || IsABike(c) || IsAHarvest(c) || IsADrugHarvest(c) || IsASweeper(c))
{
//format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~Fuel:~w~ N/A");
}
else
{
//format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~Fuel:~w~ %.1f",Gas[c]);
}
//GameTextForPlayer(playerid,string,20500,3);
}
if(IsAPlane(c) || IsABoat(c) || IsABike(c) || IsAHarvest(c) || IsADrugHarvest(c) || IsASweeper(c) || engineOn[c] == 0) { }
else {
Gas[c] -= 0.1;
}
//else
//{
//NoFuel[playerid] = 1;
//TogglePlayerControllable(playerid, 0);
//GameTextForPlayer(playerid,"~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~No fuel in Vehicle",1500,3);
//}
}
else
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerInAnyVehicle(i))
{
if(GetPlayerVehicleID(i) == c)
{
if(PlayerInfo[i][pMaskuse] == 1)
{
format(string, sizeof(string), "* ????????? ?????? (( ?????????? ))");
}
else
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, sizeof(string), "* ????????? ?????? (( %s ))", sendername);
}
ProxDetector(30.0, i, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SendClientMessage(i,COLOR_GREY," (( ? ?????????? ???????? ??????! ???????? ???????? ??? ??????????? ?? ????? ????????! ))");
}
}
}
SetVehicleParamsEx(c,false,lights,alarm,doors,bonnet,boot,objective);
}
}
return 1;
}