Pin Code Car
#2

Try this

pawn Код:
//place this at the VERY top - With your other defines.
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_LIGHTGREEN 0x9ACD32AA
#define COLOR_LIGHTRED 0xFF6347AA


//at the top of your script, with the rest of your declarations
new PinCode[MAX_VEHICLES];
for(new v=0; v<MAX_VEHICLES; v++)
{
    PinCode[v] = 9999
}
new bool:IsPlayerAuthenticating[MAX_PLAYERS];
for(new i=0; i<MAX_PLAYERS; i++)
{
    IsPlayerAuthenticating[i] = false;
}

//inside your command for setting a pincode
new veh = GetPlayerVehicleID(playerid);
PinCode[veh] = //pincode variable here


//place this in OnPlayerEnterVehicle
new veh = GetPlayerVehicleID(playerid);
if(PinCode[veh] == 9999)
{
    TogglePlayerControllable(playerid, 0);
    IsPlayerAuthenticating[playerid] = true;
    SendClientMessage(playerid, COLOR_GREY, "Please enter the correct pincode.");
}

//place this in OnPlayerText
new tmp[256];
new idx;
if(IsPlayerAuthenticating[playerid] == true)
{
    new GivenCode;
    new veh = GetPlayerVehicleID(playerid);
    tmp = strtok(text, idx);
    GivenCode = strval(tmp);
    if(GivenCode == PinCode[veh])
    {
        TogglePlayerControllable(playerid, 1);
        SendClientMessage(playerid, COLOR_LIGHTRED, "You have entered the correct code." );
        IsPlayerAuthenticating[playerid] = false;
        return 1;
    }
    else
    {
        SendClientMessage(playerid, COLOR_LIGHTGREEN,"You have entered an incorrect code. Access Denied.");
        RemovePlayerFromVehicle(playerid);
        IsPlayerAuthenticating[playerid] = false;
        return 1;
    }
   
}

//untested, Rob
Reply


Messages In This Thread
Pin Code Car - by Thresholdold - 01.12.2011, 01:56
Re: Pin Code Car - by Rob_Maate - 01.12.2011, 03:05
Re: Pin Code Car - by Thresholdold - 01.12.2011, 03:23
Re: Pin Code Car - by Rob_Maate - 01.12.2011, 04:02

Forum Jump:


Users browsing this thread: 1 Guest(s)