public CheckCarHealth()
{
new string[128];
new sendername[MAX_PLAYER_NAME];
for (new i=0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i) && IsPlayerInAnyVehicle(i) && GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
new Float:health;
GetVehicleHealth(GetPlayerVehicleID(i),health);
new newcar = GetPlayerVehicleID(i);
if (health <= 300 && !IsModelABoat(newcar) && !IsModelABike(newcar) && !IsModelAPlane(newcar) && !IsASweeper(newcar))
{
if(engineOn[GetPlayerVehicleID(i)] == 1)
{
if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
TogglePlayerControllable(i, 0);
SendClientMessage(i, COLOR_GREY, "Motorul sa stricat,poti suna mecanicul!");
engineOn[GetPlayerVehicleID(i)] = false;
GetPlayerName(i, sendername, sizeof(sendername));
format(string, sizeof(string), "* Motorul sa stricat! (( %s ))", sendername);
ProxDetector(30.0, i, string, COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
}
}
}
}
}
}
!IsModelABoat(newcar)
new newcar = GetVehicleModel(GetPlayerVehicleID(i))
// Now, what this function will do? Will get the model of the vehicle driven by the "i".
First of all, what's up with these functions:
pawn Код:
pawn Код:
|
public CheckCarHealth()
{
new string[128];
new sendername[MAX_PLAYER_NAME];
for (new i=0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i) && IsPlayerInAnyVehicle(i) && GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
new Float:health;
GetVehicleHealth(GetPlayerVehicleID(i),health);
new newcar = GetPlayerVehicleID(i))
if (health <= 300))
{
if(engineOn[GetPlayerVehicleID(i)] == 1)
{
if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
TogglePlayerControllable(i, 0);
SendClientMessage(i, COLOR_GREY, "Motorul sa stricat,poti suna mecanicul!");
engineOn[GetPlayerVehicleID(i)] = false;
GetPlayerName(i, sendername, sizeof(sendername));
format(string, sizeof(string), "* Motorul sa stricat! (( %s ))", sendername);
ProxDetector(30.0, i, string, COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
}
}
}
}
}
}
public OnVehicleDamageStatusUpdate(vehicleid, playerid) {
new Float:v;
GetVehicleHealth(vehicleid, v);
if(v <= 300) {
SendClientMessage(playerid, -1, "Motorul sa stricat,poti suna mecanicul!");
SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_OFF, 0, 0, 0, VEHICLE_PARAMS_ON, 0, 0);
SetVehicleHealth(vehicleid, 300);
}
return true;
}
public OnVehicleDamageStatusUpdate(vehicleid, playerid)
{
new Float:v;
GetVehicleHealth(vehicleid, v);
if(v <= 300) { TogglePlayerControllable(playerid, 0); {
SendClientMessage(playerid, -1, "Motorul sa stricat,poti suna mecanicul!");
SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_OFF, 0, 0, 0, VEHICLE_PARAMS_ON, 0, 0);
SetVehicleHealth(vehicleid, 300);
}
}
return 1;
}
new bool:a[MAX_PLAYERS];
//
public OnVehicleDamageStatusUpdate(vehicleid, playerid) {
new Float:v;
GetVehicleHealth(vehicleid, v);
if(v <= 300 && a[playerid] == false) {
SendClientMessage(playerid, -1, "Motorul sa stricat,poti suna mecanicul!");
SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_OFF, 0, 0, 0, VEHICLE_PARAMS_ON, 0, 0);
SetVehicleHealth(vehicleid, 300);
a[playerid] = true;
}
return 1;
}