GarHouse HELP
#1

Код:
[22:22:53]+ [debug] Run time error 4: "Array index out of bounds"
[22:22:53]+ [debug]  Accessing element at negative index -1
[22:22:53]+ [debug] AMX backtrace:
[22:22:53]+ [debug] #0 000163b8 in INI_Close (INI:file=-1) at C:\Users\MaHdy\Desktop\SPA Server original\pawno\include\YSI\y_ini.inc:746
[22:22:53]+ [debug] #1 0002127c in public Itter_OnPlayerDisconnect (playerid=6, reason=1) at C:\Users\MaHdy\Desktop\SPA Server original\filterscripts\GarHouse.pwn:564
[22:22:53]+ [debug] #2 0001b8ec in public Streamer_OnPlayerDisconnect (playerid=6, reason=1) at C:\Users\MaHdy\Desktop\SPA Server original\pawno\include\YSI\y_iterate.inc:909
[22:22:53]+ [debug] #3 native CallLocalFunction () [080d2bb0] from samp03svr
[22:22:53]+ [debug] #4 0001a708 in ?? (... <2 arguments>) at C:\Users\MaHdy\Desktop\SPA Server original\pawno\include\streamer.inc:361
[22:22:53]+ [debug] #5 0000cbac in public SSCANF_OnPlayerDisconnect (playerid=6, reason=1) at C:\Users\MaHdy\Desktop\SPA Server original\pawno\include\YSI\y_hooks/impl.inc:661
[22:22:53]+ [debug] #6 00000528 in public OnPlayerDisconnect (playerid=6, reason=1) at C:\Users\MaHdy\Desktop\SPA Server original\pawno\include\sscanf2.inc:229
LINES CODE:
Код:
public OnPlayerDisconnect(playerid, reason)
{
	new year, month, day, lastvisited[20], lasthcp = GetPVarInt(playerid, "LastHouseCP");
	EndHouseRobbery(playerid);
    if(!strcmp(hInfo[lasthcp][HouseOwner], pNick(playerid), CASE_SENSETIVE) && IsInHouse{playerid} == 1 && fexist(HouseFile(lasthcp)))
	{
	    getdate(year, month, day);
	    format(lastvisited, sizeof(lastvisited), "%02d/%02d/%d", day, month, year);
	    new INI:file = INI_Open(HouseFile(lasthcp));
	    INI_WriteInt(file, "QuitInHouse", 1);
	    INI_WriteString(file, "LastVisited", lastvisited);
	    INI_Close(file);
	    #if GH_HOUSECARS == true
	    	SaveHouseCar(lasthcp);
	    	UnloadHouseCar(lasthcp);
        #endif
	}
	IsInHouse{playerid} = 0;
	return 1;
}
Reply
#2

In GarHouse.pwn at line 564, something is accessing array at index -1. Show us lines 540-580
Reply
#3

Quote:
Originally Posted by Misiur
Посмотреть сообщение
In GarHouse.pwn at line 564, something is accessing array at index -1. Show us lines 540-580
Please take alook again
Reply
#4

Exactly which line is 564 now?

@OP:

Well, you don't respond, but one of probable causes would be here
pawn Код:
hInfo[lasthcp][HouseOwner]
Check if lasthcp is not -1 before accessing it in strcmp.
Reply
#5

Quote:
Originally Posted by Misiur
Посмотреть сообщение
Exactly which line is 564 now?

@OP:

Well, you don't respond, but one of probable causes would be here
pawn Код:
hInfo[lasthcp][HouseOwner]
Check if lasthcp is not -1 before accessing it in strcmp.
Код:
SaveHouseCar(lasthcp);
this is the line thanks :P
Reply
#6

Well, that's a function call, and that means the reason lies within it's code.
Reply
#7

Quote:
Originally Posted by Misiur
Посмотреть сообщение
Well, that's a function call, and that means the reason lies within it's code.
What if i maked GH_HOUSECARS == false , they wont save car and check this line anyway right? , Another question if keep get this warnings from crashdetect server will may crash?

_________________
xXx Stunt Paradise Awesome

Server IP: Click Here!

Hosted Tab Game-MP for 10 Euro / per month
Hosted Tab + Server host 50 slots + Control Panel for 15 Euro
Skype: MahdiAsali
Ђ10 Euro for Hosted List
Reply
#8

For me it looks like GH_HOUSECARS indicates some bigger component. Somewhere near top of your script there should be
pawn Код:
#define GH_HOUSECARS
Comment that line, and you won't have house cars, but you won't have crashes as well.
Reply
#9

Quote:
Originally Posted by Misiur
Посмотреть сообщение
For me it looks like GH_HOUSECARS indicates some bigger component. Somewhere near top of your script there should be
pawn Код:
#define GH_HOUSECARS
Comment that line, and you won't have house cars, but you won't have crashes as well.
i'v already edited it " #define GH_HOUSECARS false " thanks +rep!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)