jaberxpro Posted September 23, 2015 Share Posted September 23, 2015 (edited) انا عندي وظيفة منجم لكن بها مشكلة لما اضغط تاب عشان اكسر الصخور يعلق حتى لما تختفي الصخرة يبقى يضرب وما يوقف ممكن مساعدة ؟ jobServer local minerW = { 31, 24, 27, 28, 34 } addEvent("TakeJobFashier",true) addEventHandler("TakeJobFashier",root, function (skin) setElementModel(client,tonumber(skin)) setElementData ( client,'Occupation','Miner-Jop' ) triggerClientEvent(client,"createMinerMarkers",client) end ) addEvent("giveW",true) addEventHandler("giveW",root, function () local r = math.random(200,1000) givePlayerMoney(client,r) outputChatBox("* You've got "..tonumber(r).."$ from your minnings.",client,0,255,60) end ) addEvent('remveMiner', true) addEventHandler('remveMiner', root, function ( ) removeElementData(source,'Occupation') end ) jobClinet local minerMarkers = { {758.51599121094,753.36242675781,-4.0033869743347}, {740.45263671875,951.43524169922,-7.4548559188843}, {719.60821533203,970.32391357422,-7.4544372558594}, {627.25408935547,1008.5667114258,5.8102149963379}, {517.28771972656,1000.5893554688,-9.9594945907593}, {615.06231689453,774.80004882813,-32.110679626465}, {706.62518310547,792.21044921875,-30.262800216675}, {530.48461914063,916.84991455078,-42.655982971191}, {464.3349609375,865.015625,-27.464292526245}, {477.39825439453,807.1201171875,-18.829044342041}, {495.00930786133,778.30975341797,-21.634286880493}, {664.21527099609,719.94189453125,-3.996431350708}, {764.72650146484,827.23968505859,-7.4562559127808}, {740.41015625,951.22607421875,-7.4522466659546}, {687.07775878906,988.03552246094,-12.809737205505}, {696.51965332031,1005.3439941406,5.8082227706909}, {609.52349853516,985.73626708984,-7.4645547866821}, {534.44323730469,774.56799316406,-20.002136230469}, {510.88034057617,819.73706054688,-23.856391906738}, {491.29666137695,849.36956787109,-29.565511703491}, {537.17266845703,969.67395019531,-21.359622955322}, {498.93463134766,928.39727783203,-29.017789840698}, {483.15072631836,906.6708984375,-30.92096328735} } Taxi1 = createMarker(602.177734375,868.09375,-42.9609375,"cylinder",2,0,0,0,0) skin1 = createPed(27,602.177734375,868.09375,-42.9609375,90) blip = createBlip(602.177734375,868.09375,-42.9609375,56) setBlipVisibleDistance(blip,400) setElementFrozen(skin1,true) addEventHandler("onClientPedDamage",root, function () if source == skin1 then cancelEvent() end end) local x,y = guiGetScreenSize() addEventHandler("onClientMarkerHit",root, function (hit) if source == Taxi1 then if ( getElementData( hit, 'Occupation' ) ~= "Miner-Jop" ) and ( getTeamName ( getPlayerTeam ( hit ) ) == "No Team" ) and not isPedInVehicle(hit) then if localPlayer == hit then guiSetVisible(GUIEditor.window[1],true) showCursor(true) end end end end) GUIEditor = { gridlist = {}, window = {}, button = {} } local x = x - 332 local y = y - 333 GUIEditor.window[1] = guiCreateWindow(x/2,y/2,332,333, "Miner Jop", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetVisible(GUIEditor.window[1],false) GUIEditor.button[1] = guiCreateButton(9, 272, 94, 41, "Take Job", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA") GUIEditor.button[2] = guiCreateButton(233, 272, 89, 41, "Cancel", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFAAAAAA") Memo1 = guiCreateMemo(13, 30, 318, 70, "قم بالذهاب للصخور، واضغط تاب لبدء \nتكسيرها والحصول على نقود\n \nGo to the rocks, and press tab to\nstart breaking it and get money.", false, GUIEditor.window[1]) guiMemoSetReadOnly(Memo1, true) GUIEditor.gridlist[1] = guiCreateGridList(12, 120, 310, 140, false, GUIEditor.window[1]) guiGridListAddColumn(GUIEditor.gridlist[1], "#", 0.3) guiGridListAddColumn(GUIEditor.gridlist[1], "Skin Number", 0.3) guiGridListAddColumn(GUIEditor.gridlist[1], "Skin Name", 0.3) for i = 1, 3 do guiGridListAddRow(GUIEditor.gridlist[1]) end guiGridListSetItemText(GUIEditor.gridlist[1], 0, 1, "1", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 0, 2, "27", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 0, 3, "Miner 1", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 1, 1, "2", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 1, 2, "260", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 1, 3, "Miner 2", false, false) addEventHandler("onClientGUIClick",root, function () if source == GUIEditor.button[1] then local skin = guiGridListGetItemText( GUIEditor.gridlist[1],guiGridListGetSelectedItem(GUIEditor.gridlist[1]),2) if skin ~= "" then triggerServerEvent("TakeJobFashier",localPlayer,skin) guiSetVisible(GUIEditor.window[1],false) showCursor(false) end elseif source == GUIEditor.button[2] then guiSetVisible(GUIEditor.window[1],false) showCursor(false) end end) addEventHandler("onClientRender", getRootElement(), function() local x, y, z = getElementPosition(skin1) local x2, y2, z2 = getElementPosition(localPlayer) if(isLineOfSightClear(x, y, z, x2, y2, z2, true, true, false, true)) then local sx, sy = getScreenFromWorldPosition(x, y, z+1.3) if(sx) and (sy) then local distance = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) if(distance < 30) then dxDrawText("Miner Job", sx+2, sy+2, sx, sy, tocolor(0,0,0), 2-(distance/20), "arial", "center", "center") dxDrawText("Miner Job", sx, sy, sx, sy, tocolor(255,255,0), 2-(distance/20), "arial", "center", "center") end end end end) addEvent("createMinerMarkers",true) addEventHandler("createMinerMarkers",root, function () local num = math.random (#minerMarkers) local x = minerMarkers [num][1] local y = minerMarkers [num][2] local z = minerMarkers [num][3] minerMark = createMarker(x,y,z,"cylinder",2.0,0,0,0,0) minerMarkk = createMarker(x,y,z+2.0,"arrow",1.0,255,0,0,255) minerObj = createObject(3931,x,y,z) minerBlip = createBlip(x,y,z,41) end ) local x,y = guiGetScreenSize() local x = x - 355 local y = y - -356 window = guiCreateWindow(x/2, y/2, 403, 82, "", false) guiWindowSetSizable(window, false) guiSetVisible(window,false) progressbar = guiCreateProgressBar(14, 31, 372, 36, false, window) label = guiCreateLabel(172, 10, 329, 15, "0%", false, progressbar) guiLabelSetColor(label, 1, 0, 0) function startJob() setElementFrozen(localPlayer,true) setPedAnimation(localPlayer,"BSKTBALL","BBALL_react_miss") setTimer(setPedAnimation,10000,1,localPlayer,localPlayer) setTimer(setElementFrozen,10000,1,localPlayer,false) showCursor(true) guiSetVisible(window,true) local lol = guiProgressBarGetProgress(progressbar) setTimer( guiProgressBarSetProgress, 1000, 1,progressbar,lol+10 ) setTimer( guiSetText, 1000, 1,label,"10%") setTimer( guiProgressBarSetProgress, 2000, 1,progressbar,lol+20 ) setTimer( guiSetText, 2000, 1,label,"20%") setTimer( guiProgressBarSetProgress, 3000, 1,progressbar,lol+30 ) setTimer( guiSetText, 3000, 1,label,"30%") setTimer( guiProgressBarSetProgress, 4000, 1,progressbar,lol+40 ) setTimer( guiSetText, 4000, 1,label,"40%") setTimer( guiProgressBarSetProgress, 5000, 1,progressbar,lol+50 ) setTimer( guiSetText, 5000, 1,label,"50%") setTimer( guiProgressBarSetProgress, 6000, 1,progressbar,lol+60 ) setTimer( guiSetText, 6000, 1,label,"60%") setTimer( guiProgressBarSetProgress, 7000, 1,progressbar,lol+70 ) setTimer( guiSetText, 7000, 1,label,"70%") setTimer( guiProgressBarSetProgress, 8000, 1,progressbar,lol+80 ) setTimer( guiSetText, 8000, 1,label,"80%") setTimer( guiProgressBarSetProgress, 9000, 1,progressbar,lol+90 ) setTimer( guiSetText, 9000, 1,label,"90%") setTimer( guiProgressBarSetProgress, 10000, 1,progressbar,lol+100 ) setTimer( guiSetText, 10000, 1,label,"100%") timer = setTimer(function () guiSetVisible(window, false) showCursor(false) guiProgressBarSetProgress(progressbar, 0) unbindKey("tab","down",startN9) local num = math.random (#minerMarkers) local x = minerMarkers [num][1] local y = minerMarkers [num][2] local z = minerMarkers [num][3] setElementPosition(minerMark,x,y,z) setElementPosition(minerMarkk,x,y,z+2.0) setElementPosition(minerBlip,x,y,z) setElementPosition(minerObj,x,y,z) triggerServerEvent("giveW",localPlayer) end, 10000,1) end addEventHandler("onClientMarkerHit",root, function (hitting) if source == minerMark then if ( getElementData( hitting, 'Occupation' ) == "Miner-Jop" ) and ( getTeamName ( getPlayerTeam ( hitting ) ) == "No Team" ) and not isPedInVehicle(hitting) then bindKey("tab","down",startJob) end end end ) addEventHandler("onClientMarkerLeave",root, function () unbindKey("tab","down",startJob) end ) fileDelete('jobClient.lua') addEventHandler("onClientResourceStart", resourceRoot, function() window22 = guiCreateWindow(451, 305, 264, 131, "Warning!!", false) guiWindowSetSizable(window22, false) guiSetAlpha(window22 , 1.00) guiSetProperty(window22, "CaptionColour", "FFFE0000") guiSetVisible (window22, false) label22 = guiCreateLabel(20, 23, 241, 31, "You sure you want to get out of the job", false, window22) guiSetFont(label22, "default-bold-small") guiLabelSetColor(label22, 254, 0, 255) button11 = guiCreateButton(10, 64, 110, 54, "yes", false, window22) button22 = guiCreateButton(143, 64, 110, 54, "No", false, window22) end ) addEventHandler("onClientMarkerHit",root, function ( hitElement ) if ( source == Taxi1 ) then if ( hitElement == localPlayer ) then if ( getPlayerTeam ( localPlayer ) ) then if ( getElementData( localPlayer, 'Occupation' ) == "Miner-Jop" ) and ( getTeamName ( getPlayerTeam ( localPlayer ) ) == "No Team" ) and not isPedInVehicle(localPlayer) then guiSetVisible (window22, true) showCursor(true) end end end end end ) addEventHandler( "onClientGUIClick", root, function() if source == button11 then triggerServerEvent('remveMiner', localPlayer) guiSetVisible (window22, false) showCursor (false) destroyElement ( minerMark ) destroyElement ( minerMarkk ) destroyElement ( minerBlip ) destroyElement ( minerObj ) elseif source == button22 then guiSetVisible (window22, false) showCursor (false) end end ) Edited September 23, 2015 by Guest Link to comment
#Wizard Posted September 23, 2015 Share Posted September 23, 2015 اول شيء اطرحه على كود LUA + اطرح لنا كود BindKey Link to comment
jaberxpro Posted September 23, 2015 Author Share Posted September 23, 2015 اول شيء اطرحه على كود LUA + اطرح لنا كود BindKey تم وضع الكود تقدر تساعدني؟ Link to comment
jaberxpro Posted September 23, 2015 Author Share Posted September 23, 2015 30 مشاهدة 0 ردود ما في اي مساعدة؟ Link to comment
LoOs Posted September 23, 2015 Share Posted September 23, 2015 30 مشاهدة0 ردود ما في اي مساعدة؟ testing : # function startJob() setElementFrozen(localPlayer,true) setPedAnimation(localPlayer,"BSKTBALL","BBALL_react_miss") setTimer(setPedAnimation,10000,1,localPlayer,false) setTimer(setElementFrozen,10000,1,localPlayer,false) showCursor(true) guiSetVisible(window,true) local lol = guiProgressBarGetProgress(progressbar) setTimer( guiProgressBarSetProgress, 1000, 1,progressbar,lol+10 ) setTimer( guiSetText, 1000, 1,label,"10%") setTimer( guiProgressBarSetProgress, 2000, 1,progressbar,lol+20 ) setTimer( guiSetText, 2000, 1,label,"20%") setTimer( guiProgressBarSetProgress, 3000, 1,progressbar,lol+30 ) setTimer( guiSetText, 3000, 1,label,"30%") setTimer( guiProgressBarSetProgress, 4000, 1,progressbar,lol+40 ) setTimer( guiSetText, 4000, 1,label,"40%") setTimer( guiProgressBarSetProgress, 5000, 1,progressbar,lol+50 ) setTimer( guiSetText, 5000, 1,label,"50%") setTimer( guiProgressBarSetProgress, 6000, 1,progressbar,lol+60 ) setTimer( guiSetText, 6000, 1,label,"60%") setTimer( guiProgressBarSetProgress, 7000, 1,progressbar,lol+70 ) setTimer( guiSetText, 7000, 1,label,"70%") setTimer( guiProgressBarSetProgress, 8000, 1,progressbar,lol+80 ) setTimer( guiSetText, 8000, 1,label,"80%") setTimer( guiProgressBarSetProgress, 9000, 1,progressbar,lol+90 ) setTimer( guiSetText, 9000, 1,label,"90%") setTimer( guiProgressBarSetProgress, 10000, 1,progressbar,lol+100 ) setTimer( guiSetText, 10000, 1,label,"100%") timer = setTimer(function () guiSetVisible(window, false) showCursor(false) guiProgressBarSetProgress(progressbar, 0) unbindKey("tab","down",startN9) local num = math.random (#minerMarkers) local x = minerMarkers [num][1] local y = minerMarkers [num][2] local z = minerMarkers [num][3] setElementPosition(minerMark,x,y,z) setElementPosition(minerMarkk,x,y,z+2.0) setElementPosition(minerBlip,x,y,z) setElementPosition(minerObj,x,y,z) triggerServerEvent("giveW",localPlayer) end, 10000,1) end 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