Vehicle Ownership Error
#1

So I place this code under public OnGameModeInit

pawn Код:
LoadCar();
    new string2[64];
    for(new h = 1; h < sizeof(CarInfo); h++)
    {
        format(string2, sizeof(string2), "Vehicles/%d.ini",h);
        if(dini_Exists(string2))
        {
            ownedcar[h] = AddStaticVehicleEx(CarInfo[h][cModel],CarInfo[h][cLocationx],CarInfo[h][cLocationy],CarInfo[h][cLocationz]+1.0,CarInfo[h][cAngle],CarInfo[h][cColorOne],CarInfo[h][cColorTwo],60000);
            if(CarInfo[h][cPaintjob] != 999)
            {
                ChangeVehiclePaintjob(h, CarInfo[h][cPaintjob]);
            }
            SetVehicleVirtualWorld(h, CarInfo[h][cVirWorld]);
            SetVehicleModifications(h);
        }
    }
When I try to compile the script, I get these errors.

Код:
C:\DOCUME~1\DISTUR~1\Desktop\PROJEC~1\GAMEMO~1\pgg.pwn(15490) : warning 235: public function lacks forward declaration (symbol "LoadCar")
C:\DOCUME~1\DISTUR~1\Desktop\PROJEC~1\GAMEMO~1\pgg.pwn(15496) : error 001: expected token: ";", but found "if"
C:\DOCUME~1\DISTUR~1\Desktop\PROJEC~1\GAMEMO~1\pgg.pwn(15772) : error 017: undefined symbol "ownedcar"
C:\DOCUME~1\DISTUR~1\Desktop\PROJEC~1\GAMEMO~1\pgg.pwn(15772) : warning 215: expression has no effect
C:\DOCUME~1\DISTUR~1\Desktop\PROJEC~1\GAMEMO~1\pgg.pwn(15772) : error 001: expected token: ";", but found "]"
C:\DOCUME~1\DISTUR~1\Desktop\PROJEC~1\GAMEMO~1\pgg.pwn(15772) : error 029: invalid expression, assumed zero
C:\DOCUME~1\DISTUR~1\Desktop\PROJEC~1\GAMEMO~1\pgg.pwn(15772) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
This is line 15772

pawn Код:
ownedcar[h] = AddStaticVehicleEx(CarInfo[h][cModel],CarInfo[h][cLocationx],CarInfo[h][cLocationy],CarInfo[h][cLocationz]+1.0,CarInfo[h][cAngle],CarInfo[h][cColorOne],CarInfo[h][cColorTwo],60000);
Any help would be greatly appreciated.
Thanks in advanced.
Reply
#2

That coding does not get placed under anything at all make it anywhere in the script not under any functions and it says Lacks forward so at the top of your script somewhere

pawn Код:
forward LoadCar();
Reply
#3

Wow, I had that commented lol.

Thanks.
Reply
#4

Is it working now?
Reply
#5

You need to forward it, and there's no need to add it under any line, As PhoenixB said, If its giving more errors, Post the error lines please.
Reply
#6

Well that part is, lol.

Trying to make a vehicle ownership system and errors keep piling up but yea that worked, thanks guy, I knew had to had to forward it, cause like I know I had it forwarded just it was commented.

Thanks.

Here is the next error.

pawn Код:
public LoadCar()
{
    new file[26];
    for(new idx = 1; idx < sizeof(CarInfo) ; idx++)
    {
        format(file, sizeof(file),"Vehicles/%d.ini", idx)
        if(dini_Exists(file))
        {
            CarInfo[idx][cModel] = dini_Int(file,"Model");
            CarInfo[idx][cLocationx] = dini_Float(file,"Location_X");
            CarInfo[idx][cLocationy] = dini_Float(file,"Location_Y");
            CarInfo[idx][cLocationz] = dini_Float(file,"Location_Z");
            CarInfo[idx][cAngle] = dini_Float(file,"Angle");
            CarInfo[idx][cColorOne] = dini_Int(file,"Color_1");
            CarInfo[idx][cColorTwo] = dini_Int(file,"Color_2");
            strmid(CarInfo[idx][cOwner], dini_Get(file,"Owner"), 0, strlen(dini_Get(file,"Owner")), 255);
            CarInfo[idx][cOwned] = dini_Int(file,"Owned");
            CarInfo[idx][cLock] = dini_Int(file,"Locked");
            CarInfo[idx][cPaintjob] = dini_Int(file,"Paintjob");
            CarInfo[idx][cVirWorld] = dini_Int(file,"VirtualWorld");
            CarInfo[idx][cComponent0] = dini_Int(file,"Component0");
            CarInfo[idx][cComponent1] = dini_Int(file,"Component1");
            CarInfo[idx][cComponent2] = dini_Int(file,"Component2");
            CarInfo[idx][cComponent3] = dini_Int(file,"Component3");
            CarInfo[idx][cComponent4] = dini_Int(file,"Component4");
            CarInfo[idx][cComponent5] = dini_Int(file,"Component5");
            CarInfo[idx][cComponent6] = dini_Int(file,"Component6");
            CarInfo[idx][cComponent7] = dini_Int(file,"Component7");
            CarInfo[idx][cComponent8] = dini_Int(file,"Component8");
            CarInfo[idx][cComponent9] = dini_Int(file,"Component9");
            CarInfo[idx][cComponent10] = dini_Int(file,"Component10");
            CarInfo[idx][cComponent11] = dini_Int(file,"Component11");
            CarInfo[idx][cComponent12] = dini_Int(file,"Component12");
            CarInfo[idx][cComponent13] = dini_Int(file,"Component13");
        }
    }
    print("Loaded Cars Succesfully");
    return 1;
}
Error
Код:
C:\DOCUME~1\DISTUR~1\Desktop\PROJEC~1\GAMEMO~1\pgg.pwn(15654) : error 001: expected token: ";", but found "if"
Reply
#7

