PDA

View Full Version : Car health!


Qur
17/11/2011, 12:26 PM
I really need a help and fast! why the hell its not working!?!?
when the car health reach 0 its still not kicking me!
btw.. i cut almost all checkpoint so it wont be so long..


new string[256];
new newcar = GetPlayerVehicleID(playerid);
if(IsADMV(newcar))
{
if(DrivingTest[playerid] == 1)
{
new Float:health;
new veh;
veh = GetPlayerVehicleID(playerid);
GetVehicleHealth(veh, health);
if(health >900)
{
if(PlayerToPoint(5.0,playerid,1638.4492,-1890.1343,13.4308))
{
DrivingStep[playerid] = 2;
SetPlayerCheckpoint(playerid, 1621.6774,-1881.4092,13.3419, 3.0);
}
else if(PlayerToPoint(5.0,playerid,1621.6774,-1881.4092,13.3419))
{
format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~w~STOP at ~n~~r~Red Lights!");
GameTextForPlayer(playerid, string, 3000, 3);
DrivingStep[playerid] = 3;
SetPlayerCheckpoint(playerid, 1588.8909,-1869.7900,13.2578, 3.0);
}
else if(PlayerToPoint(5.0,playerid,1588.8909,-1869.7900,13.2578))
{
DrivingStep[playerid] = 4;
SetPlayerCheckpoint(playerid, 1543.2153,-1869.0680,13.2578, 3.0);
}
else if(PlayerToPoint(5.0,playerid,1543.2153,-1869.0680,13.2578))
{
DrivingStep[playerid] = 5;
SetPlayerCheckpoint(playerid, 1446.1343,-1870.1936,13.2656, 3.0);
}
else if(PlayerToPoint(5.0,playerid,1446.1343,-1870.1936,13.2656))
{
DrivingStep[playerid] = 6;
SetPlayerCheckpoint(playerid, 1407.8805,-1870.6096,13.2577, 3.0);
}
else if(PlayerToPoint(5.0,playerid,1407.8805,-1870.6096,13.2577))
{
DrivingStep[playerid] = 7;
SetPlayerCheckpoint(playerid, 1391.8116,-1745.7651,13.2578, 3.0);
}
else if(PlayerToPoint(5.0,playerid,1391.8116,-1745.7651,13.2578))
{
DrivingStep[playerid] = 8;
SetPlayerCheckpoint(playerid, 1431.7915,-1607.3561,13.2578, 3.0);
}
else if(PlayerToPoint(5.0,playerid,1824.0975,-1843.9624,13.2891))
{
format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~w~Please make another ~n~~g~U-Turn~w~");
GameTextForPlayer(playerid, string, 3000, 3);
DrivingStep[playerid] = 44;
SetPlayerCheckpoint(playerid, 1703.6459,-1809.8523,13.2410, 3.0);
}
else if(PlayerToPoint(5.0,playerid,1703.6459,-1809.8523,13.2410))
{
DrivingStep[playerid] = 45;
SetPlayerCheckpoint(playerid, 1636.5017,-1869.3054,13.2578, 3.0);
}
else if(PlayerToPoint(5.0,playerid,1636.5017,-1869.3054,13.2578))
{
DrivingStep[playerid] = 46;
SetPlayerCheckpoint(playerid, 1652.0305,-1880.7003,13.4175, 3.0);
}
else if(PlayerToPoint(5.0,playerid,1652.0305,-1880.7003,13.4175))
{
DrivingStep[playerid] = 47;
SetPlayerCheckpoint(playerid, 1638.0692,-1903.3049,13.4268, 3.0);
}
else if(PlayerToPoint(5.0,playerid,1638.0692,-1903.3049,13.4268))
{
SendClientMessage(playerid,COLOR_GREEN,"STATUS: You kept the vehicle almost fully unharmed, Passed.");
PlayerInfo[playerid][pCarLic] = 1;
SetVehicleToRespawn(veh);
DrivingTest[playerid] = 0;
DisablePlayerCheckpoint(playerid);
}
return 1;
}
else
{
SendClientMessage(playerid,COLOR_RED,"STATUS: You failed the test, better luck next time!");
SetVehicleToRespawn(veh);
DrivingTest[playerid] = 0;
DisablePlayerCheckpoint(playerid);
return 1;
}
}
}

Kostas'
17/11/2011, 12:52 PM
I really need a help and fast! why the hell its not working!?!?
when the car health reach 0 its still not kicking me!
btw.. i cut almost all checkpoint so it wont be so long..

What do you mean by not kicking you? Explain me to understand it, so If I know it to help you!

Qur
17/11/2011, 12:59 PM
The idea.. that you start the test.. and if at any time the car health gets under value.. lets say if 1000.0 its 100% so at 90% you'll fail the test, the car will respawn and it will remove you from the car..
but for some reason its not happening..

