if(pInfo[playerid][IsPlayerInfected] == 0) { new slot, weap, ammo; for ( slot = 0; slot < 14; slot++ ) { GetPlayerWeaponData(playerid,slot,weap,ammo); if(IsValidWeapon(weap)) { new randomselect = random(3); // i put random 5 because i want give a chance win nothing. switch(randomselect) { case 0: { new randomammo = random(15); GivePlayerWeapon(playerid,weap,randomammo); format(sudasnx,sizeof(sudasnx),""COL_WHITE"|: You picked something"); SendClientMessage(playerid,-1,sudasnx); DestroyPickup(meatDrops[playerid]); }
Break from loop or use return to break from function its self when a match or true statement occurred.
|
new randomammo = random(15); GivePlayerWeapon(playerid,weap,randomammo); format(sudasnx,sizeof(sudasnx),""COL_WHITE"|: You picked something"); SendClientMessage(playerid,-1,sudasnx); DestroyPickup(meatDrops[playerid]); break;
if(pInfo[playerid][IsPlayerInfected] == 0) { new slot, weap, ammo; for ( slot = 0; slot < 14; slot++ ) { GetPlayerWeaponData(playerid,slot,weap,ammo); if(IsValidWeapon(weap)) { new randomselect = random(3); // i put random 5 because i want give a chance win nothing. switch(randomselect) { case 0: { new randomammo = random(15); GivePlayerWeapon(playerid,weap,randomammo); format(sudasnx,sizeof(sudasnx),""COL_WHITE"|: You picked something"); SendClientMessage(playerid,-1,sudasnx); DestroyPickup(meatDrops[playerid]); return 1; }