error 033: array must be indexed
#1

pawn Код:
command(makeowner, playerid, params[])
{
    new Confirm[128], id, string[128], string1[128];
    if(sscanf(params, "dz", id, Confirm))
    {
        if(Player[playerid][FactionRank] == 7 && Factions[Player[playerid][Faction]][FOwner] == GetName(playerid))
        {
            format(string1, sizeof(string1), "You wanna make %s the owner of your faction? [Yes? Type '/makeowner [id] Confirm'] ", GetName(id));
            SendClientMessage(playerid, WHITE, string1);
        }
    }
    else
    {
        if(Player[playerid][FactionRank] == 7 && Factions[Player[playerid][Faction]][FOwner] == GetName(playerid))
        {
            format(string, sizeof(string), "Factions/Faction_%d.ini", id);
            if(strcmp(Confirm, "Confirm", true) == 0)
            {
                if(Player[id][Faction] == Player[playerid][Faction])
                {
                    format(Factions[Player[playerid][Faction]][FOwner], 255, "%s", GetName(id));
                    format(string1, sizeof(string1), "You made %s owner of the faction, you are now %s.", GetName(id), Factions[Player[id][Faction]][RankName6]);
                    SendClientMessage(playerid, WHITE, string1);
                    Player[playerid][FactionRank] = 6;
                    format(string1, sizeof(string1), "%s made you owner of the faction, he is now %s.", GetName(playerid), Factions[Player[id][Faction]][RankName6]);
                    SendClientMessage(id, ADMINBLUE, string1);
                    Player[id][FactionRank] = 7;
                    SaveFaction(Player[id][Faction]);
                    SavePlayerData(playerid);
                    SavePlayerData(id);
                }
                else
                {
                    SCM(playerid, RED, "This player is not in your faction.");
                }
            }
        }
    }
    return 1;
}
I have a working stock for the GetName it works for other commands.

Код:
C:\Users\Stefan Dorst\Desktop\Scratch RolePlay\gamemodes\RP.pwn(528) : error 033: array must be indexed (variable "GetName")
C:\Users\Stefan Dorst\Desktop\Scratch RolePlay\gamemodes\RP.pwn(536) : error 033: array must be indexed (variable "GetName")
C:\Users\Stefan Dorst\Desktop\Scratch RolePlay\gamemodes\RP.pwn(2834) : error 006: must be assigned to an array
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
EDIT:

Error line's are the same it's:

pawn Код:
if(Player[playerid][FactionRank] == 7 && Factions[Player[playerid][Faction]][FOwner] == GetName(playerid))
        {
This is my stock

pawn Код:
stock GetName(playerid)
{
    new Name[MAX_PLAYER_NAME];

    if(IsPlayerConnected(playerid))
    {
        GetPlayerName(playerid, Name, sizeof(Name));
    }
    else
    {
        Name = "Disconnected/Nothing";
    }

    return Name;
}
Reply
#2

Try

pawn Код:
GetName[playerid]
Reply
#3

Quote:
Originally Posted by Pedro_Miranda
Посмотреть сообщение
Try

pawn Код:
GetName[playerid]
Won't work...

Код:
C:\Users\Stefan Dorst\Desktop\Scratch RolePlay\gamemodes\RP.pwn(546) : error 028: invalid subscript (not an array or too many subscripts): "GetName"
C:\Users\Stefan Dorst\Desktop\Scratch RolePlay\gamemodes\RP.pwn(546) : warning 215: expression has no effect
C:\Users\Stefan Dorst\Desktop\Scratch RolePlay\gamemodes\RP.pwn(546) : error 001: expected token: ";", but found "]"
C:\Users\Stefan Dorst\Desktop\Scratch RolePlay\gamemodes\RP.pwn(546) : error 029: invalid expression, assumed zero
C:\Users\Stefan Dorst\Desktop\Scratch RolePlay\gamemodes\RP.pwn(546) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#4

So, try the code below:

pawn Код:
command(makeowner, playerid, params[])
{
    new Confirm[128], id, string[128], string1[128];
    if(sscanf(params, "dz", id, Confirm))
    {
        if(Player[playerid][FactionRank] == 7 && !strcmp(Factions[Player[playerid][Faction]][FOwner], GetName(playerid), true))
        {
            format(string1, sizeof(string1), "You wanna make %s the owner of your faction? [Yes? Type '/makeowner [id] Confirm'] ", GetName(id));
            SendClientMessage(playerid, WHITE, string1);
        }
    }
    else
    {
        if(Player[playerid][FactionRank] == 7 && !strcmp(Factions[Player[playerid][Faction]][FOwner], GetName(playerid), true))
        {
            format(string, sizeof(string), "Factions/Faction_%d.ini", id);
            if(strcmp(Confirm, "Confirm", true) == 0)
            {
                if(Player[id][Faction] == Player[playerid][Faction])
                {
                    format(Factions[Player[playerid][Faction]][FOwner], 255, "%s", GetName(id));
                    format(string1, sizeof(string1), "You made %s owner of the faction, you are now %s.", GetName(id), Factions[Player[id][Faction]][RankName6]);
                    SendClientMessage(playerid, WHITE, string1);
                    Player[playerid][FactionRank] = 6;
                    format(string1, sizeof(string1), "%s made you owner of the faction, he is now %s.", GetName(playerid), Factions[Player[id][Faction]][RankName6]);
                    SendClientMessage(id, ADMINBLUE, string1);
                    Player[id][FactionRank] = 7;
                    SaveFaction(Player[id][Faction]);
                    SavePlayerData(playerid);
                    SavePlayerData(id);
                }
                else
                {
                    SCM(playerid, RED, "This player is not in your faction.");
                }
            }
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)