SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 09/12/2019, 02:48 PM   #1
MatusVietNam
Little Clucker
 
Join Date: Nov 2019
Posts: 44
Reputation: 0
Post [Help] Server Error :<

Can you help me with this?
Quote:
[debug] Run time error 4: "Array index out of bounds"
[debug] Attempted to read/write array element at index 16 in array of size 16
[debug] AMX backtrace:
[debug] #0 005e4c98 in public easyDialog_OnDialogResponse (0, 3910, 1, -1, 12218814 from OGRP.amx
[debug] #1 native CallLocalFunction () from samp-server.exe
[debug] #2 00019d10 in public OnDialogResponse (0, 3910, 1, -1, 122188136) from OGRP.amx

It appears right on the samp server when I execute the command in the server
MatusVietNam is offline   Reply With Quote
Old 09/12/2019, 03:08 PM   #2
coool
Gangsta
 
coool's Avatar
 
Join Date: Feb 2013
Location: Republic of Pakistan
Posts: 607
Reputation: 54
Default Re: [Help] Server Error :<

The error describes itself, you are trying to read index 16 from an array of size 16. Array indices start from 0, that means an array that can store 16 items actually has 15 indices..
Code:
#0 005e4c98 in public easyDialog_OnDialogResponse (0, 3910, 1, -1, 12218814
3910 is the dialog ID in which you have that problem
__________________
coool is offline   Reply With Quote
Old 09/12/2019, 03:24 PM   #3
MatusVietNam
Little Clucker
 
Join Date: Nov 2019
Posts: 44
Reputation: 0
Default Re: [Help] Server Error :<

Quote:
Originally Posted by coool View Post
The error describes itself, you are trying to read index 16 from an array of size 16. Array indices start from 0, that means an array that can store 16 items actually has 15 indices..
Code:
#0 005e4c98 in public easyDialog_OnDialogResponse (0, 3910, 1, -1, 12218814
3910 is the dialog ID in which you have that problem
Quote:
#define DIALOG_STOREPRICES (3900)
#define DIALOG_STOREITEMPRICE (3920)
#define DIALOG_STORECLOTHINGPRICE (3911)
#define DIALOG_GUNSHOPPRICE (3912)
#define DIALOG_BARPRICE (3913)
#define DIALOG_BARPRICE2 (3914)
#define DIALOG_SEXSHOP (3915)
#define DIALOG_SEXSHOP2 (3916)
#define DIALOG_GUNPRICES (3917)
#define DIALOG_RESTAURANT (391
#define DIALOG_RESTAURANT2 (3919)
DIALOG_STOREITEMPRICE (3910 ) I rather (3920)
is that ok?
MatusVietNam is offline   Reply With Quote
Old 09/12/2019, 03:31 PM   #4
coool
Gangsta
 
coool's Avatar
 
Join Date: Feb 2013
Location: Republic of Pakistan
Posts: 607
Reputation: 54
Default Re: [Help] Server Error :<

The problem is not dialogid, it is in the easy dialog function.
__________________
coool is offline   Reply With Quote
Old 09/12/2019, 03:33 PM   #5
MatusVietNam
Little Clucker
 
Join Date: Nov 2019
Posts: 44
Reputation: 0
Default Re: [Help] Server Error :<

So how do I fix it, can you state more clearly, because I'm poor
MatusVietNam is offline   Reply With Quote
Old 09/12/2019, 03:40 PM   #6
coool
Gangsta
 
coool's Avatar
 
Join Date: Feb 2013
Location: Republic of Pakistan
Posts: 607
Reputation: 54
Default Re: [Help] Server Error :<

Post the easy dialog function that has ID 'STOREITEMPRICE'
Code:
Dialog:STOREITEMPRICE(playerid, response, listitem, inputtext[])
{
    //Post what is inside this.
    return 1
}
__________________
coool is offline   Reply With Quote
Old 09/12/2019, 03:44 PM   #7
MatusVietNam
Little Clucker
 
Join Date: Nov 2019
Posts: 44
Reputation: 0
Default Re: [Help] Server Error :<

