18.05.2010, 11:14
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; }