NEED ERGENT HELP PLEASE
#1

Well i have made it so all cars start with their engine off so you either have to turn your engine on or htowire it but with group vehicles they need to stay on all the time how can i do please

Please help me!!!!!!!!! This is what i have and it got not work

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
         if(Vehicles[GetVehicleFileID(GetPlayerVehicleID(playerid))][CarGroup])
    {
        GetVehicleParamsEx(Vehicles[GetVehicleFileID(GetPlayerVehicleID(playerid))][CarGroup], engine, lights, alarm, doors, bonnet, boot, objective);
        SetVehicleParamsEx(Vehicles[GetVehicleFileID(GetPlayerVehicleID(playerid))][CarGroup], 1, lights, alarm, doors, bonnet, boot, 0);
    }
}
PLEASE HELP ME


Help Is Appreciated
Reply
#2

Just put

pawn Код:
ManualVehicleEngineAndLights();
in Gamemodeinit for turning the engines and lights manually and on OnPlayerStateChange you cna put the following so it will automatically starts the engine once it checks if you are in a right vehicle id (your car group).

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER) // Player entered a vehicle as a driver
    {
        if( YOUR_CARGROUP_VAR ) // might be a bool or maybe your own global var but replace it with yours.
        {
            new vehicleid, engine, lights, alarm, doors, bonnet, boot, objective;
            vehicleid = GetPlayerVehicleID( playerid );
            GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
        }
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by FalconX
Посмотреть сообщение
Just put

pawn Код:
ManualVehicleEngineAndLights();
in Gamemodeinit for turning the engines and lights manually.
That is already there but the cars around the city are off o you have to hotwire them or turn them on if you own them but if you have group vehicles they are always turned off and and they need to be always on
Reply
#4

Quote:
Originally Posted by Geniuss
Посмотреть сообщение
That is already there but the cars around the city are off o you have to hotwire them or turn them on if you own them but if you have group vehicles they are always turned off and and they need to be always on
I edited my post after you have posted your reply please recheck. And also tell me if you already have the car group scripted.

Well I made this for you, I am not sure if it has bugs, give it a try.

pawn Код:
#define MAX_CAR_GROUP   (3) // top

new FcarGroup[ MAX_CAR_GROUP ]; // top

FcarGroup[ 0 ] = CreateVehicle(..); // at Gamemodeinit or whereever you want and remember the array always starts from 0
FcarGroup[ 1 ] = CreateVehicle(..); // 2
FcarGroup[ 2 ] = CreateVehicle(..); // 3
// and so on so forth but do not forget to change the MAX_CAR_GROUP it must be the same.


public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER) // Player entered a vehicle as a driver
    {
        new vehicleid, engine, lights, alarm, doors, bonnet, boot, objective;
        vehicleid = GetPlayerVehicleID( playerid );
        for(new f = 0; f < MAX_CAR_GROUP; f++)
        {
            if( vehicleid == FcarGroup[ f ] )
            {
                GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
                SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective); // when player enters in the car group it will automatically turn on the engine.
            }
        }
    }
    return 1;
}
I think it should work, well not sure not tested. You can test it and tell me if there are any bug I will try to fix them

EDIT: I just tested it, and it is working fine

FalconX
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)