Toll Both System
#1

So i added toll both system but made something wrong on Toll Update function. Someone help.

Errors
PHP код:
C:\Users\Euronics Latvija\Desktop\LCRP\gamemodes\nlrp.pwn(32650) : warning 235: public function lacks forward declaration (symbol "TollUpdate")
C:\Users\Euronics Latvija\Desktop\LCRP\gamemodes\nlrp.pwn(32654) : error 017undefined symbol "aTolls"
C:\Users\Euronics Latvija\Desktop\LCRP\gamemodes\nlrp.pwn(32654) : warning 215expression has no effect
C
:\Users\Euronics Latvija\Desktop\LCRP\gamemodes\nlrp.pwn(32654) : error 001expected token";"but found "]"
C:\Users\Euronics Latvija\Desktop\LCRP\gamemodes\nlrp.pwn(32654) : error 029invalid expressionassumed zero
C
:\Users\Euronics Latvija\Desktop\LCRP\gamemodes\nlrp.pwn(32654) : fatal error 107too many error messages on one line 
Code
PHP код:
public TollUpdate() 
{
    for(new 
0MAX_TOLLSi++)
    {
        if(
aTolls[i][E_tOpenTime] > 0)
        {
            
aTolls[i][E_tOpenTime];
            if(
aTolls[i][E_tOpenTime] == 1)
            {
                
Toll_CloseToll(i);
            }
        }
    }

I have added
PHP код:
    //Tolls
    
TollUpdate();
    
//Tolls 
On public OnPlayerUpdate(playerid)
Reply
#2

Have you forwared the function TollUpdate? Public functions need to be forwarded.

Also take in consideration that OnPlayerUpdate may run from 33 to 99 (30 on foot rate) times every second PER player, that means with even 10 players it will run in promedy roughly 665 times per second.
Reply
#3

first add
pawn Код:
forward TollUpdate();
add a enum
pawn Код:
enum Tolls
{
      E_tOpenTime
}
new aTolls[MAX_PLAYERS][Tolls]
and see if the errors are still ocurring cause with this code you show us its a bit hard to fix
Reply
#4

Now i got this

PHP код:
C:\Users\Euronics Latvija\Desktop\LCRP\gamemodes\nlrp.pwn(32654) : error 017undefined symbol "aTolls"
C:\Users\Euronics Latvija\Desktop\LCRP\gamemodes\nlrp.pwn(32654) : warning 215expression has no effect
C
:\Users\Euronics Latvija\Desktop\LCRP\gamemodes\nlrp.pwn(32654) : error 001expected token";"but found "]"
C:\Users\Euronics Latvija\Desktop\LCRP\gamemodes\nlrp.pwn(32654) : error 029invalid expressionassumed zero
C
:\Users\Euronics Latvija\Desktop\LCRP\gamemodes\nlrp.pwn(32654) : fatal error 107too many error messages on one line 
Reply
#5

Can i see the whole Tolls system codE?
Reply
#6

PHP код:
//============================Tolls============================//
// Main configuration
#define TollCost (50)                     // How much it costs to pass the tolls
#define TollDelayCop (4)                 // The timespace in seconds between each /toll command for all cops (To avoid spam)
#define TollOpenDistance (8.0)             // The distance in units the player can be from the icon to open the toll

// Other defines
#define MAX_TOLLS (5) // Amount of tolls
#define INVALID_TOLL_ID (-1)
#define RichmanToll (0)
#define FlintToll (1)
#define LVToll (2)
#define BlueberryTollR (3)
#define BlueberryTollL (4)

#define L_sz_TollStringLocked ("Toll guard says: I'm sorry, but I can't open this right now. You'll have to come back later.")
#define L_sz_TollStringNoMoney ("You don't have enough money to pay the guard.")
#define L_sz_TollStringBye ("Toll guard says: Thank you, drive safe.")
#define L_sz_TollStringHurryUp ("You have 6 seconds to get past the barrier, make sure you don't get stuck!")
//============================Tolls============================//

//Tolls
new LaRequestAllowedCop// The same timer for all /toll changes
new    LaTollObject[MAX_TOLLS*2]; // 0 & 1 = Richhman, 2 & 3 = Flint, 4 & 5 = LV, 6 & 7 = BlueBerry right

    
AddTolls(); // At GameModeInit
forward TollUpdate();
public 
TollUpdate() // Needs to be called in the OnPlayerUpdate function
{
    for(new 
0MAX_TOLLSi++)
    {
        if(
aTolls[i][E_tOpenTime] > 0)
        {
            
aTolls[i][E_tOpenTime];
            if(
aTolls[i][E_tOpenTime] == 1)
            {
                
Toll_CloseToll(i);
            }
        }
    }
}

    
//Tolls
    
TollUpdate(); // OnPlayerUpdate
    //Tolls

forward AddTolls();
public 
AddTolls() // Needs to be called in the OnGameModeInit function!
{
    
// Thanks to Nexus for the following mapping!
    /* Richman */
    
CreateDynamicObject8168612.73895263672, -1191.460205078120.2941055297850.0000005318.31237792969, -);
    
CreateDynamicObject8168620.47265625, -1188.4960937520.0441055297850.000000352.99621582031138.94409179688, -);
    
