SA-MP Forums Archive
error 033 - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: error 033 (/showthread.php?tid=652384)



error 033 - FelixAquero - 09.04.2018

Hi, I have some problem.
Код:
enum example {
    myName[MAX_PLAYER_NAME]
};
new myInfo[MAX_PLAYERS][example], testStr[MAX_PLAYER_NAME];
format(testStr, sizeof(testStr), "%s", IsPlayerConnected(playerid) ? (myInfo[playerid][myName]) : ("Player is not connected"));
When compiling, an error arises: Эarray must be indexed (variable "-unknown-")"
The error occurs because of the parameter "myInfo[playerid][myName]", if instead substitute, for example
Код:
format(testStr, sizeof(testStr), "%s", IsPlayerConnected(playerid) ? ("My_Name") : ("Player is not connected"));
Then the script will compile without errors. Thank you in advance for your help


Re: error 033 - CutX - 09.04.2018

Quote:
Originally Posted by FelixAquero
Посмотреть сообщение
Hi, I have some problem.
Код:
enum example {
    myName[MAX_PLAYER_NAME]
};
new myInfo[MAX_PLAYERS][example], testStr[MAX_PLAYER_NAME];
format(testStr, sizeof(testStr), "%s", IsPlayerConnected(playerid) ? (myInfo[playerid][myName]) : ("Player is not connected"));
When compiling, an error arises: Эarray must be indexed (variable "-unknown-")"
The error occurs because of the parameter "myInfo[playerid][myName]", if instead substitute, for example
Код:
format(testStr, sizeof(testStr), "%s", IsPlayerConnected(playerid) ? ("My_Name") : ("Player is not connected"));
Then the script will compile without errors. Thank you in advance for your help
why have the name stored, there's no noticeable benefit
just use conventional GetName

PHP код:
enum example {
    
myName[MAX_PLAYER_NAME]//not needed anymore
};
new 
myInfo[MAX_PLAYERS][example], testStr[MAX_PLAYER_NAME];
format(testStrsizeof(testStr), "%s"IsPlayerConnected(playerid) ? getName(playerid) : "Player is not connected");
getName(playerid)
{
    new 
n[MAX_PLAYER_NAME];
    
GetPlayerName(playeridnMAX_PLAYER_NAME);
    return 
n;

done


Re: error 033 - FelixAquero - 09.04.2018

With the same success, I can write this into a separate variable. I use MyName throughout the script. I'm not interested in workarounds, but how to solve this problem? Why does not it work? Because there are no errors in the syntax