06.10.2013, 22:15
Tip/Trick Title: Enumerator & Loop
Tip/Trick Description: Easy to loop an Enumerator, nothing much too explain.
Tip/Trick Example(Use PAWN tags):
Tip/Trick Description: Easy to loop an Enumerator, nothing much too explain.
Tip/Trick Example(Use PAWN tags):
pawn Code:
enum debug//Enumerator
{
debug1, debug2, debug3, debug 4;
}
new debug[ MAX_PLAYERS ][ debug ];
CMD:setenumto1(playerid, params[]) // debug purposes
{
debug1[playerid][debug1] = 1;
debug1[playerid][debug2] = 1;
debug1[playerid][debug3] = 1;
debug1[playerid][debug4] = 1;
printf("[DEBUG]: %i, %i, %i, %i", debug1, debug2, debug3, debug4);
//DEBUG result ( [DEBUG]: 1, 1, 1, 1)
}
//new process | shorter version
CMD:resetenum(playerid, params[])
{
for(new i; robbingshop:i < robbingshop; i++) { debug[ playerid ][ robbingshop:s ] = 0; } return 1;
printf("[DEBUG]: %i, %i, %i, %i", debug1, debug2, debug3, debug4);
//DEBUG result ( [DEBUG]: 0, 0, 0, 0 )
}
//instead of | longer version
CMD:resetenum1(playerid, params[])
{
debug1[playerid][debug1] = 0;
debug1[playerid][debug2] = 0;
debug1[playerid][debug3] = 0;
debug1[playerid][debug4] = 0;
printf("[DEBUG]: %i, %i, %i, %i", debug1, debug2, debug3, debug4);
//DEBUG result ( [DEBUG]: 0, 0, 0, 0 )
}