Quote:
Originally Posted by Disturbed-
Посмотреть сообщение
Well that part is, lol.

Trying to make a vehicle ownership system and errors keep piling up but yea that worked, thanks guy, I knew had to had to forward it, cause like I know I had it forwarded just it was commented.

Thanks.

Here is the next error.

pawn Код:
public LoadCar()
{
    new file[26];
    for(new idx = 1; idx < sizeof(CarInfo) ; idx++)
    {
        format(file, sizeof(file),"Vehicles/%d.ini", idx)
        if(dini_Exists(file))
        {
            CarInfo[idx][cModel] = dini_Int(file,"Model");
            CarInfo[idx][cLocationx] = dini_Float(file,"Location_X");
            CarInfo[idx][cLocationy] = dini_Float(file,"Location_Y");
            CarInfo[idx][cLocationz] = dini_Float(file,"Location_Z");
            CarInfo[idx][cAngle] = dini_Float(file,"Angle");
            CarInfo[idx][cColorOne] = dini_Int(file,"Color_1");
            CarInfo[idx][cColorTwo] = dini_Int(file,"Color_2");
            strmid(CarInfo[idx][cOwner], dini_Get(file,"Owner"), 0, strlen(dini_Get(file,"Owner")), 255);
            CarInfo[idx][cOwned] = dini_Int(file,"Owned");
            CarInfo[idx][cLock] = dini_Int(file,"Locked");
            CarInfo[idx][cPaintjob] = dini_Int(file,"Paintjob");
            CarInfo[idx][cVirWorld] = dini_Int(file,"VirtualWorld");
            CarInfo[idx][cComponent0] = dini_Int(file,"Component0");
            CarInfo[idx][cComponent1] = dini_Int(file,"Component1");
            CarInfo[idx][cComponent2] = dini_Int(file,"Component2");
            CarInfo[idx][cComponent3] = dini_Int(file,"Component3");
            CarInfo[idx][cComponent4] = dini_Int(file,"Component4");
            CarInfo[idx][cComponent5] = dini_Int(file,"Component5");
            CarInfo[idx][cComponent6] = dini_Int(file,"Component6");
            CarInfo[idx][cComponent7] = dini_Int(file,"Component7");
            CarInfo[idx][cComponent8] = dini_Int(file,"Component8");
            CarInfo[idx][cComponent9] = dini_Int(file,"Component9");
            CarInfo[idx][cComponent10] = dini_Int(file,"Component10");
            CarInfo[idx][cComponent11] = dini_Int(file,"Component11");
            CarInfo[idx][cComponent12] = dini_Int(file,"Component12");
            CarInfo[idx][cComponent13] = dini_Int(file,"Component13");
        }
    }
    print("Loaded Cars Succesfully");
    return 1;
}
Error
Код:
C:\DOCUME~1\DISTUR~1\Desktop\PROJEC~1\GAMEMO~1\lslrp.pwn(15654) : error 001: expected token: ";", but found "if"
Show me the line
Reply
#8

pawn Код:
if(dini_Exists(file))
Sorry about that :P
Reply
#9

Need to know which line mate. Post it here
Reply
#10

Posted it above.

pawn Код:
if(dini_Exists(file))
That's line 15654

I really see no reason for this error as I'm using dini, so it should work fine, I have the dini include in my include folder..
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)