Help With Error Codes
#1

I was compiling a lightly edited version of Rokzlive's Trucking Gamemode and recieved these errors:

Код:
C:\Users\keleyj\Desktop\SAMP SERVER\Server (Real)\gamemodes\public.pwn(357) : error 012: invalid function call, not a valid address
C:\Users\keleyj\Desktop\SAMP SERVER\Server (Real)\gamemodes\public.pwn(357) : error 001: expected token: ";", but found "sizeof"
C:\Users\keleyj\Desktop\SAMP SERVER\Server (Real)\gamemodes\public.pwn(357) : warning 215: expression has no effect
C:\Users\keleyj\Desktop\SAMP SERVER\Server (Real)\gamemodes\public.pwn(357) : error 001: expected token: ";", but found ")"
C:\Users\keleyj\Desktop\SAMP SERVER\Server (Real)\gamemodes\public.pwn(357) : fatal error 107: too many error messages on one line

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


4 Errors.
This is the line that is getting the error codes:
Код:
			new rand = rand(sizeof(TruckingMissionRandom));
These are the surrounding lines:
Код:
    if(!strcmp("/work", cmdtext, true))
	{
	    new pvehiclemodel = GetVehicleModel(GetPlayerVehicleID(playerid));
		if (pvehiclemodel == 403 || pvehiclemodel == 514 || pvehiclemodel == 515)
		{
		    new string[200];
			new rand = rand(sizeof(TruckingMissionRandom));
			CreatePlayerMission(playerid, TruckingMissionRandom[rand][UseTrailerCheck], TruckingMissionRandom[rand][MissionPay], TruckingMissionRandom[rand][loadx],TruckingMissionRandom[rand][loady], TruckingMissionRandom[rand][loadz], TruckingMissionRandom[rand][unloadx],TruckingMissionRandom[rand][unloady], TruckingMissionRandom[rand][unloadz]);
	        format(string, sizeof(string), "You are doing mission: %s", TruckingMissionRandom[rand][MissionName]);
			SendClientMessage(playerid, 0x00FF00FF, string);
		}
		else
If someone could please help me solve this problem.

Also, could someone make a topic with the most common error codes, what they mean and how to fix them? Alot of people like myself would benefit from this.

Thanks
Reply
#2

Show use where you define TruckingMissionRandom. And you can try to remove sizeof() but I cannot say if it work, because I didn't saw the TruckingMissionRandom creation.
Reply
#3

Quote:
Originally Posted by joshkeley
Посмотреть сообщение
I was compiling a lightly edited version of Rokzlive's Trucking Gamemode and recieved these errors:

Код:
C:\Users\keleyj\Desktop\SAMP SERVER\Server (Real)\gamemodes\public.pwn(357) : error 012: invalid function call, not a valid address
C:\Users\keleyj\Desktop\SAMP SERVER\Server (Real)\gamemodes\public.pwn(357) : error 001: expected token: ";", but found "sizeof"
C:\Users\keleyj\Desktop\SAMP SERVER\Server (Real)\gamemodes\public.pwn(357) : warning 215: expression has no effect
C:\Users\keleyj\Desktop\SAMP SERVER\Server (Real)\gamemodes\public.pwn(357) : error 001: expected token: ";", but found ")"
C:\Users\keleyj\Desktop\SAMP SERVER\Server (Real)\gamemodes\public.pwn(357) : fatal error 107: too many error messages on one line

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


4 Errors.
This is the line that is getting the error codes:
Код:
			new rand = rand(sizeof(TruckingMissionRandom));
These are the surrounding lines:
Код:
    if(!strcmp("/work", cmdtext, true))
	{
	    new pvehiclemodel = GetVehicleModel(GetPlayerVehicleID(playerid));
		if (pvehiclemodel == 403 || pvehiclemodel == 514 || pvehiclemodel == 515)
		{
		    new string[200];
			new rand = rand(sizeof(TruckingMissionRandom));
			CreatePlayerMission(playerid, TruckingMissionRandom[rand][UseTrailerCheck], TruckingMissionRandom[rand][MissionPay], TruckingMissionRandom[rand][loadx],TruckingMissionRandom[rand][loady], TruckingMissionRandom[rand][loadz], TruckingMissionRandom[rand][unloadx],TruckingMissionRandom[rand][unloady], TruckingMissionRandom[rand][unloadz]);
	        format(string, sizeof(string), "You are doing mission: %s", TruckingMissionRandom[rand][MissionName]);
			SendClientMessage(playerid, 0x00FF00FF, string);
		}
		else
If someone could please help me solve this problem.

Also, could someone make a topic with the most common error codes, what they mean and how to fix them? Alot of people like myself would benefit from this.

Thanks
Try

pawn Код:
if(!strcmp("/work", cmdtext, true))
    {
        new pvehiclemodel = GetVehicleModel(GetPlayerVehicleID(playerid));
        if (pvehiclemodel == 403 || pvehiclemodel == 514 || pvehiclemodel == 515)
        {
            new Rand = rand(sizeof(TruckingMissionRandom));
            CreatePlayerMission(playerid, TruckingMissionRandom[Rand][UseTrailerCheck], TruckingMissionRandom[Rand][MissionPay], TruckingMissionRandom[Rand][loadx],TruckingMissionRandom[Rand][loady], TruckingMissionRandom[Rand][loadz], TruckingMissionRandom[Rand][unloadx],TruckingMissionRandom[Rand][unloady], TruckingMissionRandom[Rand][unloadz]);
            new string[128];
            format(string, sizeof(string), "You are doing mission: %s", TruckingMissionRandom[rand][MissionName]);
            SendClientMessage(playerid, 0x00FF00FF, string);
        }
         else
Show your random TruckingMissionRandom creation.
Reply
#4

It's because TruckinMissionRandom uses a two dimensional array.
sizeof() won't work with that I think, not sure.
And shouldn't it be random() instead of rand()?
Reply
#5

Here is the TruckingMissionRandom creation:

Код:
new TruckingMissionRandom[][TruckingMissionInfo] =
{
	// {"Mission Text", UseTrailerCheck, MissionPay, loadx, loady, loadz, unloadx, unloady, unloadz}

	/* KEY:
	** "Mission Text" = The text the player will see when he/she is doing the mission!
	** UseTrailerCheck = Weather or not the mission requires you use a vehile that has a trailer. Ex: Roadtrain with an Artict1 trailer!
	** MissionPay = The amount the player will recive for doing there mission!
	** loadx, loady, and loadz = The loading coordinates of the loading checkpoint!
	** unloadx, unloadx, unloadx = The un-loading coordinates of the unloading checkpoint!
	*/

	{"Deliver Holy Water from LVA Freight Depot to LVA Church", true, 250, 1701.9475,940.5465,10.8203, 1496.2524,772.1427,10.8203},
	{"Deliver Junk Car Parts from LVA Freight Depot to Shody Ottos", true, 500, 1701.9475,940.5465,10.8203, 1727.6351,1812.1750,10.8203},
	{"Deliver Drills From LS Dock Warehouse 2 To Whetstone Mine", true, 9000, 2777.9772949219, -2455.0886230469, 13.285285949707, -1875.4030761719, -1688.1228027344, 21.399225234985},
	{"Deliver Top Secret Devices From Randolf Industrial Estate To Area 69", true, 5000, 1594.1290283203, 724.00372314453, 10.469537734985, 134.54122924805, 1945.7899169922, 19.001808166504},
	{"Deliver Boxes From LV Depot To SF Depot", true, 7500, 1723.5736083984, 979.20190429688, 10.469537734985, -2129.4470214844, -84.854187011719, 34.969539642334},
	{"Deliver Propellers From Ls Dock Warehouse 1 To Verdant Meadows", true, 8000,  2777.7497558594, -2417.4836425781, 13.285341262817, 377.30389404297, 2534.0485839844, 16.250215530396},
	{"Deliver Soldiers Mail From Area 69 To 5 Tree Logistics", true, 6500, 134.54122924805, 1945.7899169922, 19.001808166504, -493.13043212891, -514.57434082031, 25.167068481445},
	{"Deliver Used Plane Parts From 5 Tree Logistics To Las Venturas Airport", true, 8000, -493.13043212891, -514.57434082031, 25.167068481445, 1627.9038085938, 1611.8803710938, 20.285793304443},
	{"Deliver Oxygen Canisters From RS Haul To SF Air", true, 7000, -83.956573486328, -1126.0145263672, 0.73391342163086, -1447.4144287109, -437.23773193359, 5.5075283050537},
	{"Deliver ATC Radars From Verdant Meadows To San Fierro Airport", true, 8500, 377.30389404297, 2534.0485839844, 16.250215530396, -1447.4144287109, -437.23773193359, 5.5075283050537}
};
Reply
#6

not
pawn Код:
{"Deliver ATC Radars From Verdant Meadows To San Fierro Airport", true, 8500, 377.30389404297, 2534.0485839844, 16.250215530396, -1447.4144287109, -437.23773193359, 5.5075283050537}
};
but this
pawn Код:
{"Deliver ATC Radars From Verdant Meadows To San Fierro Airport", true, 8500, 377.30389404297, 2534.0485839844, 16.250215530396, -1447.4144287109, -437.23773193359, 5.5075283050537};
}
Reply
#7

Nope, still got error codes
Reply
#8

So no one is able to help me?? D:
Reply
#9

Skaizo's "solution" doesn't make any sense and neither does Roel's first statement. You can call sizeof() on the first set and on the second set

However, the function call is called RANDOM indeed https://sampwiki.blast.hk/wiki/Random
Reply
#10

Now I am getting this:

Код:
C:\Users\keleyj\Desktop\SAMP SERVER\Server (Real)\gamemodes\public.pwn(40) : error 029: invalid expression, assumed zero
C:\Users\keleyj\Desktop\SAMP SERVER\Server (Real)\gamemodes\public.pwn(40) : error 008: must be a constant expression; assumed zero
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Here are lines 30-40

Код:
	{"We need a load of Holy Water from LVA Freight Depot to LVA Church", true, 250, 1701.9475,940.5465,10.8203, 1496.2524,772.1427,10.8203},
	{"We need a load of Junk Car Parts from LVA Freight Depot to Shody Ottos", true, 500, 1701.9475,940.5465,10.8203, 1727.6351,1812.1750,10.8203},
	{"We need a load of Drills From LS Dock Warehouse 2 To Whetstone Mine", true, 9000, 2777.9772949219, -2455.0886230469, 13.285285949707, -1875.4030761719, -1688.1228027344, 21.399225234985},
	{"We need a load of Top Secret Devices From Randolf Industrial Estate To Area 69", true, 5000, 1594.1290283203, 724.00372314453, 10.469537734985, 134.54122924805, 1945.7899169922, 19.001808166504},
	{"We need a load of Boxes From LV Depot To SF Depot", true, 7500, 1723.5736083984, 979.20190429688, 10.469537734985, -2129.4470214844, -84.854187011719, 34.969539642334},
	{"We need a load of Propellers From Ls Dock Warehouse 1 To Verdant Meadows", true, 8000,  2777.7497558594, -2417.4836425781, 13.285341262817, 377.30389404297, 2534.0485839844, 16.250215530396},
	{"We need a load of Soldiers Mail From Area 69 To 5 Tree Logistics", true, 6500, 134.54122924805, 1945.7899169922, 19.001808166504, -493.13043212891, -514.57434082031, 25.167068481445},
	{"We need a load of Landing Gears From 5 Tree Logistics To Las Venturas Airport", true, 8000, -493.13043212891, -514.57434082031, 25.167068481445, 1627.9038085938, 1611.8803710938, 20.285793304443},
	{"We need a load of Oxegen Canisters From RS Haul To SF Air", true, 7000, -83.956573486328, -1126.0145263672, 0.73391342163086, -1447.4144287109, -437.23773193359, 5.5075283050537},
	{"We need a load of Radars From Verdant Meadows To San Fierro Airport", true, 8500, 377.30389404297, 2534.0485839844, 16.250215530396, -1447.4144287109, -437.23773193359, 5.5075283050537},
};
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)