11.01.2011, 13:54
Why this engine script don't work? When I enter the car with off engine, I get: Maљinos variklis uћkūrtas( IN ENG: Vehicle engine is ON ). When I try to turn it on( lol ) and sometimes get succesfully - engine is off.....
pawn Код:
if( HOLDING( KEY_CROUCH ) )
{
if( IsPlayerInAnyVehicle( playerid ) && GetPlayerState( playerid ) == PLAYER_STATE_DRIVER )
{
new
Masina = GetPlayerVehicleID( playerid )
;
if( GetVehicleModel( Masina ) != 481 || GetVehicleModel( Masina ) != 509 || GetVehicleModel( Masina ) != 510 )
{
new
Float: Gyvybes
;
GetVehicleHealth( Masina, Gyvybes );
GetVehicleParamsEx( Masina, Variklis, Lempos, Signalizacija, Uzrakinimas, Kapotas, Bagazine, Lempute );
if( Gyvybes < 650 ) return SendClientMessage( playerid, -1, ""#h_Balta"Maрina yra "#h_Raudona"per daug sudauюyta" );
if( Variklis )
{
SendClientMessage( playerid, -1, ""#h_Balta"[ > ] "#h_Geltona"Maрinos variklis "#h_Raudona"uюgesintas" );
SetVehicleParamsEx( Masina, false, Lempos, Signalizacija, Uzrakinimas, Kapotas, Bagazine, Lempute );
}
if( ! Variklis )
{
SendClientMessage( playerid, -1, ""#h_Balta"[ > ] "#h_Geltona"Maрinos variklis "#h_Raudona"kuriamas" );
SetTimerEx( "MasinosVariklis", 4500, false, "d", playerid, Masina );
}
}
}
}
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if( newstate == PLAYER_STATE_DRIVER )
{
new
Masina = GetPlayerVehicleID( playerid )
;
GetVehicleParamsEx( Masina, Variklis, Lempos, Signalizacija, Uzrakinimas, Kapotas, Bagazine, Lempute );
if( Variklis ) SendClientMessage( playerid, -1, ""#h_Balta"[ > ] "#h_Geltona"Maрinos variklis yra "#h_Raudona"UЮKЫRTAS. "#h_Orandzine"Sekmлs kelyje!" );
else if( ! Variklis ) SendClientMessage( playerid, -1, ""#h_Balta"[ > ] "#h_Geltona"Maрinos variklis yra "#h_Zalia"NEUЮЫRTAS. "#_Geltona"Spauskite "#h_Orandzine"H." );
}
return 1;
}
pawn Код:
forward MasinosVariklis( playerid, vehicleid );
public MasinosVariklis( playerid, vehicleid )
{
if( MasinuDB[ vehicleid ][ Degalai ] == 0 ) return SendClientMessage( playerid, -1, ""#h_Balta"[ > ] "#h_Geltona"Maрinoje "#h_Raudona"nлra "#h_Geltona"degalш" );
new
Random = random( 4 )
;
GetVehicleParamsEx( vehicleid, Variklis, Lempos, Signalizacija, Uzrakinimas, Kapotas, Bagazine, Lempute );
if( Random == 0 || Random == 1 && ! Variklis )
{
SetVehicleParamsEx( vehicleid, true, Lempos, Signalizacija, Uzrakinimas, Kapotas, Bagazine, Lempute );
SendClientMessage( playerid, -1, ""#h_Balta"[ > ] "#h_Geltona"Variklis "#h_Zalia"sлkmingai uюsikыrл." );
}
if( Random == 2 || Random == 3 )
{
SendClientMessage( playerid, -1, ""#h_Balta"[ > ] "#h_Geltona"Variklis "#h_Raudona"neuюsikыrл." );
}
return true;
}