whitedragon
17/11/2011, 01:05 PM
Try 900.0 not 900..

Kostas'
17/11/2011, 01:10 PM
Maybe this. At 850 vhealth => Failed finish the test. I didn't test it, but I hope to work

new string[256];
new newcar = GetPlayerVehicleID(playerid);
if(IsADMV(newcar))
{
if(DrivingTest[playerid] == 1) {
new Float:health;
new veh;
veh = GetPlayerVehicleID(playerid);
GetVehicleHealth(veh, health);
if(health >900) {
if(PlayerToPoint(5.0,playerid,1638.4492,-1890.1343,13.4308)) {
DrivingStep[playerid] = 2;
SetPlayerCheckpoint(playerid, 1621.6774,-1881.4092,13.3419, 3.0);
}
else if(PlayerToPoint(5.0,playerid,1621.6774,-1881.4092,13.3419)) {
format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~w~STOP at ~n~~r~Red Lights!");
GameTextForPlayer(playerid, string, 3000, 3);
DrivingStep[playerid] = 3;
SetPlayerCheckpoint(playerid, 1588.8909,-1869.7900,13.2578, 3.0);
}
else if(PlayerToPoint(5.0,playerid,1588.8909,-1869.7900,13.2578)) {
DrivingStep[playerid] = 4;
SetPlayerCheckpoint(playerid, 1543.2153,-1869.0680,13.2578, 3.0);
}
else if(PlayerToPoint(5.0,playerid,1543.2153,-1869.0680,13.2578)) {
DrivingStep[playerid] = 5;
SetPlayerCheckpoint(playerid, 1446.1343,-1870.1936,13.2656, 3.0);
}
else if(PlayerToPoint(5.0,playerid,1446.1343,-1870.1936,13.2656)) {
DrivingStep[playerid] = 6;
SetPlayerCheckpoint(playerid, 1407.8805,-1870.6096,13.2577, 3.0);
}
else if(PlayerToPoint(5.0,playerid,1407.8805,-1870.6096,13.2577)) {
DrivingStep[playerid] = 7;
SetPlayerCheckpoint(playerid, 1391.8116,-1745.7651,13.2578, 3.0);
}
else if(PlayerToPoint(5.0,playerid,1391.8116,-1745.7651,13.2578)) {
DrivingStep[playerid] = 8;
SetPlayerCheckpoint(playerid, 1431.7915,-1607.3561,13.2578, 3.0);
}
else if(PlayerToPoint(5.0,playerid,1824.0975,-1843.9624,13.2891)) {
format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~w~Please make another ~n~~g~U-Turn~w~");
GameTextForPlayer(playerid, string, 3000, 3);
DrivingStep[playerid] = 44;
SetPlayerCheckpoint(playerid, 1703.6459,-1809.8523,13.2410, 3.0);
}
else if(PlayerToPoint(5.0,playerid,1703.6459,-1809.8523,13.2410)) {
DrivingStep[playerid] = 45;
SetPlayerCheckpoint(playerid, 1636.5017,-1869.3054,13.2578, 3.0);
}
else if(PlayerToPoint(5.0,playerid,1636.5017,-1869.3054,13.2578)) {
DrivingStep[playerid] = 46;
SetPlayerCheckpoint(playerid, 1652.0305,-1880.7003,13.4175, 3.0);
}
else if(PlayerToPoint(5.0,playerid,1652.0305,-1880.7003,13.4175)) {
DrivingStep[playerid] = 47;
SetPlayerCheckpoint(playerid, 1638.0692,-1903.3049,13.4268, 3.0);
}
else if(PlayerToPoint(5.0,playerid,1638.0692,-1903.3049,13.4268)) {
SendClientMessage(playerid,COLOR_GREEN,"STATUS: You kept the vehicle almost fully unharmed, Passed.");
PlayerInfo[playerid][pCarLic] = 1;
SetVehicleToRespawn(veh);
DrivingTest[playerid] = 0;
DisablePlayerCheckpoint(playerid);
}
return 1;
}
GetVehicleHealth(veh, health);
if(health >850) {
SendClientMessage(playerid,COLOR_RED,"STATUS: You failed the test, better luck next time!");
SetVehicleToRespawn(veh);
DrivingTest[playerid] = 0;
DisablePlayerCheckpoint(playerid);
}
else {
SendClientMessage(playerid,COLOR_RED,"STATUS: You failed the test, better luck next time!");
SetVehicleToRespawn(veh);
DrivingTest[playerid] = 0;
DisablePlayerCheckpoint(playerid);
return 1;
}
}
}

Qur
17/11/2011, 01:13 PM
Right now its working.. but not at 90% but still working...
btw.. whitedragon what you said i already tried.. but retried now.. and worked! thanks :)

Kostas'
17/11/2011, 01:16 PM
Change the Vehicle health to this that you want. I just put it on 850/1000