[Help] One error with Dini and arrays -
Niixie - 29.12.2009
Hello.
I got this one error and cant get it away, i dont know much about dini so it could be everthing.
I've searched and ******d my ass off <.<
Heres the lines thats the probem
pawn Код:
new ban[255];
ban = dini_Get(file, "banned");
And heres the error
Код:
error 033: array must be indexed (variable "ban")
Whats wrong?
Thanks
Re: [Help] One error with Dini and arrays -
M4S7ERMIND - 29.12.2009
I think you need to make it like this:
pawn Код:
new ban[255];
format(ban, sizeof(ban), "%s", dini_Get(file, "banned"));
Re: [Help] One error with Dini and arrays -
Niixie - 29.12.2009
Nope same error ..
Re: [Help] One error with Dini and arrays -
[HiC]TheKiller - 29.12.2009
I had this exact same thing in my register system for some reason.
But also I had no problem with
pawn Код:
new Reason[56];
format(Reason, sizeof(Reason), "%s", dini_Get(File, "BanReason"));
So I'm not sure why you are getting that error. The only way I fixed it is using dini_Get directly.
So instead of something like:
pawn Код:
format(str, sizeof(str), "%s has been banned for %s", Pname, ban);
I did
pawn Код:
format(str, sizeof(str), "%s has been banned for %s", Pname, dini_Get(file, "banned"));
Re: [Help] One error with Dini and arrays -
Niixie - 29.12.2009
but mine is under OnPlayerConnect?
so if under the players ini file is Banned = 1 then a message pops up
pawn Код:
if(fexist(file))
{
new ban[255];
format(ban, sizeof(ban), "", dini_Get(file, "banned"));
format(
if(ban == 1)
{
SendClientMessage(playerid, COLOR_RED, "| You're banned from the server! |");
}
else
{
//Blablabla
}
}
Re: [Help] One error with Dini and arrays -
M4S7ERMIND - 29.12.2009
so "banned" is a string or an integrer in your file?
Re: [Help] One error with Dini and arrays -
[HiC]TheKiller - 29.12.2009
That's exactly the same as my script, but I don't get errors with this
pawn Код:
if(dini_Int(File, "Banned") == 1)
{
new Reason[56];
format(Reason, sizeof(Reason), "%s", dini_Get(File, "BanReason"));
SendClientMessage(playerid, 0xFF0000AA, Reason);
Kick(playerid);
}
Quote:
Originally Posted by Niixie
but mine is under OnPlayerConnect?
so if under the players ini file is Banned = 1 then a message pops up
pawn Код:
if(fexist(file)) { new ban[255]; format(ban, sizeof(ban), "", dini_Get(file, "banned")); format( if(ban == 1) { SendClientMessage(playerid, COLOR_RED, "| You're banned from the server! |"); } else { //Blablabla } }
|
You are using ban as a integer, use dini_int or strcmp.
Re: [Help] One error with Dini and arrays -
Niixie - 29.12.2009
Thanks, i got it working with your line TheKiller