ايهاب Posted August 3, 2018 Share Posted August 3, 2018 سلام عليكم شباب ♥ ..................فى مود وظيفة الباص عدلت علية حولتة لى وظيفة طياران تغير الباص لى طيارة والاحدثيات ونفعت الفكرة بس لما بشغل الاتنين مع بعض اجى اقف على الماركر بيفتح اللوحتين مع بعض لوحة وظيفة الباص وى وظيفة الطيار الى هيا فى الاصل وظيفة باص --- انا غيرت الاسامى وعدلت فى اسامى الملفات زى ما هى المشكلة هل فى حل مايخلى اللوحتين يفتحوا مع بعض لانى عايز وظيفة الطياران دة كود ملف الكلينت عن اللوحة ولا محتاح اعرض ملف السيرفر هل فى حل عشان اللوحتين مايتفتحوا مع بعض function busGui () bsWindow1 = guiCreateWindow(0.25,0.35,0.4,0.4, "plan jop ", true) bsLabel1 = guiCreateLabel(0.09,0.09,0.8,0.5,[[Welcome to t plan jop]], true,bsWindow1) guiCreateStaticImage(0.4,0.4,0.1,0.1,"blip.PNG",true, bsWindow1) guiLabelSetHorizontalAlign(bsLabel1,"center",true) btnAccept1 = guiCreateButton(0.115,0.7,0.25,0.2, "Accept",true, bsWindow1) addEventHandler("onClientGUIClick",btnAccept1,bsAccept1) btnReject1 = guiCreateButton(0.615,0.7,0.25,0.2, "Reject", true, bsWindow1) addEventHandler("onClientGUIClick",btnReject1,bsReject1) guiSetVisible(bsWindow1, false) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () busGui () end ) function markerhit1(thePlayer, matchingDimension) if ( thePlayer == getLocalPlayer() ) then guiSetVisible(bsWindow1, true) showCursor(true) end end addEvent("showbsGui",true) addEventHandler("showbsGui", root, markerhit1) function bsReject1 () guiSetVisible(bsWindow1, false) showCursor(false) end function bsAccept1 (thePlayer) triggerServerEvent("givebsJob", getLocalPlayer(), getLocalPlayer() ) bsReject1() end Link to comment
SycroX Posted August 3, 2018 Share Posted August 3, 2018 (edited) قسم خاطئ @!#NssoR_) + الحل انك تغير اسماء التريجر في مود الطيران Edited August 3, 2018 by #َxLysandeR 1 Link to comment
ايهاب Posted August 3, 2018 Author Share Posted August 3, 2018 7 minutes ago, #َxLysandeR said: قسم خاطئ @!#NssoR_) + الحل انك تغير اسماء التريجر في مود الطيران مش فاهم لى الاسف :(((((((((((((((((((( Link to comment
SycroX Posted August 3, 2018 Share Posted August 3, 2018 (edited) 1 minute ago, ايهاب said: مش فاهم لى الاسف :(((((((((((((((((((( "showbsGui" غيره لأي شي مثلا "showPilotGui" طبعا تغيره في كلنت سايد و سيرفر سايد Edited August 3, 2018 by #َxLysandeR 1 Link to comment
ايهاب Posted August 3, 2018 Author Share Posted August 3, 2018 Just now, #َxLysandeR said: "showbsGui" غيره لأي شي مثلا "showPilotGui" طبعا تغيره في كلنت سايد و سيرفر سايد بسيطة خود الاتنين اهم وعدلهم انت دة الكلينت function busGui () bsWindow1 = guiCreateWindow(0.25,0.35,0.4,0.4, "plan jop ", true) bsLabel1 = guiCreateLabel(0.09,0.09,0.8,0.5,[[Welcome to t plan jop]], true,bsWindow1) guiCreateStaticImage(0.4,0.4,0.1,0.1,"blip.PNG",true, bsWindow1) guiLabelSetHorizontalAlign(bsLabel1,"center",true) btnAccept1 = guiCreateButton(0.115,0.7,0.25,0.2, "Accept",true, bsWindow1) addEventHandler("onClientGUIClick",btnAccept1,bsAccept1) btnReject1 = guiCreateButton(0.615,0.7,0.25,0.2, "Reject", true, bsWindow1) addEventHandler("onClientGUIClick",btnReject1,bsReject1) guiSetVisible(bsWindow1, false) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () busGui () end ) function markerhit1(thePlayer, matchingDimension) if ( thePlayer == getLocalPlayer() ) then guiSetVisible(bsWindow1, true) showCursor(true) end end addEvent("showbsGui",true) addEventHandler("showbsGui", root, markerhit1) function bsReject1 () guiSetVisible(bsWindow1, false) showCursor(false) end function bsAccept1 (thePlayer) triggerServerEvent("givebsJob", getLocalPlayer(), getLocalPlayer() ) bsReject1() end ودة السيرفر local bsMarker = createMarker(1949.56274, -2302.45239, 12.54688,"cylinder",1.5,252,0,255,50) createBlipAttachedTo(bsMarker,56) local bsLocations = { {1443.55371, -2493.37646, 12.99999}, {1477.70557, 1304.07092, 12.99999}, {-1634.96631, -145.10735, 12.99999}, {1443.55371, -2493.37646, 12.99999}, {1477.70557, 1304.07092, 12.99999}, {-1634.96631, -145.10735, 12.99999}, {1443.55371, -2493.37646, 12.99999}, {1477.70557, 1304.07092, 12.99999}, {-1634.96631, -145.10735, 12.99999}, {1439.33911, -2596.01294, 12.99999}} local bsNumber = {} addEventHandler("onMarkerHit",bsMarker, function(hitElement,_) if (hitElement and getElementType(hitElement) == "player" and not isPedInVehicle(hitElement)) then if not (getElementData(hitElement,"AGJob") == "plan driver") then -- we use this to check if the player did not take the job before triggerClientEvent("showbsGui", hitElement, hitElement) else outputChatBox("Your job already started. Get back to your plan and continue to work!", hitElement,229,250,2) end end end) local bsVehicle = {} local bsVehicleBlip = {} local bsJobMarker = {} local bsJobBlip = {} function startbsJob(thePlayer) setElementData(thePlayer,"AGJob","plandriver") bsVehicle[thePlayer] = createVehicle(593,1938.10779, -2320.12524, 13.54688) bsVehicleBlip[thePlayer] = createBlipAttachedTo(bsVehicle[thePlayer],5) setElementVisibleTo(bsVehicleBlip[thePlayer],getRootElement(),false) setElementVisibleTo(bsVehicleBlip[thePlayer],thePlayer,true) setElementData(bsVehicle[thePlayer],"JobOwner", getPlayerName(thePlayer)) setElementData(bsVehicle[thePlayer],"AGJob","taxi") warpPedIntoVehicle(thePlayer,bsVehicle[thePlayer]) showDaBusMarker(thePlayer) end addEvent("givebsJob",true) addEventHandler("givebsJob", root,startbsJob) function showDaBusMarker(thePlayer) if bsNumber[thePlayer] then --outputChatBox("bsnumber") if bsNumber[thePlayer] == 1 then bsNumber[thePlayer] = bsNumber[thePlayer] + 1 --outputChatBox("bsnumber == 1, so + 1") elseif bsNumber[thePlayer] == 10 then bsNumber[thePlayer] = bsNumber[thePlayer] - math.random(1,8) --outputChatBox("bsnumber - ") else bsNumber[thePlayer] = bsNumber[thePlayer] + 1 --outputChatBox("bsnumber + 1") end bsJobMarker[thePlayer] = createMarker(bsLocations[bsNumber[thePlayer]][1],bsLocations[bsNumber[thePlayer]][2],bsLocations[bsNumber[thePlayer]][3],"cylinder",2,100,100,0,200) bsJobBlip[thePlayer] = createBlipAttachedTo(bsJobMarker[thePlayer],19) setElementData(bsJobMarker[thePlayer],"JobOwner",getPlayerName(thePlayer)) setElementVisibleTo(bsJobMarker[thePlayer],getRootElement(),false) setElementVisibleTo(bsJobBlip[thePlayer],getRootElement(),false) setElementVisibleTo(bsJobMarker[thePlayer],thePlayer,true) setElementVisibleTo(bsJobBlip[thePlayer],thePlayer,true) addEventHandler("onMarkerHit", bsJobMarker[thePlayer], givebsPay) else bsNumber[thePlayer] = math.random(1,10) --outputChatBox("no bsnumber") --outputChatBox(bsNumber[thePlayer]) bsJobMarker[thePlayer] = createMarker(bsLocations[bsNumber[thePlayer]][1],bsLocations[bsNumber[thePlayer]][2],bsLocations[bsNumber[thePlayer]][3],"cylinder",2,100,100,0,200) setElementData(bsJobMarker[thePlayer],"JobOwner",getPlayerName(thePlayer)) bsJobBlip[thePlayer] = createBlipAttachedTo(bsJobMarker[thePlayer],19) setElementVisibleTo(bsJobMarker[thePlayer],getRootElement(),false) setElementVisibleTo(bsJobBlip[thePlayer],getRootElement(),false) setElementVisibleTo(bsJobMarker[thePlayer],thePlayer,true) setElementVisibleTo(bsJobBlip[thePlayer],thePlayer,true) addEventHandler("onMarkerHit", bsJobMarker[thePlayer], givebsPay) end end function givebsPay(hitElement,_) if (getElementType(hitElement) == "player" and getElementData(hitElement,"AGJob")== "busdriver" and isPedInVehicle(hitElement)) then --outputChatBox("first step") if (getElementData(source,"JobOwner") == getPlayerName(hitElement)) then --outputChatBox("second step") local vehicle = getPedOccupiedVehicle(hitElement) if (getElementData(vehicle,"JobOwner") == getElementData(source,"JobOwner" )) then setElementFrozen(vehicle,true) setElementFrozen(hitElement,true) outputChatBox("The passengers are getting down",hitElement,999,0,255) destroyElement(bsJobMarker[hitElement]) destroyElement(bsJobBlip[hitElement]) setTimer(givebsPayNow,3000,1,hitElement) else outputChatBox("Get back to your job vehicle!!!!",hitElement,0,246,255) end end end end function givebsPayNow(thePlayer) setElementFrozen(thePlayer,false) setElementFrozen(bsVehicle[thePlayer],false) givePlayerMoney(thePlayer,1500) showDaBusMarker(thePlayer) end function destroybs() if getElementData(source,"AGJob") == "busdriver" then if isElement(bsVehicle[source]) then destroyElement(bsVehicle[source]) end if isElement(bsVehicleBlip[source]) then destroyElement(bsVehicleBlip[source]) end if isElement(bsJobMarker[source]) then destroyElement(bsJobMarker[source]) end if isElement(bsJobBlip[source]) then destroyElement(bsJobBlip[source]) end bsNumber[source] = nil end end addEventHandler("onPlayerQuit",getRootElement(), destroybs) addEventHandler("onVehicleExplode", getRootElement(), function() if getElementData(source,"AGJob") == "busdriver" then local player = getPlayerFromName(getElementData(source,"JobOwner")) if isElement(bsVehicle[player]) then destroyElement(bsVehicle[player]) end if isElement(bsVehicleBlip[player]) then destroyElement(bsVehicleBlip[player]) end if isElement(bsJobMarker[player]) then destroyElement(bsJobMarker[player]) end if isElement(bsJobBlip[player]) then destroyElement(bsJobBlip[player]) end bsNumber[player] = nil setElementData(player,"AGJob",nil) end end) addEventHandler("onVehicleStartEnter",getRootElement(), function(player,seat,jacked,door) if (getElementData(source,"AGJob") and getElementData(source,"AGJob")=="busdriver") then if (getElementData(source,"JobOwner") ~= getPlayerName(player)) then cancelEvent(true) outputChatBox("This is not your vehicle!!",player,144,0,50) end end end) addEventHandler("onElementDataChange",getRootElement(), function(dataName,oldValue) if getElementType(source) == "player" then if dataName == "AGJob" then if oldValue == "busdriver" then if isElement(bsVehicle[source]) then destroyElement(bsVehicle[source]) end if isElement(bsVehicleBlip[source]) then destroyElement(bsVehicleBlip[source]) end if isElement(bsJobMarker[source]) then destroyElement(bsJobMarker[source]) end if isElement(bsJobBlip[source]) then destroyElement(bsJobBlip[source]) end bsNumber[source] = nil end end end end) Link to comment
SycroX Posted August 3, 2018 Share Posted August 3, 2018 معلش بس هو تعديل الأسم التريجر و الداتا صعب ؟ 1 Link to comment
ايهاب Posted August 3, 2018 Author Share Posted August 3, 2018 11 minutes ago, #َxLysandeR said: معلش بس هو تعديل الأسم التريجر و الداتا صعب ؟ "showbsGui" موجودة فى ملف كلينت بس وغيرت اسمها ولسا اللوحتين بيفتحوا على بعض Link to comment
ايهاب Posted August 3, 2018 Author Share Posted August 3, 2018 Just now, #َxLysandeR said: و غيرها في سيرفر سايد مش لاقيها فى السيرفر سايد @ 3 minutes ago, #َxLysandeR said: و غيرها في سيرفر سايد triggerClientEvent("showPilotGui", hitElement, hitElement) غيرت السطر دة فى ملف السيرفر اللوحة مبقتشى تظهر اصلا Link to comment
coNolel Posted August 3, 2018 Share Posted August 3, 2018 58 minutes ago, ايهاب said: مش لاقيها فى السيرفر سايد @ triggerClientEvent("showPilotGui", hitElement, hitElement) غيرت السطر دة فى ملف السيرفر اللوحة مبقتشى تظهر اصلا صديقي لو انت ما سويت ترايقر و ما بلغته بالكلينت سايد ما بيشتغل اكيد هناك يوم تبلغ عنه أفتح اللوحة ps : ما قريت الأكواد يعني يمكن تكون مسوي وش قلت لك بالتوفيق Link to comment
ايهاب Posted August 3, 2018 Author Share Posted August 3, 2018 8 minutes ago, coNolel said: صديقي لو انت ما سويت ترايقر و ما بلغته بالكلينت سايد ما بيشتغل اكيد هناك يوم تبلغ عنه أفتح اللوحة ps : ما قريت الأكواد يعني يمكن تكون مسوي وش قلت لك بالتوفيق لا انا مش مبرمج لو تعرف تعدلها انت يبقى لك جزيل الشكر Link to comment
MrKAREEM Posted August 3, 2018 Share Posted August 3, 2018 3 hours ago, ايهاب said: function busGui () bsWindow1 = guiCreateWindow(0.25,0.35,0.4,0.4, "plan jop ", true) bsLabel1 = guiCreateLabel(0.09,0.09,0.8,0.5,[[Welcome to t plan jop]], true,bsWindow1) guiCreateStaticImage(0.4,0.4,0.1,0.1,"blip.PNG",true, bsWindow1) guiLabelSetHorizontalAlign(bsLabel1,"center",true) btnAccept1 = guiCreateButton(0.115,0.7,0.25,0.2, "Accept",true, bsWindow1) addEventHandler("onClientGUIClick",btnAccept1,bsAccept1) btnReject1 = guiCreateButton(0.615,0.7,0.25,0.2, "Reject", true, bsWindow1) addEventHandler("onClientGUIClick",btnReject1,bsReject1) guiSetVisible(bsWindow1, false) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () busGui () end ) function markerhit1(thePlayer, matchingDimension) if ( thePlayer == getLocalPlayer() ) then guiSetVisible(bsWindow1, true) showCursor(true) end end addEvent("ShowTheWndPilot",true) addEventHandler("ShowTheWndPilot", root, markerhit1) function bsReject1 () guiSetVisible(bsWindow1, false) showCursor(false) end function bsAccept1 (thePlayer) triggerServerEvent("givebsJob", getLocalPlayer(), getLocalPlayer() ) bsReject1() end ودة السيرفر local bsMarker = createMarker(1949.56274, -2302.45239, 12.54688,"cylinder",1.5,252,0,255,50) createBlipAttachedTo(bsMarker,56) local bsLocations = { {1443.55371, -2493.37646, 12.99999}, {1477.70557, 1304.07092, 12.99999}, {-1634.96631, -145.10735, 12.99999}, {1443.55371, -2493.37646, 12.99999}, {1477.70557, 1304.07092, 12.99999}, {-1634.96631, -145.10735, 12.99999}, {1443.55371, -2493.37646, 12.99999}, {1477.70557, 1304.07092, 12.99999}, {-1634.96631, -145.10735, 12.99999}, {1439.33911, -2596.01294, 12.99999}} local bsNumber = {} addEventHandler("onMarkerHit",bsMarker, function(hitElement,_) if (hitElement and getElementType(hitElement) == "player" and not isPedInVehicle(hitElement)) then if not (getElementData(hitElement,"AGJob") == "plan driver") then -- we use this to check if the player did not take the job before triggerClientEvent("ShowTheWndPilot", hitElement, hitElement) else outputChatBox("Your job already started. Get back to your plan and continue to work!", hitElement,229,250,2) end end end) local bsVehicle = {} local bsVehicleBlip = {} local bsJobMarker = {} local bsJobBlip = {} function startbsJob(thePlayer) setElementData(thePlayer,"AGJob","plandriver") bsVehicle[thePlayer] = createVehicle(593,1938.10779, -2320.12524, 13.54688) bsVehicleBlip[thePlayer] = createBlipAttachedTo(bsVehicle[thePlayer],5) setElementVisibleTo(bsVehicleBlip[thePlayer],getRootElement(),false) setElementVisibleTo(bsVehicleBlip[thePlayer],thePlayer,true) setElementData(bsVehicle[thePlayer],"JobOwner", getPlayerName(thePlayer)) setElementData(bsVehicle[thePlayer],"AGJob","taxi") warpPedIntoVehicle(thePlayer,bsVehicle[thePlayer]) showDaBusMarker(thePlayer) end addEvent("givebsJob",true) addEventHandler("givebsJob", root,startbsJob) function showDaBusMarker(thePlayer) if bsNumber[thePlayer] then --outputChatBox("bsnumber") if bsNumber[thePlayer] == 1 then bsNumber[thePlayer] = bsNumber[thePlayer] + 1 --outputChatBox("bsnumber == 1, so + 1") elseif bsNumber[thePlayer] == 10 then bsNumber[thePlayer] = bsNumber[thePlayer] - math.random(1,8) --outputChatBox("bsnumber - ") else bsNumber[thePlayer] = bsNumber[thePlayer] + 1 --outputChatBox("bsnumber + 1") end bsJobMarker[thePlayer] = createMarker(bsLocations[bsNumber[thePlayer]][1],bsLocations[bsNumber[thePlayer]][2],bsLocations[bsNumber[thePlayer]][3],"cylinder",2,100,100,0,200) bsJobBlip[thePlayer] = createBlipAttachedTo(bsJobMarker[thePlayer],19) setElementData(bsJobMarker[thePlayer],"JobOwner",getPlayerName(thePlayer)) setElementVisibleTo(bsJobMarker[thePlayer],getRootElement(),false) setElementVisibleTo(bsJobBlip[thePlayer],getRootElement(),false) setElementVisibleTo(bsJobMarker[thePlayer],thePlayer,true) setElementVisibleTo(bsJobBlip[thePlayer],thePlayer,true) addEventHandler("onMarkerHit", bsJobMarker[thePlayer], givebsPay) else bsNumber[thePlayer] = math.random(1,10) --outputChatBox("no bsnumber") --outputChatBox(bsNumber[thePlayer]) bsJobMarker[thePlayer] = createMarker(bsLocations[bsNumber[thePlayer]][1],bsLocations[bsNumber[thePlayer]][2],bsLocations[bsNumber[thePlayer]][3],"cylinder",2,100,100,0,200) setElementData(bsJobMarker[thePlayer],"JobOwner",getPlayerName(thePlayer)) bsJobBlip[thePlayer] = createBlipAttachedTo(bsJobMarker[thePlayer],19) setElementVisibleTo(bsJobMarker[thePlayer],getRootElement(),false) setElementVisibleTo(bsJobBlip[thePlayer],getRootElement(),false) setElementVisibleTo(bsJobMarker[thePlayer],thePlayer,true) setElementVisibleTo(bsJobBlip[thePlayer],thePlayer,true) addEventHandler("onMarkerHit", bsJobMarker[thePlayer], givebsPay) end end function givebsPay(hitElement,_) if (getElementType(hitElement) == "player" and getElementData(hitElement,"AGJob")== "busdriver" and isPedInVehicle(hitElement)) then --outputChatBox("first step") if (getElementData(source,"JobOwner") == getPlayerName(hitElement)) then --outputChatBox("second step") local vehicle = getPedOccupiedVehicle(hitElement) if (getElementData(vehicle,"JobOwner") == getElementData(source,"JobOwner" )) then setElementFrozen(vehicle,true) setElementFrozen(hitElement,true) outputChatBox("The passengers are getting down",hitElement,999,0,255) destroyElement(bsJobMarker[hitElement]) destroyElement(bsJobBlip[hitElement]) setTimer(givebsPayNow,3000,1,hitElement) else outputChatBox("Get back to your job vehicle!!!!",hitElement,0,246,255) end end end end function givebsPayNow(thePlayer) setElementFrozen(thePlayer,false) setElementFrozen(bsVehicle[thePlayer],false) givePlayerMoney(thePlayer,1500) showDaBusMarker(thePlayer) end function destroybs() if getElementData(source,"AGJob") == "busdriver" then if isElement(bsVehicle[source]) then destroyElement(bsVehicle[source]) end if isElement(bsVehicleBlip[source]) then destroyElement(bsVehicleBlip[source]) end if isElement(bsJobMarker[source]) then destroyElement(bsJobMarker[source]) end if isElement(bsJobBlip[source]) then destroyElement(bsJobBlip[source]) end bsNumber[source] = nil end end addEventHandler("onPlayerQuit",getRootElement(), destroybs) addEventHandler("onVehicleExplode", getRootElement(), function() if getElementData(source,"AGJob") == "busdriver" then local player = getPlayerFromName(getElementData(source,"JobOwner")) if isElement(bsVehicle[player]) then destroyElement(bsVehicle[player]) end if isElement(bsVehicleBlip[player]) then destroyElement(bsVehicleBlip[player]) end if isElement(bsJobMarker[player]) then destroyElement(bsJobMarker[player]) end if isElement(bsJobBlip[player]) then destroyElement(bsJobBlip[player]) end bsNumber[player] = nil setElementData(player,"AGJob",nil) end end) addEventHandler("onVehicleStartEnter",getRootElement(), function(player,seat,jacked,door) if (getElementData(source,"AGJob") and getElementData(source,"AGJob")=="busdriver") then if (getElementData(source,"JobOwner") ~= getPlayerName(player)) then cancelEvent(true) outputChatBox("This is not your vehicle!!",player,144,0,50) end end end) addEventHandler("onElementDataChange",getRootElement(), function(dataName,oldValue) if getElementType(source) == "player" then if dataName == "AGJob" then if oldValue == "busdriver" then if isElement(bsVehicle[source]) then destroyElement(bsVehicle[source]) end if isElement(bsVehicleBlip[source]) then destroyElement(bsVehicleBlip[source]) end if isElement(bsJobMarker[source]) then destroyElement(bsJobMarker[source]) end if isElement(bsJobBlip[source]) then destroyElement(bsJobBlip[source]) end bsNumber[source] = nil end end end end) اعتقد كدة يشتغل 1 Link to comment
MR_Mahmoud Posted August 3, 2018 Share Posted August 3, 2018 (edited) local bsMarker = createMarker(1949.56274, -2302.45239, 12.54688,"cylinder",1.5,252,0,255,50) createBlipAttachedTo(bsMarker,56) local bsLocations = { {1443.55371, -2493.37646, 12.99999}, {1477.70557, 1304.07092, 12.99999}, {-1634.96631, -145.10735, 12.99999}, {1443.55371, -2493.37646, 12.99999}, {1477.70557, 1304.07092, 12.99999}, {-1634.96631, -145.10735, 12.99999}, {1443.55371, -2493.37646, 12.99999}, {1477.70557, 1304.07092, 12.99999}, {-1634.96631, -145.10735, 12.99999}, {1439.33911, -2596.01294, 12.99999}} local bsNumber = {} addEventHandler("onMarkerHit",bsMarker, function(hitElement,_) if (hitElement and getElementType(hitElement) == "player" and not isPedInVehicle(hitElement)) then if not (getElementData(hitElement,"AGJob2") == "plan driver") then -- we use this to check if the player did not take the job before triggerClientEvent("showbsGui2", hitElement, hitElement) else outputChatBox("Your job already started. Get back to your plan and continue to work!", hitElement,229,250,2) end end end) local bsVehicle = {} local bsVehicleBlip = {} local bsJobMarker = {} local bsJobBlip = {} function startbsJob(thePlayer) setElementData(thePlayer,"AGJob2","plandriver") bsVehicle[thePlayer] = createVehicle(593,1938.10779, -2320.12524, 13.54688) bsVehicleBlip[thePlayer] = createBlipAttachedTo(bsVehicle[thePlayer],5) setElementVisibleTo(bsVehicleBlip[thePlayer],getRootElement(),false) setElementVisibleTo(bsVehicleBlip[thePlayer],thePlayer,true) setElementData(bsVehicle[thePlayer],"JobOwner", getPlayerName(thePlayer)) setElementData(bsVehicle[thePlayer],"AGJob2","taxi") warpPedIntoVehicle(thePlayer,bsVehicle[thePlayer]) showDaBusMarker(thePlayer) end addEvent("givebsJob2",true) addEventHandler("givebsJob2", root,startbsJob) function showDaBusMarker(thePlayer) if bsNumber[thePlayer] then --outputChatBox("bsnumber") if bsNumber[thePlayer] == 1 then bsNumber[thePlayer] = bsNumber[thePlayer] + 1 --outputChatBox("bsnumber == 1, so + 1") elseif bsNumber[thePlayer] == 10 then bsNumber[thePlayer] = bsNumber[thePlayer] - math.random(1,8) --outputChatBox("bsnumber - ") else bsNumber[thePlayer] = bsNumber[thePlayer] + 1 --outputChatBox("bsnumber + 1") end bsJobMarker[thePlayer] = createMarker(bsLocations[bsNumber[thePlayer]][1],bsLocations[bsNumber[thePlayer]][2],bsLocations[bsNumber[thePlayer]][3],"cylinder",2,100,100,0,200) bsJobBlip[thePlayer] = createBlipAttachedTo(bsJobMarker[thePlayer],19) setElementData(bsJobMarker[thePlayer],"JobOwner",getPlayerName(thePlayer)) setElementVisibleTo(bsJobMarker[thePlayer],getRootElement(),false) setElementVisibleTo(bsJobBlip[thePlayer],getRootElement(),false) setElementVisibleTo(bsJobMarker[thePlayer],thePlayer,true) setElementVisibleTo(bsJobBlip[thePlayer],thePlayer,true) addEventHandler("onMarkerHit", bsJobMarker[thePlayer], givebsPay) else bsNumber[thePlayer] = math.random(1,10) --outputChatBox("no bsnumber") --outputChatBox(bsNumber[thePlayer]) bsJobMarker[thePlayer] = createMarker(bsLocations[bsNumber[thePlayer]][1],bsLocations[bsNumber[thePlayer]][2],bsLocations[bsNumber[thePlayer]][3],"cylinder",2,100,100,0,200) setElementData(bsJobMarker[thePlayer],"JobOwner",getPlayerName(thePlayer)) bsJobBlip[thePlayer] = createBlipAttachedTo(bsJobMarker[thePlayer],19) setElementVisibleTo(bsJobMarker[thePlayer],getRootElement(),false) setElementVisibleTo(bsJobBlip[thePlayer],getRootElement(),false) setElementVisibleTo(bsJobMarker[thePlayer],thePlayer,true) setElementVisibleTo(bsJobBlip[thePlayer],thePlayer,true) addEventHandler("onMarkerHit", bsJobMarker[thePlayer], givebsPay) end end function givebsPay(hitElement,_) if (getElementType(hitElement) == "player" and getElementData(hitElement,"AGJob2")== "busdriver" and isPedInVehicle(hitElement)) then --outputChatBox("first step") if (getElementData(source,"JobOwner") == getPlayerName(hitElement)) then --outputChatBox("second step") local vehicle = getPedOccupiedVehicle(hitElement) if (getElementData(vehicle,"JobOwner") == getElementData(source,"JobOwner" )) then setElementFrozen(vehicle,true) setElementFrozen(hitElement,true) outputChatBox("The passengers are getting down",hitElement,999,0,255) destroyElement(bsJobMarker[hitElement]) destroyElement(bsJobBlip[hitElement]) setTimer(givebsPayNow,3000,1,hitElement) else outputChatBox("Get back to your job vehicle!!!!",hitElement,0,246,255) end end end end function givebsPayNow(thePlayer) setElementFrozen(thePlayer,false) setElementFrozen(bsVehicle[thePlayer],false) givePlayerMoney(thePlayer,1500) showDaBusMarker(thePlayer) end function destroybs() if getElementData(source,"AGJob2") == "busdriver" then if isElement(bsVehicle[source]) then destroyElement(bsVehicle[source]) end if isElement(bsVehicleBlip[source]) then destroyElement(bsVehicleBlip[source]) end if isElement(bsJobMarker[source]) then destroyElement(bsJobMarker[source]) end if isElement(bsJobBlip[source]) then destroyElement(bsJobBlip[source]) end bsNumber[source] = nil end end addEventHandler("onPlayerQuit",getRootElement(), destroybs) addEventHandler("onVehicleExplode", getRootElement(), function() if getElementData(source,"AGJob2") == "busdriver" then local player = getPlayerFromName(getElementData(source,"JobOwner")) if isElement(bsVehicle[player]) then destroyElement(bsVehicle[player]) end if isElement(bsVehicleBlip[player]) then destroyElement(bsVehicleBlip[player]) end if isElement(bsJobMarker[player]) then destroyElement(bsJobMarker[player]) end if isElement(bsJobBlip[player]) then destroyElement(bsJobBlip[player]) end bsNumber[player] = nil setElementData(player,"AGJob2",nil) end end) addEventHandler("onVehicleStartEnter",getRootElement(), function(player,seat,jacked,door) if (getElementData(source,"AGJob2") and getElementData(source,"AGJob2")=="busdriver") then if (getElementData(source,"JobOwner") ~= getPlayerName(player)) then cancelEvent(true) outputChatBox("This is not your vehicle!!",player,144,0,50) end end end) addEventHandler("onElementDataChange",getRootElement(), function(dataName,oldValue) if getElementType(source) == "player" then if dataName == "AGJob2" then if oldValue == "busdriver" then if isElement(bsVehicle[source]) then destroyElement(bsVehicle[source]) end if isElement(bsVehicleBlip[source]) then destroyElement(bsVehicleBlip[source]) end if isElement(bsJobMarker[source]) then destroyElement(bsJobMarker[source]) end if isElement(bsJobBlip[source]) then destroyElement(bsJobBlip[source]) end bsNumber[source] = nil end end end end) جربه 5 minutes ago, MrKAREEM said: اعتقد كدة يشتغل ماغيرتله اسم الداتا Edited August 3, 2018 by MR_Mahmoud 1 Link to comment
ايهاب Posted August 4, 2018 Author Share Posted August 4, 2018 (edited) اللوحات مش بتفتح على بعض بس فى مشكلة المودين دخلوة فى بعض يعنى احدثيات الوظائف بتفتح على بعض كانى واخد الوظفتين فى وقت واحد واما اخد وظيفة الطيار بينقلى وارب لمكان وظيفة الباص وانا مش عملوة كدة 11 hours ago, MrKAREEM said: اعتقد كدة يشتغل Edited August 4, 2018 by ايهاب Link to comment
Rakan# Posted August 4, 2018 Share Posted August 4, 2018 بسيطه .. بأول مود غير اسم الترايقر والاحداثيات حقت الماركر وثاني مود خله زي ماهو وين الصعوبه بالموضوع ؟ 1 Link to comment
ايهاب Posted August 4, 2018 Author Share Posted August 4, 2018 38 minutes ago, Rakan# said: بسيطه .. بأول مود غير اسم الترايقر والاحداثيات حقت الماركر وثاني مود خله زي ماهو وين الصعوبه بالموضوع ؟ مغير احدثيات الماركر كلها ومغير الى قالولى علية اللوحات بتفتح مع بعضها وتعديل مستر كريم دخل اللوحات مش بتفتح بس المودين دخلوة على بعض فى الاحدثيات Link to comment
Rakan# Posted August 4, 2018 Share Posted August 4, 2018 1 hour ago, ايهاب said: مغير احدثيات الماركر كلها ومغير الى قالولى علية اللوحات بتفتح مع بعضها وتعديل مستر كريم دخل اللوحات مش بتفتح بس المودين دخلوة على بعض فى الاحدثيات اقسم بالله مافهمت شي 1 Link to comment
MR_Mahmoud Posted August 4, 2018 Share Posted August 4, 2018 2 hours ago, ايهاب said: مغير احدثيات الماركر كلها ومغير الى قالولى علية اللوحات بتفتح مع بعضها وتعديل مستر كريم دخل اللوحات مش بتفتح بس المودين دخلوة على بعض فى الاحدثيات طيب ليه ماتوضح من الأول انك بدك تغير احداثيات الماركر المهم تفضل local bsMarker = createMarker(1937.98682,-2301.14429,12.6000,"cylinder",2,252,0,255,50) createBlipAttachedTo(bsMarker,56) local bsLocations = { {1443.55371, -2493.37646, 12.99999}, {1477.70557, 1304.07092, 12.99999}, {-1634.96631, -145.10735, 12.99999}, {1443.55371, -2493.37646, 12.99999}, {1477.70557, 1304.07092, 12.99999}, {-1634.96631, -145.10735, 12.99999}, {1443.55371, -2493.37646, 12.99999}, {1477.70557, 1304.07092, 12.99999}, {-1634.96631, -145.10735, 12.99999}, {1439.33911, -2596.01294, 12.99999}} local bsNumber = {} addEventHandler("onMarkerHit",bsMarker, function(hitElement,_) if (hitElement and getElementType(hitElement) == "player" and not isPedInVehicle(hitElement)) then if not (getElementData(hitElement,"AGJob2") == "plan driver") then -- we use this to check if the player did not take the job before triggerClientEvent("showbsGui2", hitElement, hitElement) else outputChatBox("Your job already started. Get back to your plan and continue to work!", hitElement,229,250,2) end end end) local bsVehicle = {} local bsVehicleBlip = {} local bsJobMarker = {} local bsJobBlip = {} function startbsJob(thePlayer) setElementData(thePlayer,"AGJob2","plandriver") bsVehicle[thePlayer] = createVehicle(593,1938.10779, -2320.12524, 13.54688) bsVehicleBlip[thePlayer] = createBlipAttachedTo(bsVehicle[thePlayer],5) setElementVisibleTo(bsVehicleBlip[thePlayer],getRootElement(),false) setElementVisibleTo(bsVehicleBlip[thePlayer],thePlayer,true) setElementData(bsVehicle[thePlayer],"JobOwner", getPlayerName(thePlayer)) setElementData(bsVehicle[thePlayer],"AGJob2","taxi") warpPedIntoVehicle(thePlayer,bsVehicle[thePlayer]) showDaBusMarker(thePlayer) end addEvent("givebsJob2",true) addEventHandler("givebsJob2", root,startbsJob) function showDaBusMarker(thePlayer) if bsNumber[thePlayer] then --outputChatBox("bsnumber") if bsNumber[thePlayer] == 1 then bsNumber[thePlayer] = bsNumber[thePlayer] + 1 --outputChatBox("bsnumber == 1, so + 1") elseif bsNumber[thePlayer] == 10 then bsNumber[thePlayer] = bsNumber[thePlayer] - math.random(1,8) --outputChatBox("bsnumber - ") else bsNumber[thePlayer] = bsNumber[thePlayer] + 1 --outputChatBox("bsnumber + 1") end bsJobMarker[thePlayer] = createMarker(bsLocations[bsNumber[thePlayer]][1],bsLocations[bsNumber[thePlayer]][2],bsLocations[bsNumber[thePlayer]][3],"cylinder",2,100,100,0,200) bsJobBlip[thePlayer] = createBlipAttachedTo(bsJobMarker[thePlayer],19) setElementData(bsJobMarker[thePlayer],"JobOwner",getPlayerName(thePlayer)) setElementVisibleTo(bsJobMarker[thePlayer],getRootElement(),false) setElementVisibleTo(bsJobBlip[thePlayer],getRootElement(),false) setElementVisibleTo(bsJobMarker[thePlayer],thePlayer,true) setElementVisibleTo(bsJobBlip[thePlayer],thePlayer,true) addEventHandler("onMarkerHit", bsJobMarker[thePlayer], givebsPay) else bsNumber[thePlayer] = math.random(1,10) --outputChatBox("no bsnumber") --outputChatBox(bsNumber[thePlayer]) bsJobMarker[thePlayer] = createMarker(bsLocations[bsNumber[thePlayer]][1],bsLocations[bsNumber[thePlayer]][2],bsLocations[bsNumber[thePlayer]][3],"cylinder",2,100,100,0,200) setElementData(bsJobMarker[thePlayer],"JobOwner",getPlayerName(thePlayer)) bsJobBlip[thePlayer] = createBlipAttachedTo(bsJobMarker[thePlayer],19) setElementVisibleTo(bsJobMarker[thePlayer],getRootElement(),false) setElementVisibleTo(bsJobBlip[thePlayer],getRootElement(),false) setElementVisibleTo(bsJobMarker[thePlayer],thePlayer,true) setElementVisibleTo(bsJobBlip[thePlayer],thePlayer,true) addEventHandler("onMarkerHit", bsJobMarker[thePlayer], givebsPay) end end function givebsPay(hitElement,_) if (getElementType(hitElement) == "player" and getElementData(hitElement,"AGJob2")== "busdriver" and isPedInVehicle(hitElement)) then --outputChatBox("first step") if (getElementData(source,"JobOwner") == getPlayerName(hitElement)) then --outputChatBox("second step") local vehicle = getPedOccupiedVehicle(hitElement) if (getElementData(vehicle,"JobOwner") == getElementData(source,"JobOwner" )) then setElementFrozen(vehicle,true) setElementFrozen(hitElement,true) outputChatBox("The passengers are getting down",hitElement,999,0,255) destroyElement(bsJobMarker[hitElement]) destroyElement(bsJobBlip[hitElement]) setTimer(givebsPayNow,3000,1,hitElement) else outputChatBox("Get back to your job vehicle!!!!",hitElement,0,246,255) end end end end function givebsPayNow(thePlayer) setElementFrozen(thePlayer,false) setElementFrozen(bsVehicle[thePlayer],false) givePlayerMoney(thePlayer,1500) showDaBusMarker(thePlayer) end function destroybs() if getElementData(source,"AGJob2") == "busdriver" then if isElement(bsVehicle[source]) then destroyElement(bsVehicle[source]) end if isElement(bsVehicleBlip[source]) then destroyElement(bsVehicleBlip[source]) end if isElement(bsJobMarker[source]) then destroyElement(bsJobMarker[source]) end if isElement(bsJobBlip[source]) then destroyElement(bsJobBlip[source]) end bsNumber[source] = nil end end addEventHandler("onPlayerQuit",getRootElement(), destroybs) addEventHandler("onVehicleExplode", getRootElement(), function() if getElementData(source,"AGJob2") == "busdriver" then local player = getPlayerFromName(getElementData(source,"JobOwner")) if isElement(bsVehicle[player]) then destroyElement(bsVehicle[player]) end if isElement(bsVehicleBlip[player]) then destroyElement(bsVehicleBlip[player]) end if isElement(bsJobMarker[player]) then destroyElement(bsJobMarker[player]) end if isElement(bsJobBlip[player]) then destroyElement(bsJobBlip[player]) end bsNumber[player] = nil setElementData(player,"AGJob2",nil) end end) addEventHandler("onVehicleStartEnter",getRootElement(), function(player,seat,jacked,door) if (getElementData(source,"AGJob2") and getElementData(source,"AGJob2")=="busdriver") then if (getElementData(source,"JobOwner") ~= getPlayerName(player)) then cancelEvent(true) outputChatBox("This is not your vehicle!!",player,144,0,50) end end end) addEventHandler("onElementDataChange",getRootElement(), function(dataName,oldValue) if getElementType(source) == "player" then if dataName == "AGJob2" then if oldValue == "busdriver" then if isElement(bsVehicle[source]) then destroyElement(bsVehicle[source]) end if isElement(bsVehicleBlip[source]) then destroyElement(bsVehicleBlip[source]) end if isElement(bsJobMarker[source]) then destroyElement(bsJobMarker[source]) end if isElement(bsJobBlip[source]) then destroyElement(bsJobBlip[source]) end bsNumber[source] = nil end end end end) 1 Link to comment
MrKAREEM Posted August 4, 2018 Share Posted August 4, 2018 18 hours ago, MR_Mahmoud said: local bsMarker = createMarker(1949.56274, -2302.45239, 12.54688,"cylinder",1.5,252,0,255,50)createBlipAttachedTo(bsMarker,56)local bsLocations = { {1443.55371, -2493.37646, 12.99999}, {1477.70557, 1304.07092, 12.99999}, {-1634.96631, -145.10735, 12.99999}, {1443.55371, -2493.37646, 12.99999}, {1477.70557, 1304.07092, 12.99999}, {-1634.96631, -145.10735, 12.99999}, {1443.55371, -2493.37646, 12.99999}, {1477.70557, 1304.07092, 12.99999}, {-1634.96631, -145.10735, 12.99999}, {1439.33911, -2596.01294, 12.99999}} local bsNumber = {}addEventHandler("onMarkerHit",bsMarker,function(hitElement,_) if (hitElement and getElementType(hitElement) == "player" and not isPedInVehicle(hitElement)) then if not (getElementData(hitElement,"AGJob2") == "plan driver") then -- we use this to check if the player did not take the job before triggerClientEvent("showbsGui2", hitElement, hitElement) else outputChatBox("Your job already started. Get back to your plan and continue to work!", hitElement,229,250,2) end endend)local bsVehicle = {}local bsVehicleBlip = {}local bsJobMarker = {}local bsJobBlip = {}function startbsJob(thePlayer)setElementData(thePlayer,"AGJob2","plandriver")bsVehicle[thePlayer] = createVehicle(593,1938.10779, -2320.12524, 13.54688)bsVehicleBlip[thePlayer] = createBlipAttachedTo(bsVehicle[thePlayer],5)setElementVisibleTo(bsVehicleBlip[thePlayer],getRootElement(),false)setElementVisibleTo(bsVehicleBlip[thePlayer],thePlayer,true)setElementData(bsVehicle[thePlayer],"JobOwner", getPlayerName(thePlayer))setElementData(bsVehicle[thePlayer],"AGJob2","taxi")warpPedIntoVehicle(thePlayer,bsVehicle[thePlayer])showDaBusMarker(thePlayer)endaddEvent("givebsJob2",true)addEventHandler("givebsJob2", root,startbsJob)function showDaBusMarker(thePlayer) if bsNumber[thePlayer] then --outputChatBox("bsnumber") if bsNumber[thePlayer] == 1 then bsNumber[thePlayer] = bsNumber[thePlayer] + 1 --outputChatBox("bsnumber == 1, so + 1") elseif bsNumber[thePlayer] == 10 then bsNumber[thePlayer] = bsNumber[thePlayer] - math.random(1,8) --outputChatBox("bsnumber - ") else bsNumber[thePlayer] = bsNumber[thePlayer] + 1 --outputChatBox("bsnumber + 1") end bsJobMarker[thePlayer] = createMarker(bsLocations[bsNumber[thePlayer]][1],bsLocations[bsNumber[thePlayer]][2],bsLocations[bsNumber[thePlayer]][3],"cylinder",2,100,100,0,200) bsJobBlip[thePlayer] = createBlipAttachedTo(bsJobMarker[thePlayer],19) setElementData(bsJobMarker[thePlayer],"JobOwner",getPlayerName(thePlayer)) setElementVisibleTo(bsJobMarker[thePlayer],getRootElement(),false) setElementVisibleTo(bsJobBlip[thePlayer],getRootElement(),false) setElementVisibleTo(bsJobMarker[thePlayer],thePlayer,true) setElementVisibleTo(bsJobBlip[thePlayer],thePlayer,true) addEventHandler("onMarkerHit", bsJobMarker[thePlayer], givebsPay) else bsNumber[thePlayer] = math.random(1,10) --outputChatBox("no bsnumber") --outputChatBox(bsNumber[thePlayer]) bsJobMarker[thePlayer] = createMarker(bsLocations[bsNumber[thePlayer]][1],bsLocations[bsNumber[thePlayer]][2],bsLocations[bsNumber[thePlayer]][3],"cylinder",2,100,100,0,200) setElementData(bsJobMarker[thePlayer],"JobOwner",getPlayerName(thePlayer)) bsJobBlip[thePlayer] = createBlipAttachedTo(bsJobMarker[thePlayer],19) setElementVisibleTo(bsJobMarker[thePlayer],getRootElement(),false) setElementVisibleTo(bsJobBlip[thePlayer],getRootElement(),false) setElementVisibleTo(bsJobMarker[thePlayer],thePlayer,true) setElementVisibleTo(bsJobBlip[thePlayer],thePlayer,true) addEventHandler("onMarkerHit", bsJobMarker[thePlayer], givebsPay) endend function givebsPay(hitElement,_) if (getElementType(hitElement) == "player" and getElementData(hitElement,"AGJob2")== "busdriver" and isPedInVehicle(hitElement)) then --outputChatBox("first step") if (getElementData(source,"JobOwner") == getPlayerName(hitElement)) then --outputChatBox("second step") local vehicle = getPedOccupiedVehicle(hitElement) if (getElementData(vehicle,"JobOwner") == getElementData(source,"JobOwner" )) then setElementFrozen(vehicle,true) setElementFrozen(hitElement,true) outputChatBox("The passengers are getting down",hitElement,999,0,255) destroyElement(bsJobMarker[hitElement]) destroyElement(bsJobBlip[hitElement]) setTimer(givebsPayNow,3000,1,hitElement) else outputChatBox("Get back to your job vehicle!!!!",hitElement,0,246,255) end end endendfunction givebsPayNow(thePlayer)setElementFrozen(thePlayer,false)setElementFrozen(bsVehicle[thePlayer],false)givePlayerMoney(thePlayer,1500)showDaBusMarker(thePlayer)endfunction destroybs() if getElementData(source,"AGJob2") == "busdriver" then if isElement(bsVehicle[source]) then destroyElement(bsVehicle[source]) end if isElement(bsVehicleBlip[source]) then destroyElement(bsVehicleBlip[source]) end if isElement(bsJobMarker[source]) then destroyElement(bsJobMarker[source]) end if isElement(bsJobBlip[source]) then destroyElement(bsJobBlip[source]) end bsNumber[source] = nil endendaddEventHandler("onPlayerQuit",getRootElement(), destroybs)addEventHandler("onVehicleExplode", getRootElement(),function() if getElementData(source,"AGJob2") == "busdriver" then local player = getPlayerFromName(getElementData(source,"JobOwner")) if isElement(bsVehicle[player]) then destroyElement(bsVehicle[player]) end if isElement(bsVehicleBlip[player]) then destroyElement(bsVehicleBlip[player]) end if isElement(bsJobMarker[player]) then destroyElement(bsJobMarker[player]) end if isElement(bsJobBlip[player]) then destroyElement(bsJobBlip[player]) end bsNumber[player] = nil setElementData(player,"AGJob2",nil) endend)addEventHandler("onVehicleStartEnter",getRootElement(),function(player,seat,jacked,door)if (getElementData(source,"AGJob2") and getElementData(source,"AGJob2")=="busdriver") then if (getElementData(source,"JobOwner") ~= getPlayerName(player)) then cancelEvent(true) outputChatBox("This is not your vehicle!!",player,144,0,50) endendend) addEventHandler("onElementDataChange",getRootElement(),function(dataName,oldValue) if getElementType(source) == "player" then if dataName == "AGJob2" then if oldValue == "busdriver" then if isElement(bsVehicle[source]) then destroyElement(bsVehicle[source]) end if isElement(bsVehicleBlip[source]) then destroyElement(bsVehicleBlip[source]) end if isElement(bsJobMarker[source]) then destroyElement(bsJobMarker[source]) end if isElement(bsJobBlip[source]) then destroyElement(bsJobBlip[source]) end bsNumber[source] = nil end end endend) جربه ماغيرتله اسم الداتا انا مش فاهم هو عاوز ايه اصلا العيب انه يقول مش مبرمج وما يبي يفهم او يحاول شئ 2 Link to comment
ايهاب Posted August 4, 2018 Author Share Posted August 4, 2018 39 minutes ago, MrKAREEM said: انا مش فاهم هو عاوز ايه اصلا العيب انه يقول مش مبرمج وما يبي يفهم او يحاول شئ الماركر مش بيفتح لكن ما ابى اتعبك معى اكتر من كدة مش مهم الوظيفة دى هى القصة ان اللوحات كانت بتفتح مع بعض انت عدلت عليها مابقيت تفتح مع بعض لكن فى مشكلة الى هيا بيظهر ليا احدثيات وظيفة الباص مع علامة فى الخريطة وانا فاتح وظيفة الطيار الى هيا فى الاصل الباص الوظيفتين داخلين فى بعض التعديل الاخير دة لى الاسف الماركر مبقاش يفتح لكن والله مشكوررررررررر على تعبك معايا Link to comment
MR_Mahmoud Posted August 4, 2018 Share Posted August 4, 2018 (edited) كلنت function busGui () bsWindow1 = guiCreateWindow(0.25,0.35,0.4,0.4, "plan jop ", true) bsLabel1 = guiCreateLabel(0.09,0.09,0.8,0.5,[[Welcome to t plan jop]], true,bsWindow1) guiCreateStaticImage(0.4,0.4,0.1,0.1,"blip.PNG",true, bsWindow1) guiLabelSetHorizontalAlign(bsLabel1,"center",true) btnAccept1 = guiCreateButton(0.115,0.7,0.25,0.2, "Accept",true, bsWindow1) addEventHandler("onClientGUIClick",btnAccept1,bsAccept1) btnReject1 = guiCreateButton(0.615,0.7,0.25,0.2, "Reject", true, bsWindow1) addEventHandler("onClientGUIClick",btnReject1,bsReject1) guiSetVisible(bsWindow1, false) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () busGui () end ) function markerhit1(thePlayer, matchingDimension) if ( thePlayer == getLocalPlayer() ) then guiSetVisible(bsWindow1, true) showCursor(true) end end addEvent("showbsGui2",true) addEventHandler("showbsGui2", root, markerhit1) function bsReject1 () guiSetVisible(bsWindow1, false) showCursor(false) end function bsAccept1 (thePlayer) triggerServerEvent("givebsJob2", getLocalPlayer(), getLocalPlayer() ) bsReject1() end سيرفر local bsMarker = createMarker(1937.98682,-2301.14429,12.6000,"cylinder",2,252,0,255,50) createBlipAttachedTo(bsMarker,56) local bsLocations = { {1443.55371, -2493.37646, 12.99999}, {1477.70557, 1304.07092, 12.99999}, {-1634.96631, -145.10735, 12.99999}, {1443.55371, -2493.37646, 12.99999}, {1477.70557, 1304.07092, 12.99999}, {-1634.96631, -145.10735, 12.99999}, {1443.55371, -2493.37646, 12.99999}, {1477.70557, 1304.07092, 12.99999}, {-1634.96631, -145.10735, 12.99999}, {1439.33911, -2596.01294, 12.99999}} local bsNumber = {} addEventHandler("onMarkerHit",bsMarker, function(hitElement,_) if (hitElement and getElementType(hitElement) == "player" and not isPedInVehicle(hitElement)) then if not (getElementData(hitElement,"AGJob2") == "plan driver") then -- we use this to check if the player did not take the job before triggerClientEvent("showbsGui2", hitElement, hitElement) else outputChatBox("Your job already started. Get back to your plan and continue to work!", hitElement,229,250,2) end end end) local bsVehicle = {} local bsVehicleBlip = {} local bsJobMarker = {} local bsJobBlip = {} function startbsJob(thePlayer) setElementData(thePlayer,"AGJob2","plandriver") bsVehicle[thePlayer] = createVehicle(593,1938.10779, -2320.12524, 13.54688) bsVehicleBlip[thePlayer] = createBlipAttachedTo(bsVehicle[thePlayer],5) setElementVisibleTo(bsVehicleBlip[thePlayer],getRootElement(),false) setElementVisibleTo(bsVehicleBlip[thePlayer],thePlayer,true) setElementData(bsVehicle[thePlayer],"JobOwner", getPlayerName(thePlayer)) setElementData(bsVehicle[thePlayer],"AGJob2","taxi") warpPedIntoVehicle(thePlayer,bsVehicle[thePlayer]) showDaBusMarker(thePlayer) end addEvent("givebsJob2",true) addEventHandler("givebsJob2", root,startbsJob) function showDaBusMarker(thePlayer) if bsNumber[thePlayer] then --outputChatBox("bsnumber") if bsNumber[thePlayer] == 1 then bsNumber[thePlayer] = bsNumber[thePlayer] + 1 --outputChatBox("bsnumber == 1, so + 1") elseif bsNumber[thePlayer] == 10 then bsNumber[thePlayer] = bsNumber[thePlayer] - math.random(1,8) --outputChatBox("bsnumber - ") else bsNumber[thePlayer] = bsNumber[thePlayer] + 1 --outputChatBox("bsnumber + 1") end bsJobMarker[thePlayer] = createMarker(bsLocations[bsNumber[thePlayer]][1],bsLocations[bsNumber[thePlayer]][2],bsLocations[bsNumber[thePlayer]][3],"cylinder",2,100,100,0,200) bsJobBlip[thePlayer] = createBlipAttachedTo(bsJobMarker[thePlayer],19) setElementData(bsJobMarker[thePlayer],"JobOwner",getPlayerName(thePlayer)) setElementVisibleTo(bsJobMarker[thePlayer],getRootElement(),false) setElementVisibleTo(bsJobBlip[thePlayer],getRootElement(),false) setElementVisibleTo(bsJobMarker[thePlayer],thePlayer,true) setElementVisibleTo(bsJobBlip[thePlayer],thePlayer,true) addEventHandler("onMarkerHit", bsJobMarker[thePlayer], givebsPay) else bsNumber[thePlayer] = math.random(1,10) --outputChatBox("no bsnumber") --outputChatBox(bsNumber[thePlayer]) bsJobMarker[thePlayer] = createMarker(bsLocations[bsNumber[thePlayer]][1],bsLocations[bsNumber[thePlayer]][2],bsLocations[bsNumber[thePlayer]][3],"cylinder",2,100,100,0,200) setElementData(bsJobMarker[thePlayer],"JobOwner",getPlayerName(thePlayer)) bsJobBlip[thePlayer] = createBlipAttachedTo(bsJobMarker[thePlayer],19) setElementVisibleTo(bsJobMarker[thePlayer],getRootElement(),false) setElementVisibleTo(bsJobBlip[thePlayer],getRootElement(),false) setElementVisibleTo(bsJobMarker[thePlayer],thePlayer,true) setElementVisibleTo(bsJobBlip[thePlayer],thePlayer,true) addEventHandler("onMarkerHit", bsJobMarker[thePlayer], givebsPay) end end function givebsPay(hitElement,_) if (getElementType(hitElement) == "player" and getElementData(hitElement,"AGJob2")== "busdriver" and isPedInVehicle(hitElement)) then --outputChatBox("first step") if (getElementData(source,"JobOwner") == getPlayerName(hitElement)) then --outputChatBox("second step") local vehicle = getPedOccupiedVehicle(hitElement) if (getElementData(vehicle,"JobOwner") == getElementData(source,"JobOwner" )) then setElementFrozen(vehicle,true) setElementFrozen(hitElement,true) outputChatBox("The passengers are getting down",hitElement,999,0,255) destroyElement(bsJobMarker[hitElement]) destroyElement(bsJobBlip[hitElement]) setTimer(givebsPayNow,3000,1,hitElement) else outputChatBox("Get back to your job vehicle!!!!",hitElement,0,246,255) end end end end function givebsPayNow(thePlayer) setElementFrozen(thePlayer,false) setElementFrozen(bsVehicle[thePlayer],false) givePlayerMoney(thePlayer,1500) showDaBusMarker(thePlayer) end function destroybs() if getElementData(source,"AGJob2") == "busdriver" then if isElement(bsVehicle[source]) then destroyElement(bsVehicle[source]) end if isElement(bsVehicleBlip[source]) then destroyElement(bsVehicleBlip[source]) end if isElement(bsJobMarker[source]) then destroyElement(bsJobMarker[source]) end if isElement(bsJobBlip[source]) then destroyElement(bsJobBlip[source]) end bsNumber[source] = nil end end addEventHandler("onPlayerQuit",getRootElement(), destroybs) addEventHandler("onVehicleExplode", getRootElement(), function() if getElementData(source,"AGJob2") == "busdriver" then local player = getPlayerFromName(getElementData(source,"JobOwner")) if isElement(bsVehicle[player]) then destroyElement(bsVehicle[player]) end if isElement(bsVehicleBlip[player]) then destroyElement(bsVehicleBlip[player]) end if isElement(bsJobMarker[player]) then destroyElement(bsJobMarker[player]) end if isElement(bsJobBlip[player]) then destroyElement(bsJobBlip[player]) end bsNumber[player] = nil setElementData(player,"AGJob2",nil) end end) addEventHandler("onVehicleStartEnter",getRootElement(), function(player,seat,jacked,door) if (getElementData(source,"AGJob2") and getElementData(source,"AGJob2")=="busdriver") then if (getElementData(source,"JobOwner") ~= getPlayerName(player)) then cancelEvent(true) outputChatBox("This is not your vehicle!!",player,144,0,50) end end end) addEventHandler("onElementDataChange",getRootElement(), function(dataName,oldValue) if getElementType(source) == "player" then if dataName == "AGJob2" then if oldValue == "busdriver" then if isElement(bsVehicle[source]) then destroyElement(bsVehicle[source]) end if isElement(bsVehicleBlip[source]) then destroyElement(bsVehicleBlip[source]) end if isElement(bsJobMarker[source]) then destroyElement(bsJobMarker[source]) end if isElement(bsJobBlip[source]) then destroyElement(bsJobBlip[source]) end bsNumber[source] = nil end end end end) جربه Edited August 4, 2018 by MR_Mahmoud 1 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