[Help] One error with Dini and arrays
#1

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
Reply
#2

I think you need to make it like this:
pawn Код:
new ban[255];
format(ban, sizeof(ban), "%s", dini_Get(file, "banned"));
Reply
#3

Nope same error ..
Reply
#4

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"));
Reply
#5

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
        }
     }
Reply
#6

so "banned" is a string or an integrer in your file?
Reply
#7

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.
Reply
#8

Thanks, i got it working with your line TheKiller
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)