Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* @combinations.inc - by Swedky (09/12/2016): http://forum.sa-mp.com/showthread.php?t=624081
- native SetCombination(&var, slot, value);
- native GetCombination(var, slot);
- */
- #if defined _combinations_included
- #endinput
- #endif
- #define _combinations_included
- stock SetCombination(&var, slot, value) // ~0.0035 ms
- {
- new comb[11];
- format(comb, 11, "%010i", var);
- switch(value)
- {
- case 1: comb[9 - slot] = '1';
- case 2: comb[9 - slot] = '2';
- case 3: comb[9 - slot] = '3';
- case 4: comb[9 - slot] = '4';
- case 5: comb[9 - slot] = '5';
- case 6: comb[9 - slot] = '6';
- case 7: comb[9 - slot] = '7';
- case 8: comb[9 - slot] = '8';
- case 9: comb[9 - slot] = '9';
- default: comb[9 - slot] = '0';
- }
- var = strval(comb);
- return 1;
- }
- stock GetCombination(var, slot) // ~0.002 ms
- {
- new comb[11];
- format(comb, 11, "%010i", var);
- switch(comb[9 - slot])
- {
- case '0': return 0;
- case '1': return 1;
- case '2': return 2;
- case '3': return 3;
- case '4': return 4;
- case '5': return 5;
- case '6': return 6;
- case '7': return 7;
- case '8': return 8;
- case '9': return 9;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement