13.09.2017, 20:24
Quote:
Get weapon slot
Код:
stock GetWeaponSlot(weaponid) { switch(weaponid) { case 0,1: return 0; case 2,3,4,5,6,7,8,9: return 1; case 10,11,12,13,14,15: return 10; case 16,17,18: return 8; case 22,23,24: return 2; case 25,26,27: return 3; case 28,29,32: return 4; case 30,31: return 5; case 33,34: return 6; case 35,36,37,38: return 7; case 39: return 8; case 40: return 12; case 41,42,43: return 9; case 44,45,46: return 11; } return -1; } Код:
CMD:test(playerid, params[]) { new x[15]; format(x, sizeof(x), "Minigun slot: %d", GetWeaponSlot(38)); printf(x); return 1; } Код:
CMD:test2(playerid, params[]) { new x[23]; format(x, sizeof(x), "Your weapon slot is: %d", GetWeaponSlot(GetPlayerWeapon(playerid))); printf(x); return 1; } |
PHP код:
static const WSlot[] = {0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 10, 10, 10, 10, 10, 10, 8, 8, 8, -1, -1, -1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 4, 6, 6, 7, 7, 7, 7, 8, 12, 9, 9, 9, 11, 11, 11};
CMD:test(playerid, params[]) return printf("Minigun slot: %d", WSlot[38]);