CreateDynamicObject966613.97229003906, -1197.717407226617.4750308990480.0000000.00000023.81982421875, -);
    
CreateDynamicObject997614.33209228516, -1194.387084960917.7093696594240.0000000.000000266.70568847656, -);
    
CreateDynamicObject973602.98425292969, -1202.164306640618.0005168914790.0000000.00000019.849853515625, -);
    
LaTollObject[0] = CreateDynamicObject968613.8935546875, -1197.732910156318.1091804504390.000000, -90.00000023.81982421875, -);
    
CreateDynamicObject966619.42913818359, -1181.659790039118.7250308990480.0000000.000000214.37744140625, -);
    
CreateDynamicObject973629.68823242188, -1176.055175781319.5005168914790.0000000.00000021.831787109375, -);
    
CreateDynamicObject997619.26574707031, -1181.651855468818.7093696594240.0000000.000000268.68908691406, -);
    
LaTollObject[1] = CreateDynamicObject968619.44201660156, -1181.690307617219.5258064270020.000000, -90.000000214.37744140625, -);
    
/* End of Richman */

    /* Flint */
    
CreateDynamicObject816861.256042480469, -1533.39465332036.10425376892090.0000000.0000009.9252624511719, -);
    
CreateDynamicObject816840.966598510742, -1529.57250976566.10425376892090.0000000.000000188.5712890625, -);
    
LaTollObject[2] = CreateDynamicObject96835.838928222656, -1525.90344238285.00121450424190.000000, -90.000000270.67565917969, -);
    
CreateDynamicObject96635.889751434326, -1526.00964355474.24106121063230.0000000.000000270.67565917969, -);
    
CreateDynamicObject96667.093727111816, -1536.82751464843.99106121063230.0000000.00000087.337799072266, -);
    
LaTollObject[3] = CreateDynamicObject96867.116600036621, -1536.82189941414.75045490264890.000000, -90.00000087.337799072266, -);
    
CreateDynamicObject97352.9794921875, -1531.92529296885.0904889106750.0000000.000000352.06005859375, -);
    
CreateDynamicObject97349.042072296143, -1531.50659179695.17586946487430.0000000.000000352.05688476563, -);
    
CreateDynamicObject99768.289916992188, -1546.60205078134.06264114379880.0000000.000000119.09942626953, -);
    
CreateDynamicObject99734.5198097229, -1516.14025878914.06264114379880.0000000.000000292.50622558594, -);
    
CreateDynamicObject99735.903915405273, -1525.87170410164.06264114379880.0000000.000000342.13012695313, -);
    
CreateDynamicObject99763.914081573486, -1535.71264648444.06264114379880.0000000.000000342.130859375, -);
    
/* End of Flint */

    /* LV */
    
CreateDynamicObject81681789.83203125703.18945312515.8463678359990.000000399.24951171875, -);
    
CreateDynamicObject81681784.8334960938703.9479980468816.0706367492680.000000357278.61096191406, -);
    
CreateDynamicObject9661781.4122314453697.3253173828114.6369132995610.0000000.000000348.09008789063, -);
    
CreateDynamicObject9961767.3087158203700.5050659179715.2815675735470.0000000.000000346.10510253906, -);
    
CreateDynamicObject9971781.6832275391697.3479614257814.6987810134890.000000377.41455078125, -);
    
CreateDynamicObject9971792.7745361328706.3854370117213.9487810134890.0000002.99926757812581.379638671875, -);
    
CreateDynamicObject9661793.4289550781709.8798217773413.6369132995610.0000000.000000169.43664550781, -);
    
CreateDynamicObject9961800.8060302734708.3829956054714.2815675735470.0000000.000000346.10229492188, -);
    
LaTollObject[4] = CreateDynamicObject9681781.4133300781697.3175048828115.4200239181520.000000, -90.000000348.10229492188, -);
    
LaTollObject[5] = CreateDynamicObject9681793.6700439453709.8463134765614.4057188034060.000000, -90.000000169.43664550781, -);
    
/* End of LV */
    
    /* Blueberry right */
    
CreateDynamicObject(966614.42188350.8171117.92480,   0.000000.0000035.00000);
    
CreateDynamicObject(966602.91162342.5978117.92480,   0.000000.00000215.92000);
    
LaTollObject[6] = CreateDynamicObject(968614.42188350.8171118.66520,   0.00000, -90.0000035.00000);
    
LaTollObject[7] = CreateDynamicObject(968602.91162342.5978118.66520,   0.00000, -90.00000215.92000);
    
/* Blueberry right */
    
    /* Blueberry left */
    
CreateDynamicObject(966, -190.35580254.6429011.07090,   0.000000.00000345.00000);
    
CreateDynamicObject(966, -204.00880258.3041111.07090,   0.000000.00000, -195.00000);
    
LaTollObject[8] = CreateDynamicObject(968, -190.24850254.6201911.89360,   0.00000, -90.00000, -14.94000);
    
LaTollObject[9] = CreateDynamicObject(968, -204.10410258.3414911.89360,   0.00000, -90.00000, -195.00000);
    
/* Blueberry right */
}
Toll_CloseToll(TollID)
{
    if(
TollID == RichmanToll)
    {
        
SetDynamicObjectRot(LaTollObject[0], 0.000000, -90.00000023.81982421875);
        
SetDynamicObjectRot(L_a_TollObject[1], 0.000000, -90.000000214.37744140625);
    }
    else if(
TollID == FlintToll)
    {
        
SetDynamicObjectRot(LaTollObject[2], 0.000000, -90.000000270.67565917969);
        
SetDynamicObjectRot(LaTollObject[3], 0.000000, -90.00000087.337799072266);
    }
    else if(
TollID == LVToll)
    {
        
SetDynamicObjectRot(LaTollObject[4], 0.000000, -90.000000348.10229492188);
        
SetDynamicObjectRot(LaTollObject[5], 0.000000, -90.000000169.43664550781);
    }
    else if(
TollID == BlueberryTollR)
    {
        
SetDynamicObjectRot(LaTollObject[6], 0.00000, -90.0000035.00000);
        
SetDynamicObjectRot(LaTollObject[7], 0.00000, -90.00000215.92000);
    }
    else if(
TollID == BlueberryTollL)
    {
        
SetDynamicObjectRot(LaTollObject[8], 0.00000, -90.00000, -14.94000);
        
SetDynamicObjectRot(LaTollObject[9], 0.00000, -90.00000, -195.00000);
    }
    return 
1;
}

