Apartment system problem komanda /apartman


Započeo ivanboskic, Avgust 05, 2023, 14:06:43 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Problem(error/warning): Problem je oko par dialoga baca mi neke debugove u samp-server.exe
Deo skripte:
Dialog:dialog_apartment(playerid, response, listitem, string:inputtext[]) {
	if(!response) return 1;
	if(!player_ApartmentID[playerid]) return SendClientMessage(playerid, col_red, "error // "c_white"Nemate apartman!");
	new i = player_ApartmentID[playerid];
	switch(listitem) {
		case 0: {
			new string[128];
			format(string, sizeof(string), "-------------------\nVlasnik: %s\nNovac: %d$\nOruzje: %d\nMunicija : %d", apartmentOwner[i], apartmentMoney[i], apartmentWeapon[i], apartmentAmmo[i]);
			Dialog_Show(playerid, "dialog_apartmentinfo", DIALOG_STYLE_MSGBOX, "Apartment Info", string, "U redu", "");
		}
		case 1: {
			if(apartmentClosed[i] == 0) return SendClientMessage(playerid, col_red, "[Apartman]: "c_white"Vec je otkljucan apartman!");
			apartmentClosed[i] = 0; SaveApartment(i);
			SendClientMessage(playerid, col_srv, "[Apartman]: "c_white"Apartman otkljucan!");
		}
		case 2: {
			if(apartmentClosed[i] == 1) return SendClientMessage(playerid, col_red, "[Apartman]: "c_white"Vec je zakljucan apartman!");
			apartmentClosed[i] = 1; SaveApartment(i);
			SendClientMessage(playerid, col_srv, "[Apartman]: "c_white"Apartman zakljucan!");
		}
		case 3: {
			Dialog_Show(playerid, "apartment_leavingmoney", DIALOG_STYLE_INPUT, ""c_srv"Ostavljanje novca", ""c_white"Upisite kolicinu novca koju zelite ostaviti u vasem apartmanu", "Ostavi", "Izlaz");
		}
		case 4: {
			Dialog_Show(playerid, "apartment_takingmoney", DIALOG_STYLE_INPUT, ""c_srv"Uzimanje novca", ""c_white"Upisite kolicinu novca koju zelite uzeti iz vaseg apartmana", "Uzmi", "Izlaz");
		}
		case 5: {
			if(apartmentWeapon[i] != -1) return SendClientMessage(playerid, col_red, "[Apartman]: "c_white"Vec je imas oruzje u apartmanu!");
			if(GetPlayerWeapon(playerid) <= 0) return SendClientMessage(playerid, col_red, "error // "c_white"Nemas oruzje u ruci!");
			apartmentWeapon[i] = GetPlayerWeapon(playerid); apartmentAmmo[i] = GetPlayerAmmo(playerid);
			SendClientMessage(playerid, col_yellow, "Ostavili ste oruzje u vasem apartmanu!"); SaveApartment(i); SetPlayerAmmo(playerid, GetPlayerWeapon(playerid), 0);
		}
		case 6: {
			if(apartmentWeapon[i] == -1) return SendClientMessage(playerid, col_red, "[Apartman]: "c_white"Nemas oruzje u apartmanu!");
			GivePlayerWeapon(playerid, apartmentWeapon[i], apartmentAmmo[i]); apartmentWeapon[i] = -1; apartmentAmmo[i] = -1;
			SaveApartment(i); SendClientMessage(playerid, col_yellow, "Uzeli ste oruzje iz vaseg apartmana!");
		}
		case 7: {
			new string[60]; GivePlayerMoney(playerid, apartmentPrice[i]);
			apartmentOwned[i] = 0; apartmentMoney[i] = 0; apartmentWeapon[i] = -1; apartmentAmmo[i] = 0;
			strmid(apartmentOwner[i], "Drzava", 0, strlen("Drzava"), 24); player_ApartmentID[playerid] = -1; 
			SaveApartment(i); ApartmentLP(i);
			new INI:File = INI_Open(Account_Path(playerid));
		    INI_SetTag(File,"data");
		    INI_WriteInt(File, "ApartmentID", player_ApartmentID[playerid]);
		    INI_Close(File);
		    format(string, sizeof(string), ""c_yellow"Prodali ste apartman za "c_white"%d$!", apartmentPrice[i]);
		    SendClientMessage(playerid, -1, string);
		}
	}
	return 1;
}

YCMD:apartman(playerid, params[], help) {
	if(!player_ApartmentID[playerid]) return SendClientMessage(playerid, col_red, "error // "c_white"Nemate apartman!");
	Dialog_Show(playerid, "dialog_apartment", DIALOG_STYLE_LIST, ""c_srv"Apartman Informacije", ""c_white"Informacije\nOtkljucaj\nZakljucaj\nOstavi novac\nUzmi novac\nOstavi oruzje\nUzmi oruzje\nProdaj apartman", "Odaberi", "Izlaz");
	return 1;
}