Quote:
else if(dialogid == DIALOG_STOREITEMPRICE)
{

if(PlayerInfo[playerid][pBusiness] != GetPVarInt(playerid, "EditingBusiness") || (GetPVarInt(playerid, "EditingBusiness") != InBusiness(playerid)) || PlayerInfo[playerid][pBusinessRank] != 5) {
DeletePVar(playerid, "EditingStoreItem");
DeletePVar(playerid, "EditingBusiness");
return 1;
}

new iBusiness = PlayerInfo[playerid][pBusiness];

if (response) {
new iPrice = strval(inputtext), item = GetPVarInt(playerid, "EditingStoreItem");

if (iPrice < 0 || iPrice > 500000) {
format(string, sizeof(string), "{FF0000}Error: {DDDDDD}Gia vuot qua pham vi{FFFFFF}\n\nNhap gia ban moi cho %s", StoreItems[item]);
ShowPlayerDialog(playerid, DIALOG_STOREITEMPRICE, DIALOG_STYLE_INPUT, "Sua gia", string, "Dong y", "Huy bo");
return 1;
}

format(string,sizeof(string), "%s da duoc thiet lap gia den $%s!", StoreItems[item], number_format(iPrice));
Businesses[iBusiness][bItemPrices][item] = iPrice;
SaveBusiness(iBusiness);
SendClientMessageEx(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "%s %s (IP: %s) da dat gia %s den $%s trong %s (%d)", GetBusinessRankName(PlayerInfo[playerid][pBusinessRank]), GetPlayerNameEx(playerid), GetPlayerIpEx(playerid), StoreItems[item], number_format(iPrice), Businesses[iBusiness][bName], iBusiness);
new szDialog[912];
for (new i = 0; i <= sizeof(StoreItems); i++) format(szDialog, sizeof(szDialog), "%s%s ($%s) (Gia co the ban: $%s)\n", szDialog, StoreItems[i], number_format(Businesses[iBusiness][bItemPrices][i]), number_format(floatround(StoreItemCost[i][ItemValue] * BUSINESS_ITEMS_COST)));
ShowPlayerDialog(playerid, DIALOG_STOREPRICES, DIALOG_STYLE_LIST, "Sua gia cua hang 24/7", szDialog, "Dong y", "Huy bo");
Log("logs/business.log", string);
}
DeletePVar(playerid, "EditingStoreItem");
return 1;
}
Here bro
MatusVietNam is offline   Reply With Quote
Old 09/12/2019, 03:46 PM   #8
MatusVietNam
Little Clucker
 
Join Date: Nov 2019
Posts: 44
Reputation: 0
Default Re: [Help] Server Error :<

I am Vietnamese, so all functions have Vietnamese
MatusVietNam is offline   Reply With Quote
Old 09/12/2019, 03:48 PM   #9
coool
Gangsta
 
coool's Avatar
 
Join Date: Feb 2013
Location: Republic of Pakistan
Posts: 607
Reputation: 54
Default Re: [Help] Server Error :<


Code:
else if(dialogid == DIALOG_STOREITEMPRICE)
{
Show what is inside this one
__________________
coool is offline   Reply With Quote
Old 09/12/2019, 03:50 PM   #10
MatusVietNam
Little Clucker
 
Join Date: Nov 2019
Posts: 44
Reputation: 0
Default Re: [Help] Server Error :<

I'm sorry lmao =))
Quote:
else if(dialogid == DIALOG_STOREITEMPRICE)
{

if(PlayerInfo[playerid][pBusiness] != GetPVarInt(playerid, "EditingBusiness") || (GetPVarInt(playerid, "EditingBusiness") != InBusiness(playerid)) || PlayerInfo[playerid][pBusinessRank] != 5) {
DeletePVar(playerid, "EditingStoreItem");
DeletePVar(playerid, "EditingBusiness");
return 1;
}
here here :v
MatusVietNam is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Server crashed due to an unknown error (Critical Error) Callisto Scripting Help 14 19/07/2018 05:09 PM
[FRAG.GS] error: Oh no! The server couldn't be started (Unknown error). BluePT Server Support 3 03/12/2016 09:34 PM
(error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for t SandKing94 Scripting Help 3 22/05/2015 09:53 AM
Server Error - Run time error 19 Alyo Server Support 6 04/03/2015 07:40 PM
GameMode Error - Other threads doesn't help! (samp-server.exe starts but gives an error) Spose Scripting Help 6 04/04/2013 09:12 AM


All times are GMT. The time now is 01:21 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.