Help with DMV system.
#1

pawn Код:
if(IsPlayerInAnyVehicle(playerid) && !IsBicycle(GetPlayerVehicleID(playerid)))
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        if(VehicleSecurity[vehicleid] == 1)
        {
            ToggleAlarm(vehicleid, VEHICLE_PARAMS_ON);
            SetTimerEx("StopAlarm", ALARM_TIME, false, "d", vehicleid);
        }
    }
    else
    {
    }
    if(newstate == PLAYER_STATE_DRIVER)
    {
        new car = GetPlayerVehicleID(playerid);
        if(car == dmvc || car == dmvc1 || car == dmvc2)
        {
            SCM(playerid, COLOR_GOLD,"Type /dmvtest to start the Drivers License test or /exitcar to exit");
        }
        else
        {
            if(PlayerInfo[playerid][pDriveLic] < 1)
            {
                SendClientMessage(playerid, COLOR_GREEN, "You need a driving license, Other wise cops with catch you.");
                TogglePlayerControllable(playerid, 0);
                SetTimer("Unfreeze", 2000, 0);
            }
        }
        new vehicleid = GetPlayerVehicleID(playerid);
        new id = GetVehicleID(vehicleid);
        if(IsValidVehicle(id))
        {
            if(VehicleCreated[id] == VEHICLE_DEALERSHIP)
            {
                SetPVarInt(playerid, "DialogValue1", id);
                ShowDialog(playerid, DIALOG_VEHICLE_BUY);
                return 1;
            }
        }
        if(IsBicycle(vehicleid))
        {
            ToggleEngine(vehicleid, VEHICLE_PARAMS_ON);
        }
        if(Fuel[vehicleid] <= 0)
        {
            ToggleEngine(vehicleid, VEHICLE_PARAMS_OFF);
        }
What should I do if a person enters the sentinal and do not write /DMVtest within 30 seconds he would be ejected from the car.
Reply
#2

What about: Checking if someone already has a license, with setting something in your userdata to 0 by default and when it returns 0 when a player enters a vehicle, the player does not have a license!.

Then when a players enters the vehicle without a license you start a timer and when the timer has finished you simply give him a dialog when he can accept if he wants to go to the drivers test or something. when he rejects the dialog with canceling (button 2) he will be ejected from the vehicle.

When he passed the drivers test his userdata will be set to 1, and when he enters a vehicle for the next time his data is 1 so the driver test part will be ignored and he can drive with his vehicle.

after that it is much easyer to make new functions like: checking if he has a license by a admin, or whatever you want
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)