[YARDIM] Araçtan İnince Otomatik Silinme

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

Çevrimdışı GreeN

  • Yeni Üye
  • *
    • İleti: 24
: 16 Nisan 2019, 14:49:42
Arkadaşlar bi tane tır görevi vardı rusçadan türkçe çevirdim %100 dileyen kullanabilir fakat tek sorunu var tırdan inince araç silinmiyor bu konuda biraz bilgisizim yardımcı olabilicek var mı ?

Linki görebilmek için Kayıt olun yada Giriş yapın.

Güvenmeyenler için virustotal linki : Linki görebilmek için Kayıt olun yada Giriş yapın.

Daha da güvenmem diyenler için :

job_client.lua :

Spoiler for Hiden:
g_Me        = getLocalPlayer()
gRoot       = getRootElement()
gResRoot    = getResourceRootElement( getThisResource () )
local screenW, screenH = guiGetScreenSize()

local jobPos = {
{"San Fiero","İlaç",95000,-2665.13135, 625.13867, 14.4531320000,435},
{"San Fiero","Yapı Malzemeleri",54000,-2071.92603, 279.30530, 35.3120018000,450},
{"Las Venturas","Yakıt",27000,1663.88989, 1631.08630, 10.82031,584},
{"Las Venturas","Yapı Malzemeleri",24000,2467.72559, 1929.98474, 9.76563,450},
{"San Fiero","Yakıt",67000,-1367.79016, -488.79987, 14.17188,584},
{"Los Santos","Yakıt",99000,2012.68701, -2188.51440, 13.54688,584},
{"Los Santos","İlaç",48000,2003.87732, -1415.97266, 16.99219,435},
--{"Las Venturas","Yakıt",10000,2855.82568, 915.33087, 10.75000,584}
}
local skins = {
{"Native Rancher", 128},
{"Furys Trucker", 133},   
{"Trucker Girl", 201},
{"Beer Trucker", 202},
{"Money Trucker", 206}
}
local vehicle = {
{"Roadtrain", 515},
{"Tanker", 514},   
{"Linerunner", 403}       
}   
local vehicleJob = { [515]=true, [514]=true, [403]=true }

function create3Dtext(markerName,text,z1)
      local x, y, z = getElementPosition( markerName )
      local cx, cy, cz = getCameraMatrix()
      if isLineOfSightClear( cx, cy, cz, x, y, z, false, false, false, false, false, false, false, markerName ) then
        local distance = getDistanceBetweenPoints3D( cx, cy, cz, x, y, z )
        if distance < 15 then
          local px, py = getScreenFromWorldPosition( x, y, z + z1, 0.06 )
            if px then
           dxDrawFramedText ( tostring(text),px, py,px, py, tocolor( 255, 255, 255, 255 ) , ( screenW/ 1440 ) * 2 , "default-bold" , "center" , "center" , false , false , false )
            end
          end
       
      end
   end

function dxDrawFramedText ( message , left , top , width , height , color , scale , font , alignX , alignY , clip , wordBreak , postGUI )
   dxDrawText ( message , left + 1 , top + 1 , width + 1 , height + 1 , tocolor ( 0 , 0 , 0 , 255 ) , scale , font , alignX , alignY , clip , wordBreak , postGUI )
   dxDrawText ( message , left + 1 , top - 1 , width + 1 , height - 1 , tocolor ( 0 , 0 , 0 , 255 ) , scale , font , alignX , alignY , clip , wordBreak , postGUI )
   dxDrawText ( message , left - 1 , top + 1 , width - 1 , height + 1 , tocolor ( 0 , 0 , 0 , 255 ) , scale , font , alignX , alignY , clip , wordBreak , postGUI )
   dxDrawText ( message , left - 1 , top - 1 , width - 1 , height - 1 , tocolor ( 0 , 0 , 0 , 255 ) , scale , font , alignX , alignY , clip , wordBreak , postGUI )
   dxDrawText ( message , left , top , width , height , color , scale , font , alignX , alignY , clip , wordBreak , postGUI )
end
 
addEventHandler ( "onClientResourceStart",gResRoot,
   function()
          markeJob = createMarker( 2811.02246, 892.47406, 9, 'Cylinder', 3, 255, 0, 0,0 )
        markerVehicle = createMarker( 2804.195, 957.67, 8.7, 'Cylinder',3, 150, 255, 0, 150  )
        JobPed = createPed ( 202,2811.02246, 892.47406, 10.75780 )
        setPedFrozen ( JobPed, not isPedFrozen ( JobPed ) )
        addEventHandler ( "onClientPedDamage" , JobPed ,damage)
end)

