[Help]Array index out of bounds Problem -
Mamal75 - 13.10.2014
when i write a file with yini (Register a player or create and save a house) after writing >>
when a player join and want to register (Server must write his file !) yini doesn't write his file and for showing next dialog (Email dialog...for saving player email) crashdetect plugin print error below and server does not show the email dialog:
pawn Code:
[11:34:17] [debug] Run time error 4: "Array index out of bounds"
[11:34:17] [debug] Accessing element at negative index -1
[11:34:17] [debug] AMX backtrace:
[11:34:17] [debug] #0 0000d79c in ?? (0xffffffff) from GM.amx
[11:34:17] [debug] #1 0010016c in ?? (0x00000006, 0x00000001, 0x00000001, 0xffffffff, 0x011c6260) from GM.amx
[11:34:17] [debug] #2 00008860 in public OnDialogResponse (0x00000006, 0x00000001, 0x00000001, 0xffffffff, 0x011c6260) from GM.amx
Register Dialog:
pawn Code:
if(dialogid == DIALOG_REGISTER)
{
if (!response) return Kick(playerid);
if(response)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",25000);
INI_WriteInt(File,"Score",0);
INI_WriteInt(File,"HaveBankAcc",0);
INI_WriteInt(File,"BankCash",0);
INI_WriteInt(File,"HaveATM",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Vip",0);
INI_WriteInt(File,"AdminExpire",0);
INI_WriteInt(File,"VipExpire",0);
INI_WriteInt(File,"Respect",0);
INI_WriteInt(File,"Playtime",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_WriteInt(File,"Banned",0);
INI_WriteInt(File,"TempBanned",0);
INI_WriteInt(File,"TempBanTime",0);
INI_WriteInt(File,"POC",0);
INI_WriteInt(File,"Bombs",0);
INI_WriteInt(File,"Reports",0);
INI_WriteInt(File,"Wanted",0);
INI_WriteInt(File,"Zone",0);
INI_WriteInt(File,"Weed",0);
INI_WriteInt(File,"Email",0);
INI_WriteInt(File,"Jailed",0);
INI_WriteInt(File,"JailTime",0);
INI_WriteInt(File,"PolicePunish",0);
INI_WriteInt(File,"CanPolice",0);
INI_WriteInt(File,"TeamID",8);
INI_WriteInt(File,"Skin",295);
INI_WriteInt(File,"SkinOn",0);
INI_WriteInt(File,"NameTag",0);
INI_WriteString(File,"DeathPM","Death PM");
INI_WriteString(File,"Banreason","None");
INI_WriteFloat(File,"LastX",0);
INI_WriteFloat(File,"LastY",0);
INI_WriteFloat(File,"LastZ",0);
INI_WriteInt(File,"LastInterior",0);
INI_WriteInt(File,"LastVW",0);
INI_WriteInt(File,"PDETimeLimit",0);
INI_Close(File);
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ServerInfo[Registered]++;
format(ServerInfo[NewestPlayer],32,"%s",GetName(playerid));
ShowPlayerDialog(playerid, pEmailDialog, DIALOG_STYLE_INPUT, "Email", "Please Enter Your Email", "Save", "");
}
return 1;
}
if you want other codes tell me
Please help !
Re: [Help]Array index out of bounds Problem -
AnnaSB - 13.10.2014
pawn Code:
format(ServerInfo[NewestPlayer],32,"%s",GetName(playerid));
What... is
GetName?
See, in C/++/PAWN you cannot directly return strings from functions, you should use pointers on arrays.
Use this instead:
pawn Code:
new NAME[24];
GetPlayerName(playerid, NAME, sizeof NAME);
format(ServerInfo[NewestPlayer],32,"%s",NAME);
Hope I helped ^^
Re: [Help]Array index out of bounds Problem -
Mamal75 - 13.10.2014
i will test it and tell it work or no..
tnx for your help !
Re: [Help]Array index out of bounds Problem -
Mamal75 - 13.10.2014
NO
still i have same problem ...
after 1 or 2 write, yini doesn't write any file
(
Re: [Help]Array index out of bounds Problem -
Mamal75 - 13.10.2014
bump
Re: [Help]Array index out of bounds Problem -
Mamal75 - 13.10.2014
someone helppppppp
Re: [Help]Array index out of bounds Problem -
Mamal75 - 13.10.2014
please someone help !
is any limit for writing ?!
for example i can only write 15 values for each file ?!!
error is : Array index out of bounds
writing by yini has Size ??!
or y ini has catch ?
tnx
Re: [Help]Array index out of bounds Problem -
Mamal75 - 13.10.2014
helPPPPPPPPPPPPPPPPPPP
Re: [Help]Array index out of bounds Problem -
AnnaSB - 13.10.2014
So now what I get is: you have problems with INI_ParseFile.
See this tutorial:
http://forum.sa-mp.com/showthread.ph...oto=nextoldest
maybe you're wrong somewhere.
Hope it helps.
Re: [Help]Array index out of bounds Problem -
Rudy_ - 14.10.2014
I dont really understand your problem, What's wrong with it?