17.12.2014, 01:34
When a player enters an area you loop through to find which area it is when found the iterator value references the index of the trashcan found. Save that value in a variable for instance CurrTrashArea[playerid] = i; then when a key press is made use
No need for any looping now and if you really want to top it off do this.
That way it won't do any extra code if there is consecutive key presses and they are not in the area the area is to -1 so they would have to actually enter the area to have it set again.
pawn Код:
if(IsPlayerInDynamicArea(playerid, TrashCans_InteractionField[CurrTrashArea[playerid]])) { }
pawn Код:
if(CurrTrashArea[playerid] > -1)
{
if(IsPlayerInDynamicArea(playerid, TrashCans_InteractionField[CurrTrashArea[playerid]])) { }
else CurrTrashArea[playerid] = -1;
}