Checkpoints..
#1

Hey..
I'm making a driving test and I need help with the checkpoints..
I'll show here what I've done so far.. but I dunno how to continue the /engine part.. I'll explain at the end exactly what I need..
thanks

pawn Код:
OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]);
forward IsADMV(carid);

public IsADMV(carid)
{
    if(carid >= 35 && carid <= 38)
    {
        return 1;
    }
    return 0;
}
pawn Код:
if(IsADMV(newcar))
        {
            if (TakingLesson[playerid] > 0)
            {
                if(PlayerInfo[playerid][pCarLic] < 1)
                {
                    format(string, sizeof(string), "~w~To start the test type ~n~~g~/engine~w~");
                    GameTextForPlayer(playerid, string, 5000, 3);
                }
                else
                {
                    RemovePlayerFromVehicle(playerid);
                    SendClientMessage(playerid,COLOR_GREY,"You already have a license!");
                }
            }
            else
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid,COLOR_GREY,"Go inside the DMV and start your lesson!");
            }
        }
pawn Код:
if(!strcmp(cmd, "/engine", true))
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        new engine, lights, alarm, doors, bonnet, boot, objective;
        GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
        GetPlayerName(playerid, sendername, sizeof(sendername));
        format(string, sizeof(string), "* %s puts the keys and turn on the engine.", sendername);
        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        if(engine == 1)
        {
            SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "* %s Turn off the engine and take the keys.", sendername);
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
        else
        {
            SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
        }
        new newcar = GetPlayerVehicleID(playerid);
        if(IsADMV(newcar))
        {
            if (TakingLesson[playerid] > 0)
            {
                if(PlayerInfo[playerid][pCarLic] < 1)
                {
                    return 1;
                }
            }
        }
    }
pawn Код:
if(strcmp(cmd, "/dmv", true) == 0)
    {
        if (PlayerToPoint(2.0, playerid,-2033.2893,-117.4233,1035.1719))
        {
            ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Welcome to Driving Motor Vehicle", "Driving License ($500) \nStop Test", "Accept", "Cancel");
            return 1;
        }
    }
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(response)
    {
        switch(dialogid)
        {
            case 1:
            {
                switch(listitem)
                {
                    case 0:
                    {
                        if(PlayerInfo[playerid][pCarLic] < 1)
                        {
                            if (TakingLesson[playerid] < 1)
                            {
                                if(GetPlayerMoney(playerid) < 500) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                                GivePlayerMoney(playerid, -500);
                                TakingLesson[playerid] = 1;
                                SendClientMessage(playerid, 0xFFFFFF, "Enter one of the school vehicles outside and start your test, Good lcuk!.");
                            }
                            else
                            {
                                SendClientMessage(playerid, 0xFFFFFF, "You already started the test.");
                            }
                        }
                        else
                        {
                        SendClientMessage(playerid, 0xFFFFFF, "You already have a driving license.");
                        }
                    }
                    case 1:
                    {
                        if (TakingLesson[playerid] > 1)
                        {
                            TakingLesson[playerid] = 0;
                        }
                        else
                        {
                            SendClientMessage(playerid, 0xFFFFFF, "You didn't even tried.");
                        }
                    }
                }
            }
        }
    }
    return 1;
}

And here's what I need:
when you start the /engine you get the first checkpoint and your test is starting.. there are around 50 checkpoints.. everytime you enter checkpoint a next one appear..
and if the car damaged under 80 persents you leave the car and the cars respawn..

if someone can just explain to me how to do it.. it will be good.. i dont want someone to make me everything.. just explain or give example!
thanks for helpers!!

btw.. i think it will help other people too
Reply
#2

I will not do it for you, or you will not learn, but:

Use https://sampwiki.blast.hk/wiki/GetVehicleHealth to check the vehicles health, and if it goes below 80, have it eject the player and destroy the checkpoints. Use a timer, OnPlayerUpdate will cause some lag, it just isn't efficient.

To make the textdraws change use https://sampwiki.blast.hk/wiki/OnPlayerEnterCheckpoint and when the player enters the first checkpoint, destroy it, and create the next checkpoint, then repeat until all 50 are done.

If you need more details, just respond.



- Camacorn
Reply
#3

Thanks a lot.. and yea ofc.. I didnt want anyone to make it for me so i'll learn..
I already know about the car health...
the problem that..
after a player doing /engine
how do I send him to the first checkpoint? i'm stuck on that point
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)