Array must be indexed (name[MAX_PLAYER_NAME])
#1

So guys I'm having a problem with my event system... So when the player that finished first enters the last race checkpoint I want to send a client message to whole server that he finished 1st. So I tried to get players name by command GetPlayerName(playerid, name, sizeof(name)); but it doesn't work idk why.

Error:

Код:
D:\Samp server\gamemodes\grandlarc.pwn(3834) : error 033: array must be indexed (variable "name")
Here is code where the problem is:

Код:
public OnPlayerEnterRaceCheckpoint(playerid)
{
    //I cut out a part of code that comes here.. :)
    	if(EventCheck[playerid] == 6)
    	{
            EventCheck[playerid] = 0;
            new msg1[128], name[MAX_PLAYER_NAME];
            name = GetPlayerName(playerid, name, sizeof(name));
            if(zavrsili == 1)
            {
                if(zavrsili == 2)
                {
                    if(zavrsili == 3)
                    {
						SetPlayerHealth(playerid, 0);
                        return 1;
                    }
                    format(msg1, sizeof(msg1), "Igrac %s je zavrsio event na trecem mestu! | Nagrada:$1000", name);
                    SCMALL(COLOR_INFO, msg1);
                    treci[playerid] = 1;
					zavrsili = 3;
					GivePlayerMoney(playerid, 1000);
					for(new id=0;id<MAX_PLAYERS;id++)
					{
					    if(OnEvent[id] == 1)
					    {
							SetPlayerHealth(id, 0);
							OnEvent[id] = 0;
							poceo = 0;
							eventid = 0;
					    }
					}
                    return 1;
                }
                format(msg1, sizeof(msg1), "Igrac %s je zavrsio event na drugom mestu! | Nagrada:$2000", name);
                SCMALL(COLOR_INFO, msg1);
                drugi[playerid] = 1;
                zavrsili = 2;
                GivePlayerMoney(playerid, 2000);
                return 1;
            }
            format(msg1, sizeof(msg1), "Igrac %s je zavrsio event na prvom mestu! | Nagrada:$3000", name);
            SCMALL(COLOR_INFO, msg1);
            prvi[playerid] = 1;
            zavrsili = 1;
            GivePlayerMoney(playerid, 3000);
    	    return 1;
    	}
    return 1;
}
Can anybody help me and why is this CODE option messing up my code when I paste it?

And idk why is my gamemode still called grandlarc but ok.. :/
Reply
#2

Remove 'name = ' part
Reply
#3

Oh omg I'm dumb thx m8...
Reply
#4

Change the name of your game modes in ongamemodeinit you should see it in there saying grandlarc or just do the simple things search grandlarc and change it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)