[HELP PLS] Location Update Script Bug
#1

Hey Please check this for me. After three minutes it doesnt update anymore.



Код:
//Zone Update
//=============================================================================

#include <zones>
#include <a_samp>

new player_zone[MAXPLAYERS];

forward update_zones();
public update_zones()
{
	for(new i=0; i<MAXPLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
  			if(IsPlayerInZone(i,player_zone[i]))
 			{
		 	}
			else
		  	{
  			new player_zone_before;
  			player_zone_before = player_zone[i];
  			player_zone[i] = -1;

  			for(new j=0; j<sizeof(zones);j++)
				{
   				if(IsPlayerInZone(i,j) && player_zone[i] == -1)
			 		{
   					player_zone[i] = j;
   				}
  			}
  			if(player_zone[i] == -1) player_zone[i] = player_zone_before;
  			}
 		}
 	}
}

//=============================================================================

IsPlayerInZone(playerid, zoneid)
{
	if(zoneid == -1) return 0;
	new Float:x, Float:y, Float:z;
	GetPlayerPos(playerid,x,y,z);
	if(x >= zones[zoneid][zone_minx] && x < zones[zoneid][zone_maxx]
	&& y >= zones[zoneid][zone_miny] && y < zones[zoneid][zone_maxy]
	&& z >= zones[zoneid][zone_minz] && z < zones[zoneid][zone_maxz]
	&& z < 900.0) return 1;
	return 0;
}
Reply
#2

show the timer plz
Reply
#3

Код:
SetTimer("update_zones",2000,true);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)