Jump to content

Rivskyy

Members
  • Posts

    5
  • Joined

  • Last visited

About Rivskyy

  • Birthday April 1

Rivskyy's Achievements

Vic

Vic (3/54)

0

Reputation

  1. Okay I solved My problem I know what I did wrong I haven't written getElementData in function where I add new tire to trunk and that wasn't work properly but now everything is okay,Thanks to all for help ;]
  2. It works but It dont change the value when I for example hit pickup with attached setElementData with false,I would like to make this like Tires is in trunk--->player repaired wheel-->no tire's in trunk-->player have to go on pickup or marker to get another new and loop from beggining. Thank's for your help you gave me another few's solution's :]
  3. I tried with : setElementData and getElementData but it don't work. I tried it like: function bagaznik(player) setElementData(vehicle2, "trunkTires",1) vehicle2 = getPedOccupiedVehicle(player) if isElement(vehicle2) then if getVehicleDoorOpenRatio(vehicle2,1) > 0 then setVehicleDoorOpenRatio(vehicle2,1,0) else tires=getElementData(vehicle2, "trunkTires") if tires>0 then setElementData(vehicle2, "trunkTires",tires-1) element = getPedOccupiedVehicle(player) x,y,z = pozycja(element,0,-3,-1) myMarker =createMarker ( x , y, z, "cylinder", 1.5, 255, 255, 0, 170 ) addEventHandler("onMarkerHit", myMarker, sprawdzstan) setVehicleDoorOpenRatio(vehicle2,1,1) end end end addCommandHandler("trunk",bagaznik) but getElementData havent update the value of tires left and it get only that 1 from the beggining,I suppose that reason of this problem is that I take setElementData in function and It's set 1 every time I open trunk,I tried getElementData from other function to prevent this situation but I don't know how to set new value in other function becouse it will still get the first value.I will try other option like variable=1 and if variable>0 then... or with other options, if you have another idea to let it work let me know and thank You for help :]
  4. Thank you for answer I will try it when I will have some time
  5. Hey, I want to do a function witch will give a player a object (tire) and I want to give it only once (limit of tires in trunk). Is there a way to do it? My script is serverside,I am begginer in scripting so dont hate me :] My script: function bagaznik(player) vehicle2 = getPedOccupiedVehicle(player) if isElement(vehicle2) then if getVehicleDoorOpenRatio(vehicle2,1) > 0 then setVehicleDoorOpenRatio(vehicle2,1,0) else element = getPedOccupiedVehicle(player) x,y,z = pozycja(element,0,-3,-1) myMarker =createMarker ( x , y, z, "cylinder", 1.5, 255, 255, 0, 170 ) addEventHandler("onMarkerHit", myMarker, sprawdzstan) setVehicleDoorOpenRatio(vehicle2,1,1) end end end addCommandHandler("trunk",bagaznik) --This funciton makes trunk open and create marker behind trunk and if you touch marker it run function sprawdzstan function sprawdzstan(thePlayer) if stan(thePlayer)==0 then outputChatBox("#ffea00"..getVehicleName ( vehicle ).." jest sprawny: ",getRootElement(),r,g,b, true ) outputChatBox ( "#ffea00Lewy-Przod: " .. stany [ lewyprzod ] .. " #ffea00Prawy-Przod: " .. stany [ prawyprzod ] .." #ffea00Lewy-tyl: " .. stany [ lewytyl ] .. " #ffea00Prawy-Tyl: " .. stany [ prawytyl ],getRootElement(),r,g,b, true ) setVehicleDoorOpenRatio(vehicle,1,0) destroyElement(myMarker) else outputChatBox("#ffea00"..getVehicleName ( vehicle ).." jest zepsuty: ",getRootElement(),r,g,b, true ) outputChatBox ( "#ffea00Lewy-Przod: " .. stany [ lewyprzod ] .. " #ffea00Prawy-Przod: " .. stany [ prawyprzod ] .. " #ffea00Lewy-tyl: " .. stany [ lewytyl ] .. " #ffea00Prawy-Tyl: " .. stany [ prawytyl ],getRootElement(),r,g,b, true ) outputChatBox("By naprawić zepsute koło podejdz do pojazdu i odczekaj 5 sekund") playanim(thePlayer) end end --this function check if car wheels are damaged or not if not it output they are in good condition and destroy marker and close trunk --if wheels are damaged it output they are damaged and run playanim function playanim(thePlayer) poprawka(thePlayer) setPedAnimation(thePlayer,"carry","crry_prtial",0,true,true,false,true) setTimer(function()setVehicleWheelStates ( vehicle, 0, 0, 0, 0 ) destroyElement(object) setPedAnimation(thePlayer,"carry","crry_prtial",0,true,true,false,false) destroyElement(myMarker) setVehicleDoorOpenRatio(vehicle,1,0) end,5000,1) end --this function set player animation to carry a object set on arms and after 5 seconds repair wheels in car destroy marker and set trunk close function poprawka(thePlayer) x,y,z=getElementPosition(thePlayer ) object =createObject (1327,x,y,z) setObjectScale(object,0.3) attachElements(object, thePlayer,-0.05,0.5,0.2,0,90,-100) setElementCollisionsEnabled(object, false) end -- function to set tire on player arms function pozycja(element,offX,offY,offZ) local m = getElementMatrix ( element ) -- Get the matrix local x = offX * m[1][1] + offY * m[2][1] + offZ * m[3][1] + m[4][1] -- Apply transform local y = offX * m[1][2] + offY * m[2][2] + offZ * m[3][2] + m[4][2] local z = offX * m[1][3] + offY * m[2][3] + offZ * m[3][3] + m[4][3] return x, y, z -- Return the transformed point end --function requried to get position of trunk function getNearestVehicle( thePlayer ) local x, y, z = getElementPosition( thePlayer ) for i, v in ipairs( getElementsByType( "vehicle" ) ) do local distance = getDistanceBetweenPoints3D( x, y, z, getElementPosition( v ) ) if distance <12 then nearestVehicle = v end end return nearestVehicle or false end --get distance and id etc. of the nearest car function stan ( thePlayer) vehicle=getNearestVehicle( thePlayer ) stany = { [0]="#099e34Pełna", [1]="#FF0000Bez powietrza", [2]="#FF0000Odpadnięte koło" } lewyprzod, lewytyl, prawyprzod, prawytyl = getVehicleWheelStates ( vehicle ) if lewyprzod==1 or lewytyl==1 or prawyprzod==1 or prawytyl==1 then else return lewyprzod, lewytyl, prawyprzod, prawytyl,stany end end --check car wheels condition that if is required to work sprawdzstan --Script written by Rivsky :] I want a limit in bagazanik function like: Player open trunk and take's one tire,repair a tire and In second time when he puncture the tire and open trunk the output say the Trunk is empty and after get into the car car and get out of the car the trunk don't reset and will be still empty until I reset script. If something is incomprehensible write here and I'll explain you and sorry If my English was not understandable :]
×
×
  • Create New...