invalid subscript (not an array or too many subscripts)
#1

Hello, how to fix it?

Код:
        format(cmdstring, sizeof(cmdstring), "unbanip %s", pIP(playerid));
Reply
#2

Try this.
pawn Код:
format(cmdstring, sizeof(cmdstring), "unbanip %s", pIP[playerid]);
Reply
#3

nop still this is the pIP on the enum:

Quote:

pIP[22]

Reply
#4

Tested this with your enum thingy, should work.
pawn Код:
format(cmdstring, sizeof(cmdstring), "unbanip %s", pIP);
Reply
#5

1 warning:

symbol is assigned a value that is never used: "string"
Reply
#6

Give me the line please.
Reply
#7

Thats the command, any help were appreciated:

Код:
CMD:unban(playerid, params[])
{
    new string[128],tname[24];
    if(sscanf(params, "s[24]", tname)) return SendClientMessage(playerid,-1,""chat" Usage: /unban [playerid]");
    new filestring[79];
    format(filestring, sizeof(filestring), "/Users/%s.ini", tname);
    if(!fexist(filestring)) return SendClientMessage(playerid,-1,""chat""COL_RED" This player does not exist!");
    else
    {
        new INI:File = INI_Open(filestring);
        INI_SetTag(File, "data");
        INI_WriteInt(File, "pBanned",0);
        INI_Close(File);
        INI_ParseFile(filestring, "LoadIP_%s", .bExtra = true , .extra = playerid);
        new cmdstring[44];
        format(cmdstring, sizeof(cmdstring), "unbanip %s", pIP);
        SendRconCommand(cmdstring);
        SendRconCommand("reloadbans");
    }
    return 1;
}
Reply
#8

The warning should be fixed now.
pawn Код:
CMD:unban(playerid, params[])
{
    new tname[24];
    if(sscanf(params, "s[24]", tname)) return SendClientMessage(playerid,-1, ""chat""Usage: /unban [playerid]");
    new filestring[79];
    format(filestring, sizeof(filestring), "
/Users/%s.ini", tname);
    if(!fexist(filestring)) return SendClientMessage(playerid,-1,"
"chat""COL_RED" This player does not exist!");
    else
    {
        new INI:File = INI_Open(filestring);
        INI_SetTag(File, "
data");
        INI_WriteInt(File, "
pBanned",0);
        INI_Close(File);
        INI_ParseFile(filestring, "
LoadIP_%s", .bExtra = true , .extra = playerid);
        new cmdstring[44];
        format(cmdstring, sizeof(cmdstring), "
unbanip %s", pIP);
        SendRconCommand(cmdstring);
        SendRconCommand("
reloadbans");
    }
    return 1;
}
Reply
#9

You cannot use "string". use something like "tmpString"
Reply
#10

Quote:
Originally Posted by TLN
Посмотреть сообщение
The warning should be fixed now.
pawn Код:
CMD:unban(playerid, params[])
{
    new tname[24];
    if(sscanf(params, "s[24]", tname)) return SendClientMessage(playerid,-1, ""chat""Usage: /unban [playerid]");
    new filestring[79];
    format(filestring, sizeof(filestring), "
/Users/%s.ini", tname);
    if(!fexist(filestring)) return SendClientMessage(playerid,-1,"
"chat""COL_RED" This player does not exist!");
    else
    {
        new INI:File = INI_Open(filestring);
        INI_SetTag(File, "
data");
        INI_WriteInt(File, "
pBanned",0);
        INI_Close(File);
        INI_ParseFile(filestring, "
LoadIP_%s", .bExtra = true , .extra = playerid);
        new cmdstring[44];
        format(cmdstring, sizeof(cmdstring), "
unbanip %s", pIP);
        SendRconCommand(cmdstring);
        SendRconCommand("
reloadbans");
    }
    return 1;
}
Make it easier for him, man.

pawn Код:
CMD:unban(playerid, params[])
{
    new cmdstring[128],tname[24],filestring[79];
    if(sscanf(params, "s[24]", tname)) return SendClientMessage(playerid,-1, ""chat""Usage: /unban [playerid]");
    format(filestring, sizeof(filestring), "
/Users/%s.ini", tname);
    if(!fexist(filestring)) return SendClientMessage(playerid,-1,"
"chat""COL_RED" This player does not exist!");
    else
    {
        new INI:File = INI_Open(filestring);
        INI_SetTag(File, "
data");
        INI_WriteInt(File, "
pBanned",0);
        INI_Close(File);
        INI_ParseFile(filestring, "
LoadIP_%s", .bExtra = true , .extra = playerid);
        format(cmdstring, sizeof(cmdstring), "
unbanip %s", pIP);
        SendRconCommand(cmdstring);
        SendRconCommand("
reloadbans");
    }
    return 1;
}
You had this in the middle of the script:
pawn Код:
new cmdstring[44]
Don't make your script look messy, it's better for yourself..

So I've moved the rule up.

pawn Код:
new cmdstring[128], tname[24];
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)