13.11.2012, 23:58
I need help with this code for my DMV, the problem is it doesn't work... It's supposed to Fail someone if they are speeding or if they damage their car too much during the license test, but it doesn't seem to work (either of them). What is wrong with it, and how can I fix?
Code (located under: public OnPlayerUpdateEx ):
Code (located under: public OnPlayerUpdateEx ):
pawn Код:
}
if (TakingLesson[playerid] == 1)
{
if(IsPlayerInAnyVehicle(playerid))
{
new Float:health;
new veh;
veh = GetPlayerVehicleID(playerid);
GetVehicleHealth(veh, health);
if (health < 350)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE,"DMV: Your car broke down!");
SendClientMessage(playerid, COLOR_LIGHTBLUE,"DMV: You failed the test, please try again!");
DisablePlayerCheckpoint(playerid);
RemovePlayerFromVehicle(playerid);
SetPlayerVirtualWorld(playerid, 0);
SetVehicleToRespawn(GetPlayerVehicleID(playerid));
TakingLesson[playerid] = 0;
return 1;
}
new speed = GetPlayerSpeed(playerid, true);
if(speed > 50)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE,"DMV: You are speeding!");
SendClientMessage(playerid, COLOR_LIGHTBLUE,"DMV: You failed the test, please try again!");
DisablePlayerCheckpoint(playerid);
RemovePlayerFromVehicle(playerid);
SetPlayerVirtualWorld(playerid, 0);
SetVehicleToRespawn(GetPlayerVehicleID(playerid));
TakingLesson[playerid] = 0;
return 1;
}
}
}
}
return 1;
}