SA-MP Forums Archive
Driving License - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Driving License (/showthread.php?tid=206842)



Driving License - BaFTa - 04.01.2011

Hey, guys!
I have a question: How to make a driving license test?

I mean when someone buy a license (Example: 2000 score + $20000) he can drive sport cars. When he has a cheaper license he can drive only slower cars

How to make it? Do I need a speedo or something like this? Or I have to separate the cars in categories?


Re: Driving License - alpha500delta - 04.01.2011

I dont feel like explaining everything, to be honest. Read wiki.sa-mp.com

Edit:

pawn Код:
#include <a_samp>

new HasLicense[MAX_PLAYERS] = 0;

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Loaded :D");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/getlic", cmdtext, true, 10) == 0)
    {
        if(PUT_RESTRICITONS_HERE))
        {
            SendClientMessage(playerid, COLOR_HERE, "You dont have enough money for a license!");
        }
        else
        {
            SendClientMessage(playerid, COLOR_HERE, "You bought a license! please drive safely");
            GivePlayerMoney(playerid, -2000);
            HasLicense[playerid = 1;
        }
        return 1;
    }
    return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(IsASportCar(vehicleid && HasLicense[playerid] == 0))
    {
        RemovePlayerFromVehicle(playerid)
    }
    else
    {
        SendClientMessage(playerid, 0xFFFF00, "Please drive safely!");
        }
    return 1;
}

stock IsASportCar(vehicleid)
{
    switch(GetVehicleModel(vehicleid))
    {
        case ID's here: return 1;
    }
    return 0;
}
Havent tested. Please change COLOR, RESTRICITONS and SPORTCARIDS or it wont work


Re: Driving License - BaFTa - 04.01.2011

I haven`t scripted anything for months and I have to remember the basic things
What do you think about this? I`m not sure about anything


pawn Код:
#include <a_samp>

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(GetPlayerScore(playerid) < 2000
    {
        SendClientMessage(playerid,red,"You don`t have enough score for Professional License");
        return 1;
        }
        else if(GetPlayerScore(playerid) > 2000
        {
            SendClientMessage(playerid, red, "Congratz! You have now Proffesional License");
            GivePlayerMoney(playerid, -1000);
            GivePlayerScore(playerid, -20000);
            return 0;
            }

BTW I have another question: Why I can`t compile anything? No errors, everything is ok and "Unable to execute compiler"...


Re: Driving License - alpha500delta - 04.01.2011

Look above ^^


Re: Driving License - BaFTa - 04.01.2011

Thank you!
Will test it tommorow. Going to bed now ;]