[HELP] String in Enum -
OmeRinG - 05.04.2009
Hello, I am currently working on a TDM mode and I want to make a PlayerInfo variable to store data as admin level and such... well I succedd stroing admin levels but when I try to store data as team name or something like that I get errors...
this is what i've done:
enum pInfo {
admin,
level,
kills,
team[256]
};
new PlayerInfo[MAX_PLAYERS][pInfo];
---------
but when I try to do:
PlayerInfo[playerid][team] = "none";
for example, I get some errors like array sizes does not much and more....
someone gave me the following code to write in this variable that works:
strmid(PlayerInfo[playerid][team], "none", 0, strlen("none"), 256);
but when I try to read:
if (PlayerInfo[playerid][team] = "agent") { AgentRandomSpawnPlayer(playerid); }
I get these errors:
warning 211: possibly unintended assignment
error 047: array sizes do not match, or destination array is too small
someone knows what's the problem?
Re: [HELP] String in Enum -
[M2S]moe - 05.04.2009
You forgot an "=" sign in there:
if (PlayerInfo[playerid][team] = "agent") { ElvisRandomSpawnPlayer(playerid); }
change to:
if (PlayerInfo[playerid][team] == "agent") { ElvisRandomSpawnPlayer(playerid); }
but just doing this will not work I dont think, you need to use strmid.
Re: [HELP] String in Enum -
OmeRinG - 05.04.2009
damn i'm stupid...
but yet there's a new error:
array must be indexed (variable "-unknown-")
Re: [HELP] String in Enum -
[M2S]moe - 05.04.2009
ah sorry you replied to quick read my post again I edited
Re: [HELP] String in Enum -
OmeRinG - 05.04.2009
ok I've read.... I'll try to use strmid and i'll check if it works...
EDIT:
i'm so damn stupid, I should have used strcmp in the start -.- I used string = string instead of strcmp....
this works without strmid and stuff like that:
if (!strcmp(PlayerInfo[playerid][team],"agent",true)) { AgentRandomSpawnPlayer(playerid); }
Re: [HELP] String in Enum -
[M2S]moe - 05.04.2009
yep good job
Re: [HELP] String in Enum -
FUNExtreme - 05.04.2009
enum pInfo[][amount of vars in the enum]