21.03.2017, 04:06
You can stringify it by placing a hashtag in front of it (utilises the preprocessor):
prints:
Using #enumerator inside the function doesn't seem to work because it stringifies what you put after it, hence why I do it in the function call. But at that point, you could just do "pLevel" and stuff.
That's what I understand from your examples.
PHP код:
#include <a_samp>
enum E_PLAYER_DATA {
pAdmin,
pLevel
};
new PlayerInfo[MAX_PLAYERS][E_PLAYER_DATA];
main() {
new
playerid = 10
;
Display_Data(playerid, pAdmin, #pAdmin);
Display_Data(playerid, pLevel, #pLevel);
}
Display_Data(playerid, E_PLAYER_DATA:enumerator, stringified[]) {
new string[128];
format(string,sizeof(string),"The value of %s is %i.", stringified, PlayerInfo[playerid][enumerator]);
print(string);
return true;
}
Код:
[04:57:52] The value of pAdmin is 0. [04:57:52] The value of pLevel is 0.
That's what I understand from your examples.