29.05.2018, 22:12
O problema й sу sintaxe.
Ao invйs de usar if, use switch:
Obs: Nгo compilei, mas deve estar tudo certo.
Obs2: Ctrl C, Ctrl V aqui no fуrum faz a identaзгo ficar louca. Quando for migrar para o seu cуdigo, arrume os erros, por favor
Ao invйs de usar if, use switch:
Код:
DarArmas(playerid) { if(IsPlayerConnected(playerid)) { new score = GetPlayerScore(playerid); switch(score){ case 0 .. 30:{ GivePlayerWeapon(playerid, 24, 500); } case 31 .. 80:{ GivePlayerWeapon(playerid, 24, 500); GivePlayerWeapon(playerid, 25, 500); } case 81 .. 150:{ GivePlayerWeapon(playerid, 24, 500); GivePlayerWeapon(playerid, 25, 500); GivePlayerWeapon(playerid, 29, 500); } case 151 .. 230:{ GivePlayerWeapon(playerid, 24, 500); GivePlayerWeapon(playerid, 25, 500); GivePlayerWeapon(playerid, 29, 500); } case 231 .. 320:{ GivePlayerWeapon(playerid, 24, 500); GivePlayerWeapon(playerid, 25, 500); GivePlayerWeapon(playerid, 29, 500); GivePlayerWeapon(playerid, 30, 1500); SetPlayerArmour(playerid, 20); } case 321 .. 450:{ GivePlayerWeapon(playerid, 24, 500); GivePlayerWeapon(playerid, 25, 500); GivePlayerWeapon(playerid, 29, 500); GivePlayerWeapon(playerid, 31, 1500); SetPlayerArmour(playerid, 20); } case 451 .. 700:{ GivePlayerWeapon(playerid, 24, 500); GivePlayerWeapon(playerid, 27, 500); GivePlayerWeapon(playerid, 29, 500); GivePlayerWeapon(playerid, 31, 1500); SetPlayerArmour(playerid, 20); } case 701 .. 1000:{ GivePlayerWeapon(playerid, 24, 500); GivePlayerWeapon(playerid, 27, 500); GivePlayerWeapon(playerid, 29, 500); GivePlayerWeapon(playerid, 31, 1500); SetPlayerArmour(playerid, 60); } case 1001 .. 1337:{ // Gostei da referкncia GivePlayerWeapon(playerid, 24, 500); GivePlayerWeapon(playerid, 27, 500); GivePlayerWeapon(playerid, 29, 500); GivePlayerWeapon(playerid, 34, 90); GivePlayerWeapon(playerid, 31, 1500); SetPlayerArmour(playerid, 60); } case 1337 .. 9999999:{ GivePlayerWeapon(playerid, 24, 500); GivePlayerWeapon(playerid, 27, 500); GivePlayerWeapon(playerid, 29, 500); GivePlayerWeapon(playerid, 34, 90); GivePlayerWeapon(playerid, 31, 1500); SetPlayerArmour(playerid, 100); GivePlayerWeapon(playerid, 37, 5); } } } return 1; }
Obs2: Ctrl C, Ctrl V aqui no fуrum faz a identaзгo ficar louca. Quando for migrar para o seu cуdigo, arrume os erros, por favor