engine broke doesnt work -
Pepino960 - 15.04.2014
Hello Guys,
Ive got the following Problem.
Ive made an script that asks if the Vehicle health is <= 300, it should turn the engine off.
But it doesnt seems to ork... ive got no Errors but nothing happend in game, whats from with it?
Hopefully someone can answear my question cuz am doing an Banger Racing script if anyone know what Bnager Racing is and maybe intrested in it, PM me.
Cheers Lads
on onFilterScriptinit ive got this
SetTimer("EngineBroke",200,1);
then
forward EngineBroke(playerid, vehicleid);
public EngineBroke(playerid, vehicleid)
{
if(IsPlayerInAnyVehicle(playerid))
{
new Float:vhealth;
new veh;
veh = GetPlayerVehicleID(playerid);
GetVehicleHealth(veh, vhealth);
if(vhealth <= 300)
{
ToggleEngine(vehicleid, VEHICLE_PARAMS_OFF);
return 1;
}
return 1;
}
return 1;
}
yes, ToggleEngine is defined and works without Problems...
Re: engine broke doesnt work -
luis_mendoza - 15.04.2014
I really do not know anything about that toggleengine function , but I'm sure its much easier to do with these
pawn Код:
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);
Re: engine broke doesnt work -
iZN - 15.04.2014
Show your macro/define/function for ToggleEngine (if it still doesn't works)
pawn Код:
forward EngineBroke(playerid);
public EngineBroke(playerid)
{
if(IsPlayerInAnyVehicle(playerid))
{
new Float:vhealth;
new veh;
veh = GetPlayerVehicleID(playerid);
GetVehicleHealth(veh, vhealth);
if(vhealth < 300.0)
{
ToggleEngine(veh, VEHICLE_PARAMS_OFF);
}
}
return 1;
}
Re: engine broke doesnt work -
luis_mendoza - 15.04.2014
And If He already defined this
pawn Код:
new veh;
veh = GetPlayerVehicleID(playerid);
Why doesn't he use than this instead
pawn Код:
ToggleEngine(veh, VEHICLE_PARAMS_OFF);
Re: engine broke doesnt work -
iZN - 15.04.2014
Quote:
Originally Posted by luis_mendoza
And If He already defined this
pawn Код:
new veh; veh = GetPlayerVehicleID(playerid);
Why doesn't he use than this instead
pawn Код:
ToggleEngine(veh, VEHICLE_PARAMS_OFF);
|
Yeah I noticed before your post, and I edited above.
Re: engine broke doesnt work -
[WSF]ThA_Devil - 15.04.2014
The problem is, the timer is not sending playerid and vehicleid params.
I suggest you doing same
SetTimer("EngineBroke",200,1);
but, changing
Код:
public EngineBroke()
{
for(new i = 0; i<MAX_PLAYERS;i++){
if(IsPlayerConnected(i)){
if(GetPlayerState(i) == PLAYER_STATE_DRIVER) {
new Float:vhealth;
new veh;
veh = GetPlayerVehicleID(i);
GetVehicleHealth(veh, vhealth);
if(vhealth < 300.0)
{
ToggleEngine(veh, VEHICLE_PARAMS_OFF);
}
}
}
}
}
*Code might be faulty because written in forums without compiler*
AW: engine broke doesnt work -
Pepino960 - 15.04.2014
@[WSF]ThA_Devil
Thank you alot, it does work now

+ sry but am new to PAWNO Scripting, just know the Basics etc
btw
/CLOSE Cheers