Debug iz server_log(ukoliko je u pitanju crashanje servera - crashdetect log):
[13:19:07] [debug] Parameter count corrections:
[13:19:07] [debug]
[13:19:07] [debug] The 1st mangled argments (e.g. `<1073741823 arguments>`) below should read `<5 arguments>`
[13:19:07] [debug]
[13:19:07] [debug] Run time error 4: "Array index out of bounds"
[13:19:07] [debug]  Attempted to read/write array element at negative index -1
[13:19:07] [debug] AMX backtrace:
[13:19:07] [debug] #0 0005593c in public dialog_dialog_apartment (playerid=0, response=1, listitem=0, inputtext[]=@027ba564 "Informacije") at modules/aio/apartment.pwn:178
[13:19:07] [debug] #1 native CallLocalFunction () in samp-server.exe
[13:19:07] [debug] #2 000260c4 in @yH_OnDialogResponse@001 (playerid=0, dialogid=32700, response=1, listitem=0, inputtext[]=@027ba534 "Informacije") at C:\Users\Windows 10\Documents\SAMP Projects\zyn-roleplay-od-0\pawno\include\easyDialog.inc:70
[13:19:07] [debug] #3 00017868 in public OnDialogResponse (0, 32700, 1, 0, 41657652) at C:\Users\Windows 10\Documents\SAMP Projects\zyn-roleplay-od-0\pawno\include\ysilib\YSI_Coding\y_hooks\..\y_cgen\y_cgen.inc:133
[13:24:28] [debug]
[13:24:28] [debug] Parameter count corrections:
[13:24:28] [debug]
[13:24:28] [debug] The 1st mangled argments (e.g. `<1073741823 arguments>`) below should read `<5 arguments>`
[13:24:28] [debug]
[13:24:28] [debug] Run time error 4: "Array index out of bounds"
[13:24:28] [debug]  Attempted to read/write array element at negative index -1
[13:24:28] [debug] AMX backtrace:
[13:24:28] [debug] #0 0005593c in public dialog_dialog_apartment (playerid=0, response=1, listitem=0, inputtext[]=@027ba564 "Informacije") at modules/aio/apartment.pwn:178
[13:24:28] [debug] #1 native CallLocalFunction () in samp-server.exe
[13:24:28] [debug] #2 000260c4 in @yH_OnDialogResponse@001 (playerid=0, dialogid=32700, response=1, listitem=0, inputtext[]=@027ba534 "Informacije") at C:\Users\Windows 10\Documents\SAMP Projects\zyn-roleplay-od-0\pawno\include\easyDialog.inc:70
[13:24:28] [debug] #3 00017868 in public OnDialogResponse (0, 32700, 1, 0, 41657652) at C:\Users\Windows 10\Documents\SAMP Projects\zyn-roleplay-od-0\pawno\include\ysilib\YSI_Coding\y_hooks\..\y_cgen\y_cgen.inc:133
[13:24:36] [debug]
[13:24:36] [debug] Parameter count corrections:
[13:24:36] [debug]
[13:24:36] [debug] The 1st mangled argments (e.g. `<1073741823 arguments>`) below should read `<5 arguments>`
[13:24:36] [debug]
[13:24:36] [debug] Run time error 4: "Array index out of bounds"
[13:24:36] [debug]  Attempted to read/write array element at negative index -1
[13:24:36] [debug] AMX backtrace:
[13:24:36] [debug] #0 00055ac0 in public dialog_dialog_apartment (playerid=0, response=1, listitem=1, inputtext[]=@027ba55c "Otkljucaj") at modules/aio/apartment.pwn:182
[13:24:36] [debug] #1 native CallLocalFunction () in samp-server.exe
[13:24:36] [debug] #2 000260c4 in @yH_OnDialogResponse@001 (playerid=0, dialogid=32700, response=1, listitem=1, inputtext[]=@027ba534 "Otkljucaj") at C:\Users\Windows 10\Documents\SAMP Projects\zyn-roleplay-od-0\pawno\include\easyDialog.inc:70
[13:24:36] [debug] #3 00017868 in public OnDialogResponse (0, 32700, 1, 1, 41657652) at C:\Users\Windows 10\Documents\SAMP Projects\zyn-roleplay-od-0\pawno\include\ysilib\YSI_Coding\y_hooks\..\y_cgen\y_cgen.inc:133

Slika/video ingame problema(obavezno ako je ingame problem): /

Posalji gamemode DM, lakse mi nego da objasnjavam...