03.05.2014, 21:28
So in the past few days i've been working on some system, everything is fine, but one thing, one of these 2 codes are wrong, when i create 10 objects, and use the function to destroy em, 9 objects are destroyed but 1 can not be destroyed, i really dont know why, so please help me if you know how to.
// Creating Objects
// Destroying Objects
// Creating Objects
Код:
if(FarmerRadi[playerid] == 1 && FarmerUbacio[playerid] == 1) { if(GetVehicleModel(GetClosestVehicle(playerid)) == 531 ) { new Float:Pos[3], str[250], ajdi = ZasadioPsenice[playerid]; for(new id = 0; id < 10; id++) { GetDynamicObjectPos(FarmerObjekt[playerid][id], Pos[0], Pos[1], Pos[2]); if(IsPlayerInRangeOfPoint(playerid, 7.0, Pos[0], Pos[1], Pos[2])) return 1; } ZasadioPsenice[playerid] ++; GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]); FarmerObjekt[playerid][ajdi] = CreateDynamicObject(855, Pos[0], Pos[1], Pos[2], 0.00000000,0.00000000,0.00000000); format(str, sizeof(str), "{FFFFFF}[Plantaza Psenice]\nZasadio: {00FFEE}%s\n{FFFFFF}Preradjeno: {00FFEE}NE", ImeIgraca(playerid)); FarmerLabel[ajdi] = CreateDynamic3DTextLabel(str, LIGHTBLUE, Pos[0], Pos[1], Pos[2], 30, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 100.0); if(ZasadioPsenice[playerid] == 10) { FarmerPosejano[playerid] = 1; FarmerUbacio[playerid] = 0; } } }
Код:
if(!IsPlayerInAnyVehicle(playerid) && FarmerPosejano[playerid] == 1) { new Float:Pos[3], Farmer_Slot = -1; for(new id = 0; id < 10; id++) { if(UsevSpusten[id] == 1) { GetDynamicObjectPos(FarmerObjekt[playerid][id], Pos[0], Pos[1], Pos[2]); if(IsPlayerInRangeOfPoint(playerid, 2.0, Pos[0], Pos[1], Pos[2]+3)) { Farmer_Slot = id; } } } if(Farmer_Slot != -1) { if(UzeoUsev[playerid] == 1) return SCM(playerid, TOMATO, " (greska) Vec ste pokupili jedan usev, odnesite ga u staju !"); SetPlayerAttachedObject(playerid, 0, 2901, 1, -0.022000, -0.212999, -0.007000, 0.000000, -2.099999, -2.599998, 0.612999, 0.439000, 0.607999, 0, 0); SCM(playerid, YELLOW, " (info) Uspesno ste uzeli usev, odnesite ga u staju !"); UzeoUsev[playerid] = 1; DestroyDynamicObject(FarmerObjekt[playerid][Farmer_Slot]); } } }