19.03.2016, 22:16
Hello! Long time no see. I've just started scripting again after 3-4 years off this forum.
Now to my question! Is there a way to check for a parameter in the 2:nd dimension of an enum?
Example:
How do I loop through PlayerInfo[] and check if pAdmin/pLevel etc. is actually in the enum? Like this:
Tried:
Full command:
The problem is probably obvious, but I can't figure it out.
Thankfull for any help.
Now to my question! Is there a way to check for a parameter in the 2:nd dimension of an enum?
Example:
pawn Код:
enum pInfo {
pAdmin,
pLevel,
pMoney,
pName[MAX_PLAYER_NAME]
}
new PlayerInfo[MAX_PLAYERS][pInfo];
Tried:
pawn Код:
format(string, sizeof(string), "Requested playerinfo (%s) does not exist.", info);
for(new i=0; i < sizeof(PlayerInfo[]); i++) {
if(sscanf(PlayerInfo[], "s", info)) return SendErrorMessage(playerid, string);
}
pawn Код:
CMD:setinfo(playerid, params[]) {
new string[128], id, info[32], level[128];
if(PlayerInfo[playerid][pAdmin] < 4) return SendInvalidMessage(playerid);
if(sscanf(params, "uss", id, info, level)) return SendSyntaxMessage(playerid, "/setinfo <playerid/partofname> <pInfo> <string/int>");
format(string, sizeof(string), "Requested playerinfo (%s) does not exist.", info);
for(new i=0; i < sizeof(PlayerInfo[]); i++) {
if(sscanf(PlayerInfo[], "s", info)) return SendErrorMessage(playerid, string);
}
format(string, sizeof(string), "PlayerInfo[%s][%s] is set to %s", PlayerName(id), info, level);
SendInfoMessage(playerid, string);
PlayerInfo[id][info] = level;
return 1;
}
Thankfull for any help.