Help me please engine system
#1

hello
PHP код:
#include <a_samp>
#include <zcmd>
public OnGameModeInit()
{
      
ManualVehicleEngineAndLights(); // Initalization engine systems
      
return true;
}
public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    new 
vehicleid GetPlayerVehicleID(playerid);
    if (
vehicleid) {
        if ((
newkeys KEY_SUBMISSION) && GetPlayerVehicleSeat(playerid) == 0) {
             new 
enginelightsalarmdoorsbonnetbootobjective;
             
GetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective);
             if (!
engineengine 1;
             else 
engine 0;
             
SetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective);
             return 
true;
        }
    }
    return 
true;
}
CMD:engine(playerid,params[])
{
            new 
enginelightsalarmdoorsbonnetbootobjective;
            new 
vehicleid GetPlayerVehicleID(playerid);
if(
IsPlayerInAnyVehicle(playerid))
{
            
GetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective);
            
SetVehicleParamsEx(vehicleid, !enginelightsalarmdoorsbonnetbootobjective);
            
SendClientMessage(playerid0xFFFFFFFF"Your vehicle's engine is now turned [ON].");
}
else
{
        
//Send a message telling he is not in a vehicle to manipulate an engine
}
return 
1;

i have this script , its work , i press 2 engine start , BUT after 10 seconds the car is turned off automatically?

how to fix it pleasee.
Reply
#2

any pro scripter ?
Reply
#3

Are you using a fuel system? I don't see anything in what you put up that would make it turn the engine off after 10 seconds.
Reply
#4

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) 
{ 
    new vehicleid = GetPlayerVehicleID(playerid); 
    if (vehicleid) { 
        if ((newkeys & KEY_SUBMISSION) && GetPlayerVehicleSeat(playerid) == 0) { 
             new engine, lights, alarm, doors, bonnet, boot, objective; 
             GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective); 
             if (!engine) engine = 1; 
             return true; 
        }
        else engine = 0; 
        SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective); 
    } 
    return true; 
}
try that bud, not promising anything.
Reply
#5

no it is not working :/
Reply
#6

Are you using gamemode to make a engine system?
Try this..
PHP код:
#include <a_samp>
#include <zcmd>




public OnFilterScriptInit() // Use it as filterscript instead..
{
      
ManualVehicleEngineAndLights();
      return 
1;
}

public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    new 
vehicleid GetPlayerVehicleID(playerid);
    if (
vehicleid) {
        if ((
newkeys KEY_SUBMISSION) && GetPlayerVehicleSeat(playerid) == 0
        {
            new 
enginelightsalarmdoorsbonnetbootobjective;
            
GetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective);
            if (
engine == 0engine 1;
            else 
engine 0;
            
SetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective);
            return 
1;
        }
    }
    return 
1;
}

CMD:engine(playerid,params[])
{
    new 
enginelightsalarmdoorsbonnetbootobjective;
    new 
vehicleid GetPlayerVehicleID(playerid);
    if(
IsPlayerInAnyVehicle(playerid))
    {
        
GetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective);
        
SetVehicleParamsEx(vehicleid1lightsalarmdoorsbonnetbootobjective);
        
SendClientMessage(playerid0xFFFFFFFF"Your vehicle's engine is now turned [ON].");
    }
    else
    {
        
//Send a message telling he is not in a vehicle to manipulate an engine
    
}
    return 
1;

Reply
#7

no :/ again it is turned off
Reply
#8

Quote:
Originally Posted by Rafaeloo
Посмотреть сообщение
no :/ again it is turned off
Like I asked before, do you use a fuel system? There is nothing you posted that would make that happen.
Reply
#9

Quote:
Originally Posted by karemmahmed22
Посмотреть сообщение
Are you using gamemode to make a engine system?
Try this..
PHP код:
snip 


and whats the difference between using it as FS and GM?
As far as I see he wants to use it inside GM not create a special FS for it...
Reply
#10

I didn't say its something wrong, But I was wondering if he made a gamemode especially to make the engine system lol..
Ot: check your filterscript if something turning off the engine, maybe a timer or smth..
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)