Toll_OpenToll(TollID)
{
    if(
TollID == RichmanToll)
    {
        
aTolls[RichmanToll][E_tOpenTime] = 7;
        
SetDynamicObjectRot(L_a_TollObject[0], 0.0000000.00000023.81982421875);
        
SetDynamicObjectRot(L_a_TollObject[1], 0.0000000.000000214.37744140625);
    }
    else if(
TollID == FlintToll)
    {
        
aTolls[FlintToll][E_tOpenTime] = 7;
        
SetDynamicObjectRot(L_a_TollObject[2], 0.0000000.000000270.67565917969);
        
SetDynamicObjectRot(L_a_TollObject[3], 0.0000000.00000087.337799072266);
    }
    else if(
TollID == LVToll)
    {
        
aTolls[LVToll][E_tOpenTime] = 7;
        
SetDynamicObjectRot(L_a_TollObject[4], 0.0000000.000000348.10229492188);
        
SetDynamicObjectRot(L_a_TollObject[5], 0.0000000.000000169.43664550781);
    }
    else if(
TollID == BlueberryTollR)
    {
        
aTolls[BlueberryTollR][E_tOpenTime] = 7;
        
SetDynamicObjectRot(L_a_TollObject[6], 0.0000000.00000035.00000);
        
SetDynamicObjectRot(L_a_TollObject[7], 0.0000000.000000215.92000);
    }
    else if(
TollID == BlueberryTollL)
    {
        
aTolls[BlueberryTollL][E_tOpenTime] = 7;
        
SetDynamicObjectRot(L_a_TollObject[8], 0.0000000.000000, -14.94000);
        
SetDynamicObjectRot(L_a_TollObject[9], 0.0000000.000000, -195.00000);
    }
}

