indexed
#1

error 033: array must be indexed (variable "Member")

How do i do that?
Reply
#2

if you have a vairable
pawn Код:
new variable;
then it needs to be made an array
pawn Код:
new variable[]
but you can also need some more complex code as
pawn Код:
new variable[MAX_PLAYERS][PLAYER_INFO][MAX_SAME_INFO];
mind showing us your code where it is used and declared?
Reply
#3

with [ ]

so [ some variable ] like [0]
Reply
#4

Quote:
Originally Posted by boelie
Посмотреть сообщение
with [ ]

so [ some variable ] like [0]
hmm. i have done like that.
Reply
#5

Quote:
Originally Posted by gamer_Z
Посмотреть сообщение
if you have a vairable
pawn Код:
new variable;
then it needs to be made an array
pawn Код:
new variable[]
but you can also need some more complex code as
pawn Код:
new variable[MAX_PLAYERS][PLAYER_INFO][MAX_SAME_INFO];
mind showing us your code where it is used and declared?
Here is the code
pawn Код:
COMMAND:unjail(playerid, params[])
{
    new id;
    if(sscanf(params,"u", id))return SendClientMessage(playerid, 0x33CCFFAA, "Usage: /Unjail [id]");
    if(IsPlayerConnected(id))
    if(Jail[id] == 0) return SendClientMessage(playerid,red,"That Player is not in jail!");
    if(PlayerInfo[playerid][Admin] >= 1)
    {
        GetPlayerName(playerid, Name, sizeof(Name));
        format(String, sizeof(String), "%s has unjailed you",Name);
        SendClientMessage(id,green, String);
        Jail[id] = 0;
        SetPlayerPos(playerid, 414.6559,2531.7651,19.1601);
        GivePlayerWeapon(playerid,36,60); //HS Rocket Launcher **
        GivePlayerWeapon(playerid,30,200); //AK-47
        SetPlayerTeam(playerid, 0);
        SetPlayerColor(playerid, COLOR_RED);
        if(PlayerInfo[playerid][Member] == 1)
    {
        SetPlayerColor(playerid,COLOR_GREY);
        SetPlayerTeam(playerid, 1);
        SetPlayerSkin(playerid, 255);
        SetPlayerPos(playerid, 1607.7803,1169.4840,14.2188);
        GivePlayerWeapon(playerid,36,60); //HS Rocket Launcher **
        GivePlayerWeapon(playerid,27,100); //Combat Shotgun
        GivePlayerWeapon(playerid,30,200); //AK-47
        SendClientMessage(playerid,COLOR_GREY,"Combat Team: Airwolves.");
    }
        if(PlayerInfo[playerid][Member] == 2)
    {
        SetPlayerColor(playerid,COLOR_DBLUE);
        SetPlayerTeam(playerid, 2);
        SetPlayerSkin(playerid, 255);
        SetPlayerPos(playerid, 1998.3118,-2352.3438,13.5469);
        GivePlayerWeapon(playerid,36,60); //HS Rocket Launcher **
        GivePlayerWeapon(playerid,27,100); //Combat Shotgun
        GivePlayerWeapon(playerid,30,200); //AK-47
        SendClientMessage(playerid,COLOR_DBLUE,"Combat Team: Bluefoxes.");
    }
        if(PlayerInfo[playerid][Member] == 3)
    {
        SetPlayerColor(playerid,COLOR_YELLOW);
        SetPlayerTeam(playerid, 3);
        SetPlayerSkin(playerid, 255);
        SetPlayerPos(playerid, -1468.5074,-206.8094,14.1484);
        GivePlayerWeapon(playerid,36,60); //HS Rocket Launcher **
        GivePlayerWeapon(playerid,27,100); //Combat Shotgun
        GivePlayerWeapon(playerid,30,200); //AK-47
        SendClientMessage(playerid,COLOR_YELLOW,"Combat Team: Thunderbirds.");
    }
        if(PlayerInfo[playerid][Member] == 1)
    {
        SetPlayerColor(playerid,COLOR_GREY);
        SetPlayerTeam(playerid, 1);
        SetPlayerSkin(playerid, 61);
        SetPlayerPos(playerid, 1607.7803,1169.4840,14.2188);
        GivePlayerWeapon(playerid,36, 75); //HS Rocket Launcher **
        GivePlayerWeapon(playerid,27, 100); //Combat Shotgun
        GivePlayerWeapon(playerid, 38, 100); //Minigun
        GivePlayerWeapon(playerid, 30, 350); //AK-47
        /*SendClientMessage(playerid,COLOR_GREY,"Combat Team: Airwolves.");*/
    }
        if(PlayerInfo[playerid][Member] == 2)
    {
        SetPlayerColor(playerid,COLOR_DBLUE);
        SetPlayerTeam(playerid, 2);
        SetPlayerSkin(playerid, 61);
        SetPlayerPos(playerid, 1998.3118,-2352.3438,13.5469);
        GivePlayerWeapon(playerid,36, 75); //HS Rocket Launcher **
        GivePlayerWeapon(playerid,27, 100); //Combat Shotgun
        GivePlayerWeapon(playerid, 38, 100); //Minigun
        GivePlayerWeapon(playerid, 30, 350); //AK-47
        /*SendClientMessage(playerid,COLOR_DBLUE,"Combat Team: Bluefoxes.");*/
    }
        if(PlayerInfo[playerid][Member] == 3)
    {
        SetPlayerColor(playerid,COLOR_YELLOW);
        SetPlayerTeam(playerid, 3);
        SetPlayerSkin(playerid, 61);
        SetPlayerPos(playerid, -1468.5074,-206.8094,14.1484);
        GivePlayerWeapon(playerid,36, 75); //HS Rocket Launcher **
        GivePlayerWeapon(playerid,27, 100); //Combat Shotgun
        GivePlayerWeapon(playerid, 38, 100); //Minigun
        GivePlayerWeapon(playerid, 30, 350); //AK-47
        /*SendClientMessage(playerid,COLOR_YELLOW,"Combat Team: Thunderbirds.");*/
    }
    }
    return 1;
}
the error is about this
pawn Код:
if(PlayerInfo[playerid][Member]
Reply
#6

Maybe 'member' does not exist or it returns an string?
Sorry I edited the post, please read again xD
Reply
#7

Quote:
Originally Posted by gamer_Z
Посмотреть сообщение
Where is the error?
Jail[id] ?
no, as i said, the error is abut "if(PlayerInfo[playerid][Member]" :P
Reply
#8

Quote:
Originally Posted by gamer_Z
Посмотреть сообщение
Maybe 'member' does not exist or it returns an string?
It does exist, i have the same code on "OnPlayerSpawn" with no errors
Reply
#9

show us the enum that 'Member' is declared in.

editL:
Bleh. Em.. just show the enum.
Reply
#10

it is like this

new Member[MAX_PLAYERS];

On OnPlayerSpawn i have
pawn Код:
if(Member[playerid] == 1)
on the jail i need to have something like this
pawn Код:
iif(PlayerInfo[playerid][Member] == 1)
or else i spawn my self and not that one i unjailed
Reply
#11

and there you go...
then you 'weird' code should look like
PlayerInfo[playerid][(Member[playerid])];
owned..

BTW, why do you have everithing twice?

pawn Код:
COMMAND:unjail(playerid, params[])
{
    new id;
   
    if(sscanf(params,"u", id))return SendClientMessage(playerid, 0x33CCFFAA, "Usage: /Unjail [id]");
   
    if(IsPlayerConnected(id) && Jail[id] == 0)return SendClientMessage(playerid,red,"That Player is not in jail!");
   
    if(PlayerInfo[playerid][Admin] >= 1)
    {
   
        GetPlayerName(playerid, Name, sizeof(Name));
        format(String, sizeof(String), "%s has unjailed you",Name);
        SendClientMessage(id,green, String);
        Jail[id] = 0;
        SetPlayerPos(playerid, 414.6559,2531.7651,19.1601);
        GivePlayerWeapon(playerid,36,60); //HS Rocket Launcher **
        GivePlayerWeapon(playerid,30,200); //AK-47
        SetPlayerTeam(playerid, 0);
        SetPlayerColor(playerid, COLOR_RED);
       
        if(PlayerInfo[playerid][(Member[playerid])] == 1)
        {
            SetPlayerColor(playerid,COLOR_GREY);
            SetPlayerTeam(playerid, 1);
            SetPlayerSkin(playerid, 255);
            SetPlayerPos(playerid, 1607.7803,1169.4840,14.2188);
            GivePlayerWeapon(playerid,36,60); //HS Rocket Launcher **
            GivePlayerWeapon(playerid,27,100); //Combat Shotgun
            GivePlayerWeapon(playerid,30,200); //AK-47
            SendClientMessage(playerid,COLOR_GREY,"Combat Team: Airwolves.");
        }
       
        if(PlayerInfo[playerid][(Member[playerid])] == 2)
        {
            SetPlayerColor(playerid,COLOR_DBLUE);
            SetPlayerTeam(playerid, 2);
            SetPlayerSkin(playerid, 255);
            SetPlayerPos(playerid, 1998.3118,-2352.3438,13.5469);
            GivePlayerWeapon(playerid,36,60); //HS Rocket Launcher **
            GivePlayerWeapon(playerid,27,100); //Combat Shotgun
            GivePlayerWeapon(playerid,30,200); //AK-47
            SendClientMessage(playerid,COLOR_DBLUE,"Combat Team: Bluefoxes.");
        }
       
        if(PlayerInfo[playerid][(Member[playerid])] == 3)
        {
            SetPlayerColor(playerid,COLOR_YELLOW);
            SetPlayerTeam(playerid, 3);
            SetPlayerSkin(playerid, 255);
            SetPlayerPos(playerid, -1468.5074,-206.8094,14.1484);
            GivePlayerWeapon(playerid,36,60); //HS Rocket Launcher **
            GivePlayerWeapon(playerid,27,100); //Combat Shotgun
            GivePlayerWeapon(playerid,30,200); //AK-47
            SendClientMessage(playerid,COLOR_YELLOW,"Combat Team: Thunderbirds.");
        }
    }
    return 1;
}
:S xD

that code will be wrong too, just remove the new Member[max_players] and then put member into the enum of the playerinfo.

this code should work:
pawn Код:
COMMAND:unjail(playerid, params[])
{
    new id;
   
    if(sscanf(params,"u", id))return SendClientMessage(playerid, 0x33CCFFAA, "Usage: /Unjail [id]");
   
    if(IsPlayerConnected(id) && Jail[id] == 0)return SendClientMessage(playerid,red,"That Player is not in jail!");
   
    if(PlayerInfo[playerid][Admin] >= 1)
    {
   
        GetPlayerName(playerid, Name, sizeof(Name));
        format(String, sizeof(String), "%s has unjailed you",Name);
        SendClientMessage(id,green, String);
        Jail[id] = 0;
        SetPlayerPos(playerid, 414.6559,2531.7651,19.1601);
        GivePlayerWeapon(playerid,36,60); //HS Rocket Launcher **
        GivePlayerWeapon(playerid,30,200); //AK-47
        SetPlayerTeam(playerid, 0);
        SetPlayerColor(playerid, COLOR_RED);
       
        if(Member[playerid] == 1)
        {
            SetPlayerColor(playerid,COLOR_GREY);
            SetPlayerTeam(playerid, 1);
            SetPlayerSkin(playerid, 255);
            SetPlayerPos(playerid, 1607.7803,1169.4840,14.2188);
            GivePlayerWeapon(playerid,36,60); //HS Rocket Launcher **
            GivePlayerWeapon(playerid,27,100); //Combat Shotgun
            GivePlayerWeapon(playerid,30,200); //AK-47
            SendClientMessage(playerid,COLOR_GREY,"Combat Team: Airwolves.");
        }
       
        if(Member[playerid] == 2)
        {
            SetPlayerColor(playerid,COLOR_DBLUE);
            SetPlayerTeam(playerid, 2);
            SetPlayerSkin(playerid, 255);
            SetPlayerPos(playerid, 1998.3118,-2352.3438,13.5469);
            GivePlayerWeapon(playerid,36,60); //HS Rocket Launcher **
            GivePlayerWeapon(playerid,27,100); //Combat Shotgun
            GivePlayerWeapon(playerid,30,200); //AK-47
            SendClientMessage(playerid,COLOR_DBLUE,"Combat Team: Bluefoxes.");
        }
       
        if(Member[playerid] == 3)
        {
            SetPlayerColor(playerid,COLOR_YELLOW);
            SetPlayerTeam(playerid, 3);
            SetPlayerSkin(playerid, 255);
            SetPlayerPos(playerid, -1468.5074,-206.8094,14.1484);
            GivePlayerWeapon(playerid,36,60); //HS Rocket Launcher **
            GivePlayerWeapon(playerid,27,100); //Combat Shotgun
            GivePlayerWeapon(playerid,30,200); //AK-47
            SendClientMessage(playerid,COLOR_YELLOW,"Combat Team: Thunderbirds.");
        }
    }
    return 1;
}
Reply
#12

Quote:
Originally Posted by gamer_Z
Посмотреть сообщение
and there you go...
then you 'weird' code should look like
PlayerInfo[playerid][(Member[playerid])];
owned..

BTW, why do you have everithing twice?

pawn Код:
COMMAND:unjail(playerid, params[])
{
    new id;
   
    if(sscanf(params,"u", id))return SendClientMessage(playerid, 0x33CCFFAA, "Usage: /Unjail [id]");
   
    if(IsPlayerConnected(id) && Jail[id] == 0)return SendClientMessage(playerid,red,"That Player is not in jail!");
   
    if(PlayerInfo[playerid][Admin] >= 1)
    {
   
        GetPlayerName(playerid, Name, sizeof(Name));
        format(String, sizeof(String), "%s has unjailed you",Name);
        SendClientMessage(id,green, String);
        Jail[id] = 0;
        SetPlayerPos(playerid, 414.6559,2531.7651,19.1601);
        GivePlayerWeapon(playerid,36,60); //HS Rocket Launcher **
        GivePlayerWeapon(playerid,30,200); //AK-47
        SetPlayerTeam(playerid, 0);
        SetPlayerColor(playerid, COLOR_RED);
       
        if(PlayerInfo[playerid][(Member[playerid])] == 1)
        {
            SetPlayerColor(playerid,COLOR_GREY);
            SetPlayerTeam(playerid, 1);
            SetPlayerSkin(playerid, 255);
            SetPlayerPos(playerid, 1607.7803,1169.4840,14.2188);
            GivePlayerWeapon(playerid,36,60); //HS Rocket Launcher **
            GivePlayerWeapon(playerid,27,100); //Combat Shotgun
            GivePlayerWeapon(playerid,30,200); //AK-47
            SendClientMessage(playerid,COLOR_GREY,"Combat Team: Airwolves.");
        }
       
        if(PlayerInfo[playerid][(Member[playerid])] == 2)
        {
            SetPlayerColor(playerid,COLOR_DBLUE);
            SetPlayerTeam(playerid, 2);
            SetPlayerSkin(playerid, 255);
            SetPlayerPos(playerid, 1998.3118,-2352.3438,13.5469);
            GivePlayerWeapon(playerid,36,60); //HS Rocket Launcher **
            GivePlayerWeapon(playerid,27,100); //Combat Shotgun
            GivePlayerWeapon(playerid,30,200); //AK-47
            SendClientMessage(playerid,COLOR_DBLUE,"Combat Team: Bluefoxes.");
        }
       
        if(PlayerInfo[playerid][(Member[playerid])] == 3)
        {
            SetPlayerColor(playerid,COLOR_YELLOW);
            SetPlayerTeam(playerid, 3);
            SetPlayerSkin(playerid, 255);
            SetPlayerPos(playerid, -1468.5074,-206.8094,14.1484);
            GivePlayerWeapon(playerid,36,60); //HS Rocket Launcher **
            GivePlayerWeapon(playerid,27,100); //Combat Shotgun
            GivePlayerWeapon(playerid,30,200); //AK-47
            SendClientMessage(playerid,COLOR_YELLOW,"Combat Team: Thunderbirds.");
        }
    }
    return 1;
}
:S xD

that code will be wrong too, just remove the new Member[max_players] and then put member into the enum of the playerinfo.
Damit! the last 3 one sshould be "Leader" and not "Member" XD
Reply
#13

okay., but read the post again, I posted (I think) working code :P
Reply
#14

Quote:
Originally Posted by gamer_Z
Посмотреть сообщение
okay., but read the post again, I posted (I think) working code :P
Hmm, if i put "member," enum the "OnPlayerSpawn" "if(Member[playerid] == 1)" dont work.
Is it some more i need to change with the enum member?
Reply
#15

Quote:
Originally Posted by cruising
Посмотреть сообщение
Hmm, if i put "member," enum the "OnPlayerSpawn" "if(Member[playerid] == 1)" dont work.
Is it some more i need to change with the enum member?
okay, DELETE the 'Member' From enum and create new Member[Max_PLAYERS] again.
then instead of Playerinfo[playerid][Member] use Member[playerid] and it will be fixed!
leave your onplayerspawn unchanged :P
Reply
#16

Quote:
Originally Posted by gamer_Z
Посмотреть сообщение
okay, DELETE the 'Member' From enum and create new Member[Max_PLAYERS] again.
then instead of Playerinfo[playerid][Member] use Member[playerid] and it will be fixed!
leave your onplayerspawn unchanged :P
Hmm...this work perfekt on your self, but when you unjail a player, you respawn ur self on your regular spawnplace, and not the jailed one :O

EDIT: i have solved this in a another way (why didnt i think about this earlier? :S
And it got much smaller
Code
pawn Код:
COMMAND:unjail(playerid, params[])
{
    new id;
    if(sscanf(params,"u", id))return SendClientMessage(playerid, 0x33CCFFAA, "Usage: /Unjail [id]");
    if(IsPlayerConnected(id))
    if(Jail[id] == 0) return SendClientMessage(playerid,red,"That Player is not in jail!");
    if(PlayerInfo[playerid][Admin] >= 1)
    {
        GetPlayerName(playerid, Name, sizeof(Name));
        format(String, sizeof(String), "%s has unjailed you",Name);
        SendClientMessage(id,green, String);
        Jail[id] = 0;
        if(GetPlayerTeam(id) == 0) SetPlayerPos( id, 414.6559,2531.7651,19.1601);
        if(GetPlayerTeam(id) == 1) SetPlayerPos( id, 1607.7803,1169.4840,14.2188);
        if(GetPlayerTeam(id) == 2) SetPlayerPos( id, 1998.3118,-2352.3438,13.5469);
        if(GetPlayerTeam(id) == 3) SetPlayerPos( id, -1468.5074,-206.8094,14.1484);
    }
    return 1;
}
Reply
#17

pawn Код:
if(GetPlayerTeam(id) == 0) SetPlayerPos( id, 414.6559,2531.7651,19.1601);
        if(GetPlayerTeam(id) == 1) SetPlayerPos( id, 1607.7803,1169.4840,14.2188);
        if(GetPlayerTeam(id) == 2) SetPlayerPos( id, 1998.3118,-2352.3438,13.5469);
        if(GetPlayerTeam(id) == 3) SetPlayerPos( id, -1468.5074,-206.8094,14.1484);
to
SpawnPlayer? :P
because you said you have the member thingy in onplayerspawn?

and comment to my previus post..
Member[playerid] >> Member[id] xd
Reply
#18

Quote:
Originally Posted by gamer_Z
Посмотреть сообщение
pawn Код:
if(GetPlayerTeam(id) == 0) SetPlayerPos( id, 414.6559,2531.7651,19.1601);
        if(GetPlayerTeam(id) == 1) SetPlayerPos( id, 1607.7803,1169.4840,14.2188);
        if(GetPlayerTeam(id) == 2) SetPlayerPos( id, 1998.3118,-2352.3438,13.5469);
        if(GetPlayerTeam(id) == 3) SetPlayerPos( id, -1468.5074,-206.8094,14.1484);
to
SpawnPlayer? :P
because you said you have the member thingy in onplayerspawn?

and comment to my previus post..
Member[playerid] >> Member[id] xd
Yes i have! thats why i just made it like this instead, if he is in team 0 when i unjail him, he spawning at the 414.6559,2531.7651,19.1601
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)