array must be indexed?
#1

I think i asked this before but can't remember it.

Код:
error 033: array must be indexed (variable "aName")
What does that mean?
Reply
#2

Must have an array to it, aName[MAX_PLAYER_NAME]; aName[24]; etc..
Reply
#3

I have that, it still says must be indexed
Reply
#4

Show us; The variable you created, and the line you get the error on.
Reply
#5

aName[playerid];

The playerid part.

Or maybe when you created the variable.
Reply
#6

how about.. I show the whole thing? kkgood

pawn Код:
forward UpdatePlayer(playerid);
public UpdatePlayer(playerid)
{
    #if defined AntiWeap
    if(PlayerInfo[playerid][Level] >= 1 || IsPlayerAdmin(playerid)) return 1;
    if(PlayerInfo[playerid][WHack] == 1) return print("Admins Aware");
    if(PlayerInfo[playerid][WHack] == 2) return Kick(playerid), SendClientMessage(playerid,red,"You been kicked for Weapon hacks, this means you had warning next is ban");
    if(PlayerInfo[playerid][WHack] == 3) return Ban(playerid), SendClientMessage(playerid,red,"You been banned for Weapn Hacks, This means u been warned and kicked."), PlayerInfo[playerid][WHack] = 0;
    for(new x=0; x<13; x++)
    {
        new WepData[13][2], WepName[25];
        GetPlayerWeaponData(playerid, x, WepData[x][0], WepData[x][1]);
        GetWeaponName(WepData[x][0], WepName, sizeof(WepName));

        if(IsIllegalWeapon(WepData[x][0]))
        {
            new aName[MAX_PLAYER_NAME], str[120];
            GetPlayerName(playerid, aName, sizeof(aName));

            format(str, sizeof(str), "%s Has Weapon %s with %d ammo, Illegal Weapon, Removed.", aName, WepName, WepData[x][1]);
            MessageToAdmin(0xFFC800FF,str);
            SendClientMessage(playerid,red,"WEAPON HACKS DETECTED! Cheating weapons leads to warning kick then ban, This is your warning");
            ResetPlayerWeapons(playerid);
            PlayerInfo[playerid][WHack] ++;
            return 1;
        }
    }
    #endif
    return 1;
}
.... Btw if anyone knows how to make it so that the WHack goes up after the warning kick and ban D:
Reply
#7

pawn Код:
new aName, str[120];
and try again.
Reply
#8

Quote:
Originally Posted by EllipseRage
Посмотреть сообщение
pawn Код:
new aName, str[120];
and try again.
It's already there, anyways i fixed that i just need it to kick if its the second attempt and ban on third

pawn Код:
if(PlayerInfo[playerid][WHack] == 1) return print("Admins Aware");
    if(PlayerInfo[playerid][WHack] == 2) return Kick(playerid), SendClientMessage(playerid,red,"You been kicked for Weapon hacks, this means you had warning next is ban"), PlayerInfo[playerid][WHack] = 2;
    if(PlayerInfo[playerid][WHack] == 3) return Ban(playerid), SendClientMessage(playerid,red,"You been banned for Weapn Hacks, This means u been warned and kicked."), PlayerInfo[playerid][WHack] = 3;
^^
Reply
#9

You can't return more then 1 value.

pawn Код:
if(PlayerInfo[playerid][WHack] == 1)
    {
        print("Admins Aware");
        PlayerInfo[playerid][WHack] = 2;
        return 1;
    }

    if(PlayerInfo[playerid][WHack] == 2)
    {
        Kick(playerid);
        SendClientMessage(playerid, red, "You been kicked for Weapon hacks, this means you had warning next is ban");
        PlayerInfo[playerid][WHack] = 3;
        return 1;
    }

    if(PlayerInfo[playerid][WHack] == 3)
    {
        Ban(playerid);
        SendClientMessage(playerid, red, "You been banned for Weapn Hacks, This means u been warned and kicked.");
        return 1;
    }
Also, I hope you have a way to link 'playerid' with their IP or name, because I assume once they rejoin from being kicked theyir WHack will be 0.
Reply
#10

lol it saves into the registerfile and it sets it when they log inn, no problem there Ima test what you posted.

EDIT: It failed. IT automatically sends it the the kick part because of the PlayerInfo[playerid][WHack] = 2;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)