SA-MP Forums Archive
2 Vehicle File Errors. Please help! [array index out of bounds] - 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: 2 Vehicle File Errors. Please help! [array index out of bounds] (/showthread.php?tid=154884)



2 Vehicle File Errors. Please help! [array index out of bounds] - zombie13333 - 16.06.2010

[color=red][b][u]Status :: Still Need Help !!



In my script I was programming in 0.2.2 Now that there is 0.3 I transfered. Now when I compile I Get Two errors.

Code:
C:\Program Files (x86)\Rockstar Games\GTA San Andreas\SAMP\gamemodes\ZombieLSRP.pwn(2522) : error 032: array index out of bounds (variable "File_VehicleOwner")
C:\Program Files (x86)\Rockstar Games\GTA San Andreas\SAMP\gamemodes\ZombieLSRP.pwn(2523) : error 032: array index out of bounds (variable "File_VehicleOwner")
C:\Program Files (x86)\Rockstar Games\GTA San Andreas\SAMP\gamemodes\ZombieLSRP.pwn(3319) : warning 203: symbol is never used: "AddCandyMachine"
C:\Program Files (x86)\Rockstar Games\GTA San Andreas\SAMP\gamemodes\ZombieLSRP.pwn(3319) : warning 203: symbol is never used: "AddSprunkMachine"
C:\Program Files (x86)\Rockstar Games\GTA San Andreas\SAMP\gamemodes\ZombieLSRP.pwn(3319) : warning 203: symbol is never used: "KillVeh"
Normally, I get the last three warnings, and it compiles fine. What do I need to change to make it compatible with 0.3?

Here Is What I Have For The Script::

Code:
	
  		       new File_VehicleOwner[256];
			File_VehicleOwner = dini_Get(VehicleFile, "Owner");		
if (GetPlayerName(playerid, name, MAX_PLAYER_NAME) == File_VehicleOwner[MAX_PLAYERS]) { IsVehicleOwnerInCar[playerid] = 1; }
else if (GetPlayerName(playerid, name, MAX_PLAYER_NAME) == File_VehicleOwner[MAX_PLAYERS] ) { IsVehicleOwnerInCar[playerid] = 0; }
Thank you!


Note :: Before I updated, I never got those two errors.


Re: SA:MP 0.3 Version Pawno Compilation. 2 Errors!? - Antonio [G-RP] - 16.06.2010

remove OnPlayerPrivmsg and OnPlayerInfoChange, as they are removed in 0.3a, as for the redefinition, delete that line from your MAIN GM (MAX_PICKUPS)


Re: SA:MP 0.3 Version Pawno Compilation. 2 Errors!? - zombie13333 - 16.06.2010

I don't have MAX_PICKUPS anywhere on the main GM. What should I do? Also, I still need help with the two errors someone. Thanks!


Re: SA:MP 0.3 Version Pawno Compilation. 2 Errors!? - Antonio [G-RP] - 16.06.2010

Then look in that include, most likely 2 times defined.


Re: SA:MP 0.3 Version Pawno Compilation. 2 Errors!? - zombie13333 - 16.06.2010

EDIT::: I figured out the warning. I had to remove it from a_samp. It had the definition.
Anyway, so what about the two errors. And thanks for helping!


Re: SA:MP 0.3 Version Pawno Compilation. 2 Errors!? - Antonio [G-RP] - 16.06.2010

Simply, remove #define MAX_PICKUPS 400


Re: SA:MP 0.3 Version Pawno Compilation. 2 Errors!? - zombie13333 - 16.06.2010

I figured out the warning. I had to remove it from a_samp. It had the definition.
Anyway, so what about the two errors. And thanks for helping!

The two Errors are the main problems.


Re: 2 Vehicle File Errors. Please help! [array index out of bounds] - zombie13333 - 16.06.2010

Sorry for double post, but I can't seem to figure it out.

Someone, please help?


Re: 2 Vehicle File Errors. Please help! [array index out of bounds] - (SF)Noobanatior - 16.06.2010

im guessing its these

Code:
if (GetPlayerName(playerid, name, MAX_PLAYER_NAME) == File_VehicleOwner[MAX_PLAYERS]) { IsVehicleOwnerInCar[playerid] = 1; }
else if (GetPlayerName(playerid, name, MAX_PLAYER_NAME) == File_VehicleOwner[MAX_PLAYERS] ) { IsVehicleOwnerInCar[playerid] = 0; }
== File_VehicleOwner[MAX_PLAYERS] is out of bounds

there MAX_PLAYERS should be playerid at a guess