Dynamicly locating enum by using string? - 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: Dynamicly locating enum by using string? (
/showthread.php?tid=381495)
Dynamicly locating enum by using string? -
oliverrud - 29.09.2012
I remember asking this question like a long time ago, never really got an answer so figured I'm gonna try again and see if anybody got some helpful insight.
I'm trying to figure out a way to get enum data available using a string instead.
I'm not sure how to explain it so I'm gonna come with an example:
pawn Код:
/Normally you would do:
enum testenum{
Test1,
Test2,
Test3,
Test4
};
new enumTest[testenum];
// You would then do for example:
enumTest[Test1]
// To get that variables data.
// Now what I'm trying to do is:
new string[4];
string="Test2";
enumTest[string]
Re: Dynamicly locating enum by using string? -
KingHual - 29.09.2012
You can't do that. enumTest is looking for an integer as its cell, not a set of characters. It would work if you did enumTest[string[0]], but it wont work with a whole string because its simply not an integer.
Re: Dynamicly locating enum by using string? -
oliverrud - 29.09.2012
Quote:
Originally Posted by king_hual
You can't do that. enumTest is looking for an integer as its cell, not a set of characters. It would work if you did enumTest[string[0]], but it wont work with a whole string because its simply not an integer.
|
What about a way to like check a enum and its content and then find the integer for that enum variable you're looking for.
Edit: by content I mean, the variables, like locate their variables integer/row location.