04.10.2012, 10:53
Let's say i have 5 variables, and i want to change values in them...
How would i do this better and with less lines?
I curently have much more than only 5 variables and it's a pain to do it like shown above.
So is there a better way? Something like:
So i don't have to have so many if's?
Thank you.
pawn Код:
PlayerInfo[playerid][pSomething1];
PlayerInfo[playerid][pSomething2];
PlayerInfo[playerid][pSomething3];
PlayerInfo[playerid][pSomething4];
PlayerInfo[playerid][pSomething5];
pawn Код:
if(!strcmp(method, "pSomething1", true)) { code for changing pSomething1 }
if(!strcmp(method, "pSomething2", true)) { code for changing pSomething2 }
if(!strcmp(method, "pSomething3", true)) { code for changing pSomething3 }
if(!strcmp(method, "pSomething4", true)) { code for changing pSomething4 }
if(!strcmp(method, "pSomething5", true)) { code for changing pSomething5 }
So is there a better way? Something like:
pawn Код:
PlayerInfo[playerid][p%s]
Thank you.