I want to make ONE function to reset the data in a enum separated, this enum have a lot of type variables.
Example:
PHP Code:
enum eAccount
{
bool:Alive,
Kills
};
new gPlayer[33][eAccount];
*If i want to reset the data from "Alive": Reset_gPlayer(Alive); then the function resets that variable(Alive) in all "33"(32) gPlayers
**If i want to reset the data from "Kills": Reset_gPlayer(Kills); then the function resets that variable(Kills) in all "33"(32) gPlayers
Theoretically the function would look something like this:
PHP Code:
Reset_gPlayer(var)
{
for(new i = 0; i < 33; ++i)
gPlayer[i][var] = 0;
}
This would work perfectly in other programming languages but it does not works in Pawn because when the variable is Boolean he can not take the value 0 or 1, only the values true and false.
If it had some function that returns the type of the variable, I could just do something like this:
PHP Code:
Reset_gPlayer(var)
{
for(new i = 0; i < 33; ++i)
if(isBool(var))
gPlayer[i][var] = false;
else
gPlayer[i][var] = 0;
}
I want this to automate my code and makes it cleaner. ---> To not put a lot of "for's" in my project.
I hope you understood my question now! Thanks...!