function damage( )
      cancelEvent ( )
   end

addEventHandler ( 'onClientRender', gRoot,
 function()
        create3Dtext(markerVehicle,"İş İlanları",3 )
        create3Dtext(JobPed,"Şöför Mesleği",1 )
end)
   
--===============================================Gui окна===================================================--
GUIEditor = {
    gridlist = {},
    button = {},
    window = {},
}

GUIEditor.window[1] = guiCreateWindow((screenW - 330) / 2, (screenH - 307) / 2, 330, 307, "Kargo seçimi", false)
guiWindowSetSizable(GUIEditor.window[1], false)
guiSetVisible(GUIEditor.window[1],false)
GUIEditor.gridlist[1] = guiCreateGridList(9, 23, 311, 239, false, GUIEditor.window[1])
guiGridListAddColumn(GUIEditor.gridlist[1], "Şehir", 0.3)
guiGridListAddColumn(GUIEditor.gridlist[1], "Yük", 0.3)
guiGridListAddColumn(GUIEditor.gridlist[1], "Ödeme", 0.3)
GUIEditor.button[1] = guiCreateButton(10, 267, 121, 30, "Seç", false, GUIEditor.window[1])
guiSetFont(GUIEditor.button[1], "default-bold-small")
guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFFFFFFF")
for i,data in ipairs(jobPos) do
         local row = guiGridListAddRow(GUIEditor.gridlist[1])
         guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, data[1], false, false)
       guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, {data[3],data[4],data[5],data[6],data[7]})
       guiGridListSetItemText(GUIEditor.gridlist[1], row, 2, data[2], false, false)
       guiGridListSetItemText(GUIEditor.gridlist[1], row, 3, data[3], false, false)
end
GUIEditor.window[2] = guiCreateWindow((screenW - 330) / 2, (screenH - 307) / 2, 330, 307, "Şöför Mesleği", false)
guiWindowSetSizable(GUIEditor.window[2], false)
guiSetVisible(GUIEditor.window[2],false)
GUIEditor.gridlist[2] = guiCreateGridList(9, 23, 311, 239, false, GUIEditor.window[2])
guiGridListAddColumn(GUIEditor.gridlist[2], "Karakter", 0.9)
GUIEditor.button[3] = guiCreateButton(10, 267, 121, 30, "Çalışma", false, GUIEditor.window[2])
guiSetFont(GUIEditor.button[3], "default-bold-small")
guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FFFFFFFF")
GUIEditor.button[4] = guiCreateButton(199, 267, 121, 30, "X", false, GUIEditor.window[2])
guiSetFont(GUIEditor.button[4], "default-bold-small")
guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FFFFFFFF")
for i,s in ipairs(skins) do
         local row = guiGridListAddRow(GUIEditor.gridlist[2])
         guiGridListSetItemText(GUIEditor.gridlist[2], row, 1, tostring(s[1]), false, false)
         guiGridListSetItemData(GUIEditor.gridlist[2], row, 1, tostring(s[2]))
end
GUIEditor.window[3] = guiCreateWindow((screenW - 330) / 2, (screenH - 307) / 2, 330, 307, "İş Seçimi", false)
guiWindowSetSizable(GUIEditor.window[3], false)
guiSetVisible(GUIEditor.window[3],false)
GUIEditor.gridlist[3] = guiCreateGridList(9, 23, 311, 239, false, GUIEditor.window[3])
guiGridListAddColumn(GUIEditor.gridlist[3], "Taşıma", 0.9)
GUIEditor.button[5] = guiCreateButton(10, 267, 121, 30, "Seç", false, GUIEditor.window[3])
guiSetFont(GUIEditor.button[5], "default-bold-small")
guiSetProperty(GUIEditor.button[5], "NormalTextColour", "FFFFFFFF")
GUIEditor.button[6] = guiCreateButton(199, 267, 121, 30, "X", false, GUIEditor.window[3])
guiSetFont(GUIEditor.button[6], "default-bold-small")
guiSetProperty(GUIEditor.button[6], "NormalTextColour", "FFFFFFFF")
for i,v in ipairs(vehicle) do
         local row = guiGridListAddRow(GUIEditor.gridlist[3])
         guiGridListSetItemText(GUIEditor.gridlist[3], row, 1, tostring(v[1]), false, false)
         guiGridListSetItemData(GUIEditor.gridlist[3], row, 1, tostring(v[2]))
