Check if players is an area fail
#1

i have this custom callback
Код:
forward verfica_tunde_iarba(playerid,Float:x1, Float:x2, Float:y1,Float:y2,Float:p1, Float:p2, Float:p3);
public verfica_tunde_iarba(playerid,Float:x1, Float:x2, Float:y1,Float:y2,Float:p1, Float:p2, Float:p3)
   {
			new Float:x,Float:y,Float:z;
            GetPlayerPos(playerid, x, y, z);
            if(x!=p1 && y!=p2 && z!=p3)
                {
		            if (x >= x1 && x <= x2 && y >= y1 && y <= y2)
						{
						    salariu[playerid]=400+random(100);
		               		GivePlayerMoney(playerid, salariu[playerid]);
		           		}
					else
						{
					        SetVehicleToRespawn(GetPlayerVehicleID(playerid));
					        SendClientMessage(playerid, 0xFF0000FF, "Ai iesit din aria locului de munca.");
					        KillTimer(verifica_zona_iarba[playerid]);
					    }
				}
			else
			{
			    SetVehicleToRespawn(GetPlayerVehicleID(playerid));
   				SendClientMessage(playerid, 0xFF0000FF, "Ai stat pe loc mai mult de 4 secunde.");
   				KillTimer(verifica_zona_iarba[playerid]);
			}
   }
and this condition

Код:
 if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER && GetVehicleModel(GetPlayerVehicleID(playerid)) == 572 && (GetPlayerVehicleID(playerid) == tractor_tuns_iarba[0] || GetPlayerVehicleID(playerid) == tractor_tuns_iarba[1] || GetPlayerVehicleID(playerid) == tractor_tuns_iarba[2] || GetPlayerVehicleID(playerid) == tractor_tuns_iarba[3] || GetPlayerVehicleID(playerid) == tractor_tuns_iarba[4] ))
	    {
	        SendClientMessage(playerid,0xFF9300FF, "Tunde iarba ca sa castigi bani.");
	        SendClientMessage(playerid,0xFF9300FF, "Atentie daca iesi din parc masina va primi respawn.");
	        SendClientMessage(playerid,0xFF9300FF, "Daca stai pe loc masina se va spawna.");
	        new Float:x,Float:y,Float:z;
        	GetPlayerPos(playerid,x,y,z);
	        verifica_zona_iarba[playerid] = SetTimerEx("verfica_tunde_iarba",4000,true,"ifffffff",playerid,x,y,z,734.6541,776.8536,-1308.4094,-1220.4283);

	    }
	 else if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER && GetVehicleModel(GetPlayerVehicleID(playerid)) == 572 && (GetPlayerVehicleID(playerid) == tractor_tuns_iarba[5] || GetPlayerVehicleID(playerid) == tractor_tuns_iarba[6] || GetPlayerVehicleID(playerid) == tractor_tuns_iarba[7] || GetPlayerVehicleID(playerid) == tractor_tuns_iarba[8] || GetPlayerVehicleID(playerid) == tractor_tuns_iarba[9] ))
	    {
	        SendClientMessage(playerid,0xFF9300FF, "Tunde iarba ca sa castigi bani.");
	        SendClientMessage(playerid,0xFF9300FF, "Atentie daca iesi din parc masina va primi respawn.");
	        SendClientMessage(playerid,0xFF9300FF, "Daca stai pe loc masina se va spawna.");
	        new Float:x,Float:y,Float:z;
        	GetPlayerPos(playerid,x,y,z);
	        verifica_zona_iarba[playerid] = SetTimerEx("verfica_tunde_iarba",4000,true,"ifffffff",playerid,x,y,z,1888.9542,2055.1140,-1248.7961,-1147.8855);

	    }
though i was on 2039.6077,-1210.4742,23.0389, the car was respawned, why, where i mistake?


//---------------------------------------------------------------------------------------

i put
Код:
verifica_zona_iarba[playerid] = SetTimerEx("verfica_tunde_iarba",4000,true,"ifffffff",playerid,x,y,z,1888.9542,2055.1140,-1248.7961,-1147.8855);
instead of

Код:
verifica_zona_iarba[playerid] = SetTimerEx("verfica_tunde_iarba",4000,true,"ifffffff",playerid,1888.9542,2055.1140,-1248.7961,-1147.8855,x,y,z,);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)