Must use command for...
#1

Hey I'm trying on my driving test to make someone turn off his engine so he'll be able to continue the test.. if he wont turn off his engine it will stop the test..
I thought it will be easy.. but since i'm a beginner.. its a bit hard...

pawn Код:
else if(PlayerToPoint(5.0,playerid,2391.1626,-1487.6006,23.7031))
            {
                DrivingStep[playerid] = 30;
                new vehicleid = GetPlayerVehicleID(playerid);
                new engine, lights, alarm, doors, bonnet, boot, objective;
                GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
                if(engine == 0)
                {
                    DrivingStep[playerid] = 31;
                    SetPlayerCheckpoint(playerid, 2397.5991,-1516.1816,23.7110, 3.0);
                }
                else
                {
                    SendClientMessage(playerid,COLOR_RED,"STATUS: You failed the test, I wasn't kidding!!");
                    SetVehicleToRespawn(veh);
                    DrivingTest[playerid] = 0;
                    DisablePlayerCheckpoint(playerid);
                }
            }
If anyone how to do it.. thanks
I hope its possible..


btw.. i have the /engine command..



EDIT: A timer would help?
if it does someone can help me with it abit? never worked with timers
Reply
#2

Because I don't know your /engine command, I made this with Dialogs. if you choose Turn off > continue, if turn on > failed from the driving test. I hope to work!
pawn Код:
else if(PlayerToPoint(5.0,playerid,2391.1626,-1487.6006,23.7031))
{
    DrivingStep[playerid] = 30;
    SendClientMessage(playerid,COLOR_RED,"STATUS: Turn off the vehicle engine to continue the test!");
    ShowPlayerDialog(playerid, 888, DIALOG_STYLE_LIST, "Driving Test - Engine", "{FF0000}Turn Off\n{00FF00}Turn On", "Select", "Cancel");
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    new veh = GetPlayerVehicleID(playerid);
    new engine, lights, alarm, doors, bonnet, boot, objective;
    if(dialogid == 888) {
        if(response) {
            if(listitem == 0) {
                GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
                SetVehicleParamsEx(veh,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
                DrivingStep[playerid] = 31;
                SetPlayerCheckpoint(playerid, 2397.5991,-1516.1816,23.7110, 3.0);
            }
            if(listitem == 1) {
                SendClientMessage(playerid,COLOR_RED,"STATUS: You failed the test, I wasn't kidding!!");
                SetVehicleToRespawn(veh);
                DrivingTest[playerid] = 0;
                DisablePlayerCheckpoint(playerid);
            }
        }
    }
    // Rest Of Code
Reply
#3

Hey thanks man, I'll try it..
but cant make it more simple? without a dialog? right now I'm trying make it with timer..
the problem that after he turn off his engine he must turn on again to continue..


But yea if I wont make it i'll use your idea with the dialog
Reply
#4

To be honest, I was thinking it too, to make it with a timer, but I thought that with dialogs is more simple and best way, to looks like nicely! However, about the problem you mention he turn off the engine but on
pawn Код:
DrivingStep[playerid] = 30;
If I am correct you have more than 30, right? So, on
pawn Код:
DrivingStep[playerid] = 31;
Turn on the Vehicle Engine.
Reply
#5

Actually its a bit complicated for me that shitty timers! DAMN
i was trying to make.. I'll show here what I did.. but I just cant make it.. when I stat the test its stop the test right away and giving me the msg about that engine thing.. anyway..

pawn Код:
forward DrivingTestTimer(playerid);
part of the test:

pawn Код:
else if(PlayerToPoint(5.0,playerid,2415.0850,-1486.8523,23.7030))
            {
                format(string, sizeof(string), "~n~~n~~n~~n~~w~Reverse parking");
                GameTextForPlayer(playerid, string, 3000, 3);
                DrivingStep[playerid] = 30;
                SetPlayerCheckpoint(playerid, 2391.1626,-1487.6006,23.7031, 3.0);
            }
            else if(PlayerToPoint(5.0,playerid,2391.1626,-1487.6006,23.7031))
            {
                if (DrivingTestTimer(playerid))
                {
                    DrivingStep[playerid] = 31;
                    SetPlayerCheckpoint(playerid, 2397.5991,-1516.1816,23.7110, 3.0);
                }
            }
OnGameMode~~
pawn Код:
SetTimer("DrivingTestTimer", 20000, true);
pawn Код:
public DrivingTestTimer(playerid)
{
    new veh;
    veh = GetPlayerVehicleID(playerid);
    new vehicleid = GetPlayerVehicleID(playerid);
    new engine, lights, alarm, doors, bonnet, boot, objective;
    GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
    if(engine == 0)
    {
        DrivingStep[playerid] = 31;
        SetPlayerCheckpoint(playerid, 2397.5991,-1516.1816,23.7110, 3.0);
        return 1;
    }
    else
    {
        SendClientMessage(playerid,COLOR_RED,"STATUS: You failed the test, I wasn't kidding!!");
        SetVehicleToRespawn(veh);
        DrivingTest[playerid] = 0;
        DisablePlayerCheckpoint(playerid);
    }
    return 1;
}

I was trying to make: when you reach that point you have 20 secs to turn off the engine.. after that you can just turn it on and continue.. if after 20 secs you wont turn off you'll fail..

Help?
Reply
#6

why do u use SetTimer? use SetTimerEx.
Reply
#7

i dont really know use any of them...
changed it to:

pawn Код:
SetTimerEx("DrivingTestTimer", 20000, true,"i",playerid);
but still what i made need to be fixed.. anyone?
Reply
#8

Bump

Still cant figure it out..
anyone please?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)