end
--==================================================================================================--

addEventHandler( "onClientGUIClick", gRoot,
      function ()
        if source == GUIEditor.button[1] then
           local row, col = guiGridListGetSelectedItem(GUIEditor.gridlist[1])
           local data = guiGridListGetItemData(GUIEditor.gridlist[1], row, col)
              if row and col and row ~= -1 and col ~=-1 then
                money, x, y, z,trailer_id = unpack(data)
              closeGui(GUIEditor.window[1])
              OpenGui(GUIEditor.window[3])
           end                         
        elseif source == GUIEditor.button[3] then
         local skin_id = guiGridListGetItemData( GUIEditor.gridlist[2], guiGridListGetSelectedItem( GUIEditor.gridlist[2] ) )
                if skin_id then
              setElementData(g_Me,'Job',1)
                  triggerServerEvent("SetSkin", g_Me, skin_id)
              closeGui(GUIEditor.window[2])    
               end 
       elseif source == GUIEditor.button[5] then
           local vehicle_id = guiGridListGetItemData( GUIEditor.gridlist[3], guiGridListGetSelectedItem( GUIEditor.gridlist[3] ) )
                if vehicle_id then
               triggerServerEvent ( "SetVehicle", g_Me,vehicle_id,trailer_id)
               createM( g_Me,x, y, z )
               closeGui(GUIEditor.window[3])
            end    
        elseif source == GUIEditor.button[2] then
              closeGui(GUIEditor.window[1])
      elseif source == GUIEditor.button[6] then
              closeGui(GUIEditor.window[3])    
         end
    end
    )
   
function closeGui(windows_id)
if guiGetVisible(windows_id) == true then
  guiSetVisible(windows_id,false)
  showCursor(false)
 end
end

function OpenGui(windows_id)
if guiGetVisible(windows_id) == false then
  guiSetVisible(windows_id,true)
  showCursor(true)
 end
end

function createM( thePlayer,x, y, z )
        if (  isElement ( marker ) ) and ( isElement ( blip ) ) then
        RemoveMarker()
   end      
   marker = createMarker ( x, y, z, "cylinder", 15, 255, 255, 255, 90,thePlayer )
   blip = createBlipAttachedTo (marker, 56, 2, 255, 0, 0, 255, 0, 99999999,thePlayer)
end

function RemoveMarker()
if isElement(marker) then
   destroyElement(marker)
end
if isElement(blip) then
   destroyElement(blip)
end
end

function wasted ( )
   if (  isElement ( marker ) ) and ( isElement ( blip ) ) then
        RemoveMarker()
   end      
end
addEventHandler ( "onClientPlayerWasted", g_Me, wasted )
addEventHandler( "onClientPlayerQuit", g_Me, wasted )

addEventHandler ("onClientMarkerHit",gRoot,
function( hitElement, matchingDimension )
  if getElementType(hitElement) == "player" and (hitElement == g_Me) then
   if ( source == marker ) then
      local vehicle = getPedOccupiedVehicle(hitElement)
      if vehicle and getVehicleController(vehicle) == hitElement and vehicleJob[getElementModel(vehicle)] then
        if ( getElementData ( vehicle, "JobVeh" ) ) then
        outputChatBox("Maaşınız verildi #ffffff"..money.."#00ff00$" , 0, 255, 0, true )
          triggerServerEvent("RemoveVehicle", hitElement,money)            
         RemoveMarker()
      else
        outputChatBox("Hey o kamyon değil", 255, 0, 0, true )
        end
        else
        outputChatBox("Haha, bisiklete geri döner misin, palyaço..", 255, 255, 0, true )
        end
      elseif ( source == markeJob ) then         
        if  getElementData(hitElement,'Job') then
                outputChatBox("Zaten bu işi aldın!", 255, 0, 0, true )            
            return
         end
          OpenGui(GUIEditor.window[2])
      elseif ( source == markerVehicle ) then
      if not isPedInVehicle ( hitElement ) then
          if not getElementData(hitElement,'Job') then
                   outputChatBox("Araçlar sadece bir kamyon şoförü olarak çalışan kişilere verilir.", 255, 0, 0, true )            
            return
         end
          OpenGui(GUIEditor.window[1])
       end
      end
    end
end            
)
   




job-server.lua :

Spoiler for Hiden:
gResRoot    = getResourceRootElement( getThisResource () )
createBlip ( 2821.25488, 913.54309, 9.75000, 51,2, 255, 0, 0, 255, 0, 500 )

function joinPilot(id)
     setElementModel(source, id)
end
addEvent("SetSkin", true)
addEventHandler("SetSkin",root,joinPilot)

local vehicles ={}
local trailer ={}

function vehicle(vehicle_id,trailer_id)
   if ( isElement ( vehicles[source] ) ) and (  isElement ( trailer[source] ) ) then
     removeVeh(source)
    end
    vehicles[source] = createVehicle ( tostring(vehicle_id), 2804.61792, 958.13171, 11.69443,0,0,180)
     trailer[source] = createVehicle ( tostring(trailer_id), 2804.61792, 967.13171, 11.69443,0,0,180 )
                  attachTrailerToVehicle ( vehicles[source], trailer[source] )
               warpPedIntoVehicle(source, vehicles[source])
            setElementData ( vehicles[source], "JobVeh", true )
end
addEvent("SetVehicle", true)
addEventHandler("SetVehicle",root,vehicle)

function removeVeh(thePlayer)
        if isElement(vehicles[thePlayer]) then
        destroyElement(vehicles[thePlayer])
      end
       if isElement(trailer[thePlayer]) then
        destroyElement(trailer[thePlayer])
      end
end

function finish(money)
   if ( isElement ( vehicles[source] ) ) and (  isElement ( trailer[source] ) ) then
     removeVeh(source)
    end
    givePlayerMoney ( source, money )
end
addEvent("RemoveVehicle", true)
addEventHandler("RemoveVehicle",root,finish)

function reattachTrailer(theTruck)
   local trucker = getVehicleOccupant ( theTruck )
   if getElementData ( trucker, "Job" ) then
         attachTrailerToVehicle(theTruck, source)
   end
end
addEventHandler("onTrailerDetach", getRootElement(), reattachTrailer)

function destroy ( )
    if eventName == "onResourceStop" then
        for _, thePlayer in ipairs ( getElementsByType ( "player" ) ) do
           removeVeh(thePlayer)
        end
    else
        removeVeh( source )
    end
end
addEventHandler ( "onResourceStop", gResRoot, destroy )
addEventHandler ( "onPlayerWasted", root, destroy )
addEventHandler ( "onPlayerQuit", root, destroy )

---
parkgate1 = createObject( 968, 2777.123, 905.84, 10.666, 0, 90, 90 )
parkgate2 = createObject( 968, 2777.127, 920.71, 10.62, 0, -90, 90 )
parkmarker = createMarker(2777, 912.994, 7.75, "cylinder", 13, 255, 0, 0,0 )

isMoving = false
function gatefunc( hitPlayer )
    if isMoving == false then
        isMoving = true
        moveObject ( parkgate1, 2000,  2777.123, 905.84, 10.666, 0, -90, 0, "OutBounce")
      moveObject ( parkgate2, 2000,  2777.127, 920.71, 10.62, 0, 90, 0, "OutBounce")
        setTimer( triggerEvent, 3000, 1, "gatefuncclose", root)
    end
end
addEventHandler( "onMarkerHit", parkmarker, gatefunc )
 
function gatefuncclose( )
    moveObject ( parkgate1, 2000, 2777.123, 905.84, 10.666, 0, 90, 0, "OutBounce")
   moveObject ( parkgate2, 2000,  2777.127, 920.71, 10.62, 0, -90, 0, "OutBounce")
    setTimer ( function()
        isMoving = false
    end, 2000, 1 )
end
addEvent ( "gatefuncclose", true )
addEventHandler("gatefuncclose", getRootElement(), gatefuncclose)







« Son Düzenleme: 30 Mayıs 2019, 10:24:59 Gönderen: Narkoz »
 


MTASATURK

[YARDIM] Araçtan İnince Otomatik Silinme
« : 16 Nisan 2019, 14:49:42 »

Çevrimdışı Ky

  • Uzman Üye
  • *
    • İleti: 614
Yanıtla #1 : 25 Nisan 2019, 18:21:31
Buyur: Linki görebilmek için Kayıt olun yada Giriş yapın.
« Son Düzenleme: 30 Mayıs 2019, 10:27:11 Gönderen: Narkoz »