Return in a for()-loop
#1

Following question:

I've made a serversided anti-weapon hack. Sometimes it's kinda buggy, because it detects player, who have no guns. So I've tried to skip players without guns in the weapon-check for the specific slot (Like Player1 has in slot 0 no guns -> The check skips this slot and continue checking for slot 1, and so on..).

Код:
public ACSUpdate(playerid)
{
	if(GetPVarInt(playerid, "Spawned") == 1)
	{
		for(new slot; slot < 11; slot++)
		{
			GetPlayerWeaponData(playerid, slot, WeaponCheck[playerid][slot], WeaponAmmoCheck[playerid][slot]);
			if(WeaponCheck[playerid][slot] == 0 && WeaponAmmoCheck[playerid][slot] == 0) return 0; // Here is the problem..
			if(Weapon[playerid][slot] != WeaponCheck[playerid][slot] || WeaponAmmo[playerid][slot] - WeaponAmmoCheck[playerid][slot] < 0 || WeaponAmmoCheck[playerid][slot] < 0)
			{
				ACSKick(playerid, "Waffen/Ammo Hack");
			}
		}
	}
	return 1;
}
How can I return to the for()-loop without stopping the whole function?


Thanks for help
Reply


Messages In This Thread
Return in a for()-loop - by XCarBOn - 21.07.2013, 10:01
Re: Return in a for()-loop - by Misiur - 21.07.2013, 10:03
Re: Return in a for()-loop - by XCarBOn - 21.07.2013, 10:06
Re: Return in a for()-loop - by Misiur - 21.07.2013, 10:12
Re: Return in a for()-loop - by XCarBOn - 21.07.2013, 10:14

Forum Jump:


Users browsing this thread: 1 Guest(s)