Toll_TimePassedCivil(TollIDplayerid// People have to wait <TollDelayCivilian> seconds between every /opentoll on the same toll
{
    if(
aTolls[TollID][E_tOpenTime] > 0)
    {
        
SCM(playeridCOLOR_LIGHTRED"The barrier is already open, wait for it to close before you pay.");
        return 
0;
    }
    return 
1;
}

Toll_TimePassedCops(playerid// Cops have to wait for <TollDelayCop> seconds between every /toll (Global)
{
    new 
L_i_tick GetUnixTime();
    if(
L_a_RequestAllowedCop L_i_tick && L_a_RequestAllowedCop != 0)
    {
        new 
TollString[63];
        
format(TollString63"You need to wait at least %d seconds between each toll change."TollDelayCop);
        
SCM(playeridCOLOR_LIGHTREDTollString);
        return 
0;
    }
    
L_a_RequestAllowedCop = (L_i_tick TollDelayCop);
    return 
1;
}
CMD:toll(playeridparams[])
{
    new 
string[128];
    if(
PlayerInfo[playerid][pMember] == && PlayerInfo[playerid][pRank] < && PlayerInfo[playerid][pDispatch] == 1) return SendClientMessageEx(playeridCOLOR_GRAD1"You are not authorized to use this command!");
    
        new 
employer[16], rank[64], division[16];
    switch (
PlayerInfo[playerid][pMember]) // employer/rank/division data is pulled from here
    
{
    case 
1:
        {
            
employer "LSPD";
            switch(
PlayerInfo[playerid][pRank])
            {
                case 
1rank "Officer (I)";
                case 
2rank "Officer (II)";
                case 
3rank "Sergeant";
                case 
4rank "Lieutenant";
                case 
5rank "Captain";
                case 
6rank "Commander";
                case 
7rank "Deputy Chief";
                case 
8rank "Chief";
                default: 
rank "Cadet";
            }
            switch(
PlayerInfo[playerid][pDivision])
            {
                case 
1division "Patrol";
                case 
2division "CIB";
                case 
3division "FTO";
                case 
4division "SPEC";
                case 
5division "SWAT";
                case 
6division "TRAFFIC";
                default: 
division "General Duties";
            }
        }
    case 
6:
        {
                
employer "LS County";
                if(
PlayerInfo[playerid][pDivision] == || PlayerInfo[playerid][pDivision] == 0)
                {
                    switch(
PlayerInfo[playerid][pRank])
                    {
                        case 
1rank "Representative";
                        case 
2rank "Council Member";
                        case 
3rank "Council Chairman";
                        case 
4rank "Senate";
                        case 
5rank "Deputy Mayor";
                        case 
6rank "Mayor";
                        default: 
rank "Intern";
                    }
                }
                else if(
PlayerInfo[playerid][pDivision] == 2)
                {
                    switch(
PlayerInfo[playerid][pRank])
                    {
                    case 
1rank "Senior Driver";
                    case 
2rank "Agent";
                    case 
3rank "Senior Agent";
                    case 
4rank "Shift Agent";
                    case 
5rank "Executive Agent";
                    case 
6rank "Head Agent";
                    default: 
rank "Driver";
                    }
                }
                else if(
PlayerInfo[playerid][pDivision] == 3)
                {
                    switch(
PlayerInfo[playerid][pRank])
                    {
                    case 
1rank "Intern";
                    case 
2rank "Forklift Operator";
                    case 
3rank "Weapons Specialist";
                    case 
4rank "Senior Specialist";
                    case 
5rank "Supervisor of Production";
                    case 
6rank "Chairman of Production";
                    default: 
rank "Intern";
                    }
                }
                switch(
PlayerInfo[playerid][pDivision])
                {
                case 
1division "";
                case 
2division "SS";
                case 
3division "MANU";
                default: 
division "";
                }
        }
     case 
7:
        {
            
employer "SASD";
            switch(
PlayerInfo[playerid][pRank])
            {
            case 
1rank "Deputy";
            case 
2rank "Deputy (II)";
            case 
3rank "Sergeant";
            case 
4rank "Lieutenant";
            case 
5rank "Captain";
            case 
6rank "Commander";
            case 
7rank "Undersheriff";
            case 
8rank "Sheriff";
            default: 
rank "Cadet";
            }
            switch(
PlayerInfo[playerid][pDivision])
            {
            case 
1division "(Patrol) ";
            case 
2division "(CIB) ";
            case 
3division "(Traffic) ";
            case 
4division "(Tactical) ";
            case 
5division "(HVE) ";
            default: 
division "";
            }
        }
    default:
        {
            
SendClientMessageEx(playerid,COLOR_GRAD2,"You're not in a faction.");
            return 
1;
        }
    }
    
    new 
option[11];
    if(
sscanf(params,"s[11]",option))
    {
        
SendClientMessage(playeridCOLOR_YELLOW"Toll barrier command central for Los Santos");
        
SendClientMessage(playeridCOLOR_GRAD2"emergency/release - (Un)Locks all the barriers.");
        
SendClientMessage(playeridCOLOR_GRAD2"flint - (Un)locks flint tolls.");
        
SendClientMessage(playeridCOLOR_GRAD2"richman - (Un)locks Richman tunnel tolls.");
        
SendClientMessage(playeridCOLOR_GRAD2"lv - (Un)locks the Las Venturas Highway tolls.");
        
SendClientMessage(playeridCOLOR_GRAD2"blueberryr - (Un)locks the BlueBerry Right tolls.");
        
SendClientMessage(playeridCOLOR_GRAD2"blueberryl - (Un)locks the BlueBerry Left tolls.");
        return 
1;
    }
    if(!
Toll_TimePassedCops(playerid))
        return 
1;
    if(
CompareStrings(option"emergency"))
    {
        
aTolls[FlintToll][E_tLocked] = 1;
        
aTolls[RichmanToll][E_tLocked] = 1;
        
aTolls[LVToll][E_tLocked] = 1;
        
aTolls[BlueberryTollR][E_tLocked] = 1;
        
aTolls[BlueberryTollL][E_tLocked] = 1;

        
Toll_CloseToll(FlintToll);
        
Toll_CloseToll(RichmanToll);
        
Toll_CloseToll(LVToll);
        
Toll_CloseToll(BlueberryTollR);
        
Toll_CloseToll(BlueberryTollL);

        
format(stringsizeof(string), "** HQ Announcement: All toll booths were LOCKED by %s %s of the %s ! **"rankGetPlayerNameEx(playerid),employer);
        
SendRadioMessage(1COLOR_LIGHTREDstring);
    }
    if(
CompareStrings(option"release"))
    {
        
aTolls[FlintToll][E_tLocked] = 0;
        
aTolls[RichmanToll][E_tLocked] = 0;
        
aTolls[LVToll][E_tLocked] = 0;
        
aTolls[BlueberryTollR][E_tLocked] = 0;
        
aTolls[BlueberryTollL][E_tLocked] = 0;
        
format(stringsizeof(string), "** HQ Announcement: All toll booths were UNLOCKED by %s %s of the %s ! **"rankGetPlayerNameEx(playerid),employer);
        
SendRadioMessage(1COLOR_LIGHTREDstring);
    }
    if(
CompareStrings(option"flint"))
    {
        if(
aTolls[FlintToll][E_tLocked] == 0)
        {
            
aTolls[FlintToll][E_tLocked] = 1;
            
Toll_CloseToll(FlintToll);
            
format(stringsizeof(string), "** HQ Announcement: Toll booths at Flint County were LOCKED by %s %s of the %s . **"rankGetPlayerNameEx(playerid),employer);
            
SendRadioMessage(1COLOR_LIGHTREDstring);
        }
        else
        {
            
aTolls[FlintToll][E_tLocked] = 0;
            
format(stringsizeof(string), "** HQ Announcement: Toll booths at Flint County were UNLOCKED by %s %s of the %s . **"rankGetPlayerNameEx(playerid),employer);
            
SendRadioMessage(1COLOR_LIGHTREDstring);
        }
    }
    if(
CompareStrings(option"richman"))
    {
        if(
aTolls[RichmanToll][E_tLocked] == 0)
        {
            
aTolls[RichmanToll][E_tLocked] = 1;
            
Toll_CloseToll(RichmanToll);
            
format(stringsizeof(string), "** HQ Announcement: Toll booths at Richman were LOCKED by %s %s of the %s . **"rankGetPlayerNameEx(playerid),employer);
            
SendRadioMessage(1COLOR_LIGHTREDstring);
        }
        else
        {
            
aTolls[RichmanToll][E_tLocked] = 0;
            
format(stringsizeof(string), "** HQ Announcement: Toll booths at Richman were UNLOCKED by %s %s of the %s . **"rankGetPlayerNameEx(playerid),employer);
            
SendRadioMessage(1COLOR_LIGHTREDstring);
        }
    }
    if(
CompareStrings(option"lv"))
    {
        if(
aTolls[LVToll][E_tLocked] == 0)
        {
            
aTolls[LVToll][E_tLocked] = 1;
            
Toll_CloseToll(LVToll);
            
format(stringsizeof(string), "** HQ Announcement: Toll booths at Las Venturas were LOCKED by %s %s of the %s . **"rankGetPlayerNameEx(playerid),employer);
            
SendRadioMessage(1COLOR_LIGHTREDstring);
        }
        else
        {
            
aTolls[LVToll][E_tLocked] = 0;
            
format(stringsizeof(string), "** HQ Announcement: Toll booths at Las Venturas were UNLOCKED by %s %s of the %s . **"rankGetPlayerNameEx(playerid),employer);
            
SendRadioMessage(1COLOR_LIGHTREDstring);
        }
    }
    if(
CompareStrings(option"blueberryr"))
    {
        if(
aTolls[BlueberryTollR][E_tLocked] == 0)
        {
            
aTolls[BlueberryTollR][E_tLocked] = 1;
            
Toll_CloseToll(BlueberryTollR);
            
format(stringsizeof(string), "** HQ Announcement: Toll booths at Blue Berry Right were LOCKED by %s %s of the %s . **"rankGetPlayerNameEx(playerid),employer);
            
SendRadioMessage(1COLOR_LIGHTREDstring);
        }
        else
        {
            
aTolls[BlueberryTollR][E_tLocked] = 0;
            
format(stringsizeof(string), "** HQ Announcement: Toll booths at Blue Berry Right were UNLOCKED by %s %s of the %s . **"rankGetPlayerNameEx(playerid),employer);
            
SendRadioMessage(1COLOR_LIGHTREDstring);
        }
    }
    if(
CompareStrings(option"blueberryl"))
    {
        if(
aTolls[BlueberryTollL][E_tLocked] == 0)
        {
            
aTolls[BlueberryTollL][E_tLocked] = 1;
            
Toll_CloseToll(BlueberryTollL);
            
format(stringsizeof(string), "** HQ Announcement: Toll booths at Blue Berry Left were LOCKED by %s %s of the %s . **"rankGetPlayerNameEx(playerid),employer);
            
SendRadioMessage(1COLOR_LIGHTREDstring);
        }
        else
        {
            
aTolls[BlueberryTollL][E_tLocked] = 0;
            
format(stringsizeof(string), "** HQ Announcement: Toll booths at Blue Berry Left were UNLOCKED by %s %s of the %s . **"rankGetPlayerNameEx(playerid),employer);
            
SendRadioMessage(1COLOR_LIGHTREDstring);
        }
    }
    return 
1;
}
CMD:opentoll(playeridparams[])
{
     new 
L_i_TollID;
    if(
IsPlayerInRangeOfPoint(playeridTollOpenDistance623.9500, -1183.977419.2260) || IsPlayerInRangeOfPoint(playerid10.0607.9684, -1194.286619.0043)) // Richman tolls
    
{
        
L_i_TollID RichmanToll;
    }
    else if(
IsPlayerInRangeOfPoint(playeridTollOpenDistance39.7039, -1522.98915.1995) || IsPlayerInRangeOfPoint(playerid10.062.7378, -1539.98915.0639)) // Flint tolls
    
{
        
L_i_TollID FlintToll;
    }
    else if(
IsPlayerInRangeOfPoint(playeridTollOpenDistance1795.9447704.255015.0006) || IsPlayerInRangeOfPoint(playerid10.01778.9886702.672815.2574)) // LV tolls
    
{
        
L_i_TollID LVToll;
    }
    else if(
IsPlayerInRangeOfPoint(playeridTollOpenDistance612.53070346.5959217.92614) || IsPlayerInRangeOfPoint(playerid10.0604.37152346.8814117.92614)) // LV tolls
    
{
        
L_i_TollID BlueberryTollR;
    }
    else if(
IsPlayerInRangeOfPoint(playeridTollOpenDistance, -195.2768,252.2416,12.0781) || IsPlayerInRangeOfPoint(playerid10.0, -199.5153,260.3405,12.0781)) // LV tolls
    
{
        
L_i_TollID BlueberryTollL;
    }
    else
    {
        
SendClientMessage(playeridCOLOR_LIGHTRED"You are not close enough to a toll booth.");
        return 
1;
    }
    if(!
Toll_TimePassedCivil(L_i_TollIDplayerid))
        return 
1;
    new 
string[128];
    if(!
CopDuty{playerid})
    {
        if(
aTolls[L_i_TollID][E_tLocked]) // If it's locked
        
{
            
ProxDetectorP(20.0playeridL_sz_TollStringLockedCOLOR_FADE1COLOR_FADE2COLOR_FADE3COLOR_FADE4COLOR_FADE5);
            return 
1;
        }
        if(
GetCash(playerid) < TollCost)
        {
            
SendClientMessage(playeridCOLOR_REDL_sz_TollStringNoMoney);
            return 
1;
        }
        
format(stringsizeof(string), "%s paid %d$ to the toll guard."GetPlayerNameEx(playerid), TollCost);
        
GiveCash(playerid, -TollCost);
        
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    }
    
ProxDetectorP(20.0playeridL_sz_TollStringByeCOLOR_FADE1COLOR_FADE2COLOR_FADE3COLOR_FADE4COLOR_FADE5);
    
SendClientMessage(playeridCOLOR_LIGHTREDL_sz_TollStringHurryUp);
    
Toll_OpenToll(L_i_TollID);
    return 
1;

Reply
#7

I understood what the code does, the tool opens and sets aTolls[][E_tOpenTime] to seven (I assume that is seconds), then after seven seconds the tool should close; however there are some issues with that.

pawn Код:
aTolls[i][E_tOpenTime];
at OnPlayerUpdate makes no sense, because there are no operations being done to the variable.

Also, as I already said, OnPlayerUpdate gets called a ton of times per second, if you put that code under OnPlayerUpdate (assuming you fix it) then the tool will be open for seven OnPlayerUpdate ticks which means less than 1/3 of a second at most.

You need to use a 7s timer to close the tool

-------

As for your errors, you need to create the enum where the toll info is held:
PHP код:
enum Tolls
{
      
E_tOpenTime,
      
E_tLocked
}      
new 
aTolls[MAX_TOLLS][Tolls]; 
Reply
#8

Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)