Reappersz Posted September 3, 2020 Share Posted September 3, 2020 Çiftçi Mesleğinin Script Yapımı 1.Client.lua 2.server.lua 3.shared.lua 4.meta.xml Client .lua İçeriği -- Reappersz İyi Oyunlardiler. local dxMarker = createMarker(markerT[1],markerT[2],markerT[3]-0.1, "cylinder", 1, 255, 255, 255, 0) local ped = createPed(skinTractor,markerT[1],markerT[2],markerT[3]) setElementRotation(ped, 0, 0, 90) addEventHandler( "onClientRender", root, function () local x, y, z = getElementPosition(dxMarker) local Mx, My, Mz = getCameraMatrix() if (getDistanceBetweenPoints3D(x, y, z, Mx, My, Mz) <= 20) then local WorldPositionX, WorldPositionY = getScreenFromWorldPosition(x, y, z +1, 0.07) if (WorldPositionX and WorldPositionY) then dxDrawText("Çiftçi Mesleği", WorldPositionX - 1, WorldPositionY + 1, WorldPositionX - 1, WorldPositionY + 1, tocolor(0, 0, 0, 255), 1.52, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("Çiftçi Mesleği", WorldPositionX - 1, WorldPositionY + 1, WorldPositionX - 1, WorldPositionY + 1, tocolor(255, 255, 255, 255), 1.50, "default-bold", "center", "center", false, false, false, false, false) end end end ) --------------------------------------------- local markerState = 1 function getMarkerCurrentState () return markerState end function updateMarkerCurrentState () markerState = markerState + 1 end function restoreMarkerCurrentState () markerState = 1 end function isMarchEnd () if getMarkerCurrentState () >= #tractorMarks then return true else return false end end local markerT = createMarker(markerT[1],markerT[2],markerT[3]-1, "cylinder", 1, 255, 255, 255, 0) local blip = createBlipAttachedTo(markerT, 25) setBlipVisibleDistance(blip, 400) function centerWindow ( center_window ) local sx, sy = guiGetScreenSize ( ) local windowW, windowH = guiGetSize ( center_window, false ) local x, y = ( sx - windowW ) / 2, ( sy - windowH ) / 2 guiSetPosition ( center_window, x, y, false ) end local sw,sh = guiGetScreenSize() local window={} local label={} local button={} wndTra = guiCreateWindow(0,0,400,120,"Çiftçi Mesleği",false) centerWindow(wndTra) guiSetVisible(wndTra,false) labeTra = guiCreateLabel(5,25,390,50," Merhaba, bu tarlayı traktör ile sürmeni istiyorum,\nbunu yapabilirmisin ?.",false,wndTra) guiSetFont(labeTra, "default-bold-small") guiLabelSetHorizontalAlign(labeTra, "center", false) buttonTra1 = guiCreateButton(10,70,180,35,"...",false,wndTra) guiSetFont(buttonTra1,"default-bold-small") guiSetProperty(buttonTra1, "NormalTextColour", "FF00FF00") buttonTra2 = guiCreateButton(210,70,180,35,"Hayır Kalsın.",false,wndTra) guiSetFont(buttonTra2,"default-bold-small") guiSetProperty(buttonTra2, "NormalTextColour", "FFFF0000") function createMarkerTractor(player) if player == getLocalPlayer() then m = tractorMarks[ getMarkerCurrentState () ] updateMarkerCurrentState () local marker = createMarker(m[1],m[2],m[3]-1, "corona", 2, 0, 255, 0, 80) setElementData(marker,"tractor_mark",true) setElementData(player,"tractor_mark",marker) local blip = createBlip(m[1],m[2],m[3],41,3) setElementData(player,"tractor_blip",blip) local obj = createObject(804,m[1],m[2],m[3]) setObjectScale(obj, 1.0) setElementCollisionsEnabled (obj, false) setElementData(player,"tractor_obj",obj) end end function deleteMarkerTractor(player) if player == getLocalPlayer() then local marker = getElementData(player,"tractor_mark") local blip = getElementData(player,"tractor_blip") local obj = getElementData(player,"tractor_obj") if marker then if isElement(marker) then destroyElement(marker) end end if blip then if isElement(blip) then destroyElement(blip) end end if obj then if isElement(obj) then destroyElement(obj) end end end end addEvent("deleteMarkerTractor", true) addEventHandler("deleteMarkerTractor", getRootElement(), deleteMarkerTractor) function startClick() local player = getLocalPlayer() if (source == buttonTra1) then guiSetVisible(wndTra,false) showCursor(false) local state = getElementData(player,"tractor_works") if not state then triggerServerEvent("start_Tractor",player,player) setElementData(player,"tractor_works",0) createMarkerTractor(player) outputChatBox("#1E90FF[BİLGİ] #FFFFFFİşe başladınız, işarete sürün.",255,255,255,true) setElementData(player,"Model Danışmanı",getElementModel(player)) setElementModel(player,158) setElementData(player,"tractor_plus",0) setElementData(player,"Kazanılan Gelir",moneyTra) else triggerServerEvent("stop_Tractor",player,player) local hodok = tonumber(state) local profit = getElementData(player,"Kazanılan Toplam kon") if not profit then profit = 0 end setElementData(player,"Kazanılan Toplam Kon",nil) setElementData(player,"Şuan Kazanılan Kon",nil) triggerServerEvent("giveMoneyTractor",player,player,profit) setElementData(player,"tractor_works",nil) setElementModel(player,getElementData(player,"Önceki Cilt Danışamanı")) deleteMarkerTractor(player) end elseif (source == buttonTra2) then guiSetVisible(wndTra,false) showCursor(false) end end addEventHandler("onClientGUIClick", getRootElement(), startClick) function onClientMarkerHit(player, mdim) if player == getLocalPlayer() then if mdim then local veh = getPedOccupiedVehicle(player) local state = getElementData(player,"tractor_works") if getElementData(source,"tractor_mark") then if veh then setElementData(player,"tractor_plus",tonumber(getElementData(player,"tractor_plus")) + 1) if getElementData(player,"tractor_plus") >= #tractorMarks then restoreMarkerCurrentState () local pacienty = tonumber(getElementData(player,"tractor_plus")) if pacienty > 0 then setElementData(player,"tractor_works",tonumber(state) + pacienty) setElementData(player,"tractor_plus",0) if not getElementData(player,"kazanılan total ") then setElementData(player,"kazanılan total",0) end if not getElementData(player,"total") then setElementData(player,"total",0) end setElementData(player,"kazanılan total",getElementData(player,"kazanılan total") + getElementData(player,"kazanlan total")) deleteMarkerTractor(player) outputChatBox("#1E90FF[BİLGİ] #FFFFFFKazanç : #00FF00"..getElementData(player,"total kazanılan").." #FFFFFFmoney.",255,255,255,true) outputChatBox("#1E90FF[BİLGİ] #FFFFFFMaaşınızı aldınız.",255,255,255,true) end else deleteMarkerTractor(player) createMarkerTractor(player) end end end end end end addEventHandler("onClientMarkerHit", getRootElement(), onClientMarkerHit) addEventHandler ( "onClientMarkerHit", getRootElement(), function(ply) if ply ~= localPlayer then return end if source == markerT then local state = getElementData(ply,"tractor_works") local veh = getPedOccupiedVehicle(ply) if not veh then guiSetVisible(wndTra,true) showCursor(true) if not state then guiSetText(buttonTra1,"İşe Başla.") else guiSetText(buttonTra1,"İşi Bitir.") end end end end) Bu Client.lua İçeriğimiz Sırada Server.Lua -- Türkçe Çeviri Reappersz---- -- Reappersz İyi Oyunlardiler. function start_Tractor(player) local veh = createVehicle(531,spawnTractor[1],spawnTractor[2],spawnTractor[3], 0, 0, 160) setElementData(player,"tractor_veh",veh) trailer = createVehicle(610, 0, 0, 4, 0, 0, 160) attachTrailerToVehicle(veh, trailer) setElementData(player,"trailer_veh",trailer) setElementData(veh,"tractor_plus",0) warpPedIntoVehicle(player,veh) setElementData(veh, "vehicle:Work", true) setElementData(veh, "vehicle:Work:Owner", player) end addEvent("start_Tractor", true) addEventHandler("start_Tractor", getRootElement(), start_Tractor) function enterVehicle ( player ) local data = getElementData(source, "vehicle:Work") if not data then return end local owner = getElementData(source, "vehicle:Work:Owner") if owner ~= player then cancelEvent() outputChatBox("#1E90FF[BİLGİ] #FFFFFFBu araç senin değil...",player,255,255,255,true) end end addEventHandler ( "onVehicleStartEnter", getRootElement(), enterVehicle ) function stop_Tractor(player) local state = getElementData(player,"tractor_works") local veh1 = getElementData(player,"tractor_veh") local veh2 = getElementData(player,"trailer_veh") if state then if veh1 then destroyElement(veh1) setElementData(player,"tractor_veh",nil) end if veh2 then destroyElement(veh2) setElementData(player,"trailer_veh",nil) end end triggerClientEvent("deleteMarkerTractor",player,player) end addEvent("stop_Tractor", true) addEventHandler("stop_Tractor", getRootElement(), stop_Tractor) function giveMoneyTractor(player, summa) local state = getElementData(player,"tractor_works") if state then givePlayerMoney(player, summa) outputChatBox("#1E90FF[BİLGİ] #FFFFFFİşi bitirdin. Maaşın #00FF00"..summa.." #FFFFFF$.",player,255,255,255,true) end end addEvent("giveMoneyTractor", true) addEventHandler("giveMoneyTractor", getRootElement(), giveMoneyTractor) function job_quit_Medik() local player = source local state = getElementData(player,"tractor_works") if state then local veh = getElementData(player,"tractor_veh") if veh then destroyElement(veh) setElementData(player,"tractor_veh",nil) end end end addEventHandler("onPlayerQuit", root, job_quit_Medik) function onVehicleStartEnter( player, seat, jacked ) local veh = source local pveh = getElementData(player,"tractor_veh") if veh == pveh then setElementData(player,"Уничтожение_Автобуса",nil) end end addEventHandler ( "onVehicleStartEnter", getRootElement(), onVehicleStartEnter) setTimer(function() for lol,player in ipairs(getElementsByType("player")) do local pveh = getElementData(player,"tractor_veh") if pveh then local driverA = getVehicleOccupant(pveh) if driverA == player then if getElementData(player,"Уничтожение_Автобуса") then setElementData(player,"Уничтожение_Автобуса",nil) end else if getElementData(player,"Уничтожение_Автобуса") then setElementData(player,"Уничтожение_Автобуса",tonumber(getElementData(player,"Уничтожение_Автобуса")) - 1) if tonumber(getElementData(player,"Уничтожение_Автобуса")) < 0 then setElementData(player,"Уничтожение_Автобуса",nil) stop_Tractor(player) outputChatBox("#1E90FF[BİLGİ] #FFFFFFİşten ayrıldın.",player,255,255,255,true) end end end end end end,1000,0) function onVehicleExit(player,seat) if seat == 0 then local pveh = getElementData(player,"tractor_veh") if source == pveh then setElementData(player,"Уничтожение_Автобуса",60) outputChatBox("#1E90FF[BİLGİ] #FFFFFFİşi dönmelisin yoksa 60 saniye sonra yok olacak.",player,255,255,255,true) end end end addEventHandler("onVehicleExit", getRootElement(), onVehicleExit) function onPlayerWasted() giveMoneyTractor(source) end addEventHandler("onPlayerWasted", getRootElement(), onPlayerWasted) function onPlayerQuit() giveMoneyTractor(source) end addEventHandler("onPlayerQuit", getRootElement(), onPlayerQuit) Buda Server.lua ' İçeriğimiz İçinden Editlemeler Değişiklikler Yapılabilir Sıradaki İçeriğimiz Shared.lua İçeriğidir -- Türkçe Çeviri Reappersz -- -- Reappersz İyi Oyunlardiler. markerT = {-103.97047424316,9.280517578125,3.1171875} -- Harita İşaretlemesi. skinTractor = 158 -- ID рабочего скина. moneyTra = math.random(1500,10000) -- Satılanların geliri. spawnTractor = {-123.93685150146,58.673442840576,3.1171875} -- Traktor Işınlama. tractorMarks = { -- Koleksiyon Kordinatları. {-129.10345458984,44.776748657227,3.1171875}, {-140.21569824219,35.499088287354,3.1171875}, {-138.20004272461,22.663047790527,3.1171875}, {-148.60707092285,14.514667510986,3.1171875}, {-145.90365600586,3.4965758323669,3.1171875}, {-156.54542541504,-6.012909412384,3.1171875}, {-154.13597106934,-17.593681335449,3.1171875}, {-164.40188598633,-27.394626617432,3.1171875}, {-162.29643249512,-39.118156433105,3.1171875}, {-171.7504119873,-45.86404800415,3.1171875}, {-169.89549255371,-58.790817260742,3.1171875}, {-179.14767456055,-66.964935302734,3.1171875}, {-180.8540802002,-80.188659667969,3.1171875}, {-192.09867858887,-82.351318359375,3.1171875}, {-194.74926757813,-68.188079833984,3.1171875}, {-184.73794555664,-59.438095092773,3.1171875}, {-187.86322021484,-46.48645401001,3.1171875}, {-176.4867401123,-37.576705932617,3.1171875}, {-178.89535522461,-23.708335876465,3.1171875}, {-167.26829528809,-14.703594207764,3.1171875}, {-169.14628601074,0.85636925697327,3.1171875}, {-157.40020751953,11.213445663452,3.1171875}, {-163.81475830078,27.186906814575,3.109395980835}, {-151.95930480957,38.768440246582,3.1171875}, {-155.29359436035,53.715530395508,3.1171875}, {-144.55880737305,61.669063568115,3.1171875}, {-153.22250366211,73.040794372559,3.1171875}, {-164.96725463867,64.920394897461,3.1171875}, {-160.10667419434,51.389507293701,3.1171875}, {-172.44535827637,43.420669555664,3.1171875}, {-168.49655151367,27.312816619873,3.1171875}, {-181.05578613281,18.532829284668,3.109395980835}, {-176.61128234863,4.3219885826111,3.109395980835}, {-188.57684326172,-7.4416480064392,3.109395980835}, {-186.15411376953,-23.690855026245,3.1171875}, {-199.10632324219,-34.989559173584,3.1171875}, {-196.35543823242,-49.323276519775,3.1171875}, {-207.32098388672,-57.854675292969,3.1171875}, {-204.13220214844,-74.361557006836,3.1171875}, {-214.03121948242,-81.115821838379,3.1171875}, {-222.42245483398,-71.313377380371,3.1171875}, {-211.78359985352,-60.138431549072,3.1171875}, {-217.53211975098,-41.33757019043,3.1171875}, {-205.04089355469,-31.443368911743,3.1171875}, {-207.49635314941,-12.911985397339,3.1171875}, {-195.17124938965,-1.4358625411987,3.109395980835}, {-199.52687072754,22.681520462036,3.1171875}, {-187.56085205078,33.805614471436,3.1171875}, {-190.6788482666,50.106971740723,3.1171875}, {-178.33522033691,60.7131690979,3.1171875}, {-182.21771240234,76.404037475586,3.1171875}, {-191.54174804688,87.14820098877,3.1171875}, {-203.26365661621,79.401123046875,3.1171875}, {-199.90397644043,61.27318572998,3.1171875}, {-212.61807250977,50.887119293213,3.1171875}, {-209.3896484375,34.510997772217,3.1171875}, {-221.73179626465,23.422630310059,3.1171875}, {-217.9956817627,8.4652395248413,3.1171875}, {-231.29121398926,-4.3941593170166,3.109395980835}, {-227.30709838867,-17.375923156738,3.1171875}, {-238.58776855469,-26.8854637146,3.1171875}, {-234.0107421875,-40.141651153564,3.1171875}, {-245.84834289551,-50.500583648682,3.1171875}, {-243.30256652832,-64.259651184082,3.1171875}, {-253.69897460938,-70.972732543945,3.1171875}, {-261.44381713867,-60.243770599365,3.1171875}, {-264.31607055664,-45.27653503418,3.1171875}, {-253.13627624512,-37.03816986084,3.1171875}, {-256.28436279297,-21.476554870605,2.5999567508698}, {-243.57893371582,-5.2200374603271,2.8984375}, {-246.77336120605,13.520101547241,2.5481338500977}, {-232.55879211426,27.493730545044,2.8690776824951}, {-235.26802062988,47.376792907715,2.5473833084106}, {-221.7456817627,60.752349853516,2.8304569721222}, {-226.7194519043,72.61767578125,2.5015366077423}, {-214.16030883789,83.426750183105,2.7792901992798}, {-217.92860412598,94.814697265625,2.4680054187775}, {-227.80729675293,97.381309509277,2.0782046318054}, {-227.83094787598,81.953834533691,2.3373956680298}, {-242.23078918457,74.386619567871,1.953736782074}, {-236.50303649902,54.08487701416,2.4138503074646}, {-253.51921081543,43.162837982178,1.965989947319}, {-248.65715026855,20.133153915405,2.3974192142487}, {-265.92660522461,3.4994027614594,1.9778387546539}, {-260.5168762207,-20.83599281311,2.453197479248}, {-276.29504394531,-35.595523834229,2.0164685249329}, {-271.26129150391,-54.640983581543,3.1171875}, } Ve Son Adım Meta.XML İçeriğimiz <meta> <script src="shared.lua" type="shared" cache="false"/> <script src="client.lua" type="client" cache="false"/> <script src="server.lua" type="server"/> </meta> Bu Adımları Yaptıktan Sonra Meslek Dosyamızı Bir Zip Açarak İçine Atın Bunları Ardından Servere Yükleme Yapıp Startlayın ve refreshleyin Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now