gadid-lua Posted July 14, 2016 Share Posted July 14, 2016 (edited) السلام عليكم كيفكم انشائ اله بخير اليوم عندي مود توب بار شات ابي عندما يبدا الديربي يظهر في التوب بار شات Edited July 14, 2016 by Guest Link to comment
Adham Posted July 14, 2016 Share Posted July 14, 2016 exports["TopBarChat"]:sendClientMessage Link to comment
gadid-lua Posted July 14, 2016 Author Share Posted July 14, 2016 exports["TopBarChat"]:sendClientMessage اسف على الازعاج بس وين احها في ملف الديربي ؟ Link to comment
gadid-lua Posted July 14, 2016 Author Share Posted July 14, 2016 اطرح اكوادك ^ الديربي او التوب بار شات ؟ Link to comment
فاّرس Posted July 14, 2016 Share Posted July 14, 2016 اطرح اكوادك ^ ممكن تعلمني ليه يطرح اكواده؟ @ outputChatBox صاحب الموضوع استخدم الوظيفه مثل exports["TopBarChat"]:sendClientMessage ( 'Hello' ) وكمل الارقومنتات حق الالوان وذي . Link to comment
Adham Posted July 14, 2016 Share Posted July 14, 2016 العفو + هوا يقول لي اسف على الازعاج بس وين احها في ملف الديربي ؟ Link to comment
فاّرس Posted July 14, 2016 Share Posted July 14, 2016 مع احترامي لك يعني قول له كيف يستخدم الوظيفه يعني وش تبي بأكواده؟ Link to comment
gadid-lua Posted July 14, 2016 Author Share Posted July 14, 2016 (edited) تم الحل Edited July 14, 2016 by Guest Link to comment
فاّرس Posted July 14, 2016 Share Posted July 14, 2016 باللي عطيناك outputChatBox اخوي انت استبدل Link to comment
gadid-lua Posted July 14, 2016 Author Share Posted July 14, 2016 تم بنجاح بس التوب بار شات يظهر تحت ابيه يظهر فوق Link to comment
gadid-lua Posted July 14, 2016 Author Share Posted July 14, 2016 صارت مشكلة عندما غيرت مود التوب بار صار الديربي مايظهر في التوب ارجو الحل الديبري : spawns = {} setElementData(resourceRoot,"map","no") setElementData(resourceRoot,"winMoney","0") addEventHandler("onPlayerChat",getRootElement(),function(message) if tostring(message) == "ديربي" and checkDuel(source) == "prestart" and ( not checkExistPlrOnDuel(source) ) then online = countPlayersOnDerby() if tonumber(online)+1 < 32 then setData(source,"onCrossMap","yes") exports["TopBarChat"]:sendClientMessage ("المرجو الانتظار...") unbindKey("t","down") setD(source) spawnOnMap(source) else exports["TopBarChat"]:sendClientMessage ( 'عذرا الديربي الحالي ممتلئ نرجو الدخول لاحقا' ) end end end) function checkDuel(p) if tostring(getElementData(resourceRoot,"map")) == "yes" then exports["TopBarChat"]:sendClientMessage ( 'انتظر ريثما ينتهي الديربي الحالي' ) elseif tostring(getElementData(resourceRoot,"map")) == "no" then exports["TopBarChat"]:sendClientMessage ( 'انتظر ريثما يبدأ الديربي' ) end return tostring(getElementData(resourceRoot,"map")) end function checkExistPlrOnDuel(p) per = getElementData(p,"onCrossMap") if tostring(per) == "yes" then return true else return false end end function setData(element,key,vlr) setElementData(element,key,vlr) end function setD(element) setElementDimension(element,30) end function spawnOnMap(p) count = countPlayersOnDerby() spawned = "no" for i,data in pairs(spawns)do if tonumber(data.id) == tonumber(count) then spawned = "yes" v = createVehicle(411,data.x,data.y,data.z,data.rx,data.ry,data.rz) setElementDimension(v,30) setElementFrozen(v,true) setElementData(v,"creatorDerby","yes") break end end if spawned == "no" then randomS = math.random("1","32") for i,data in pairs(spawns)do if tonumber(data.id) == tonumber(randomS) then v = createVehicle(411,data.x,data.y,data.z,data.rx,data.ry,data.rz) setElementDimension(v,30) setElementFrozen(v,true) setElementData(v,"creatorDerby","yes") break end end end toggleControl(p,"enter_exit", false ) warpPedIntoVehicle(p,v) setCameraTarget(p,p) end function countPlayersOnDerby() c = -1 for i,p in pairs(getElementsByType("player"))do if checkExistPlrOnDuel(p) then c = c+1 end end return tonumber(c) end function eventCheck () if checkExistPlrOnDuel(source) then toggleControl(source,"enter_exit",true ) setData(source,"onCrossMap","no") checkEnd() end end addEventHandler("onPlayerWasted",getRootElement(),eventCheck) addEventHandler("onPlayerQuit",getRootElement(),eventCheck) addEventHandler("onPlayerJoin",getRootElement(),function() setData(source,"onCrossMap","no") end) for i,p in pairs(getElementsByType("player"))do setData(p,"onCrossMap","no") end function checkEnd() c = 0 for i,p in pairs(getElementsByType("player"))do if checkExistPlrOnDuel(p) then c = c+1 winner = p end end if tonumber(c) == 1 then givePlayerMoney(winner,tonumber(getElementData(resourceRoot,"winMoney"))) n = string.gsub(getPlayerName(winner), "#%x%x%x%x%x%x", "") outputChatBox("#00FF00[" .. n .. "]#FFFF00 Won the Derby and win#00FF00[" .. tonumber(getElementData(resourceRoot,"winMoney")) .. "$]",getRootElement(),255,255,0,true) setElementData(resourceRoot,"map","no") endDerby() setTimer(newDuel,30000,1) end end function newDuel() for i,p in pairs(getElementsByType("player"))do setData(p,"onCrossMap","no") end setElementData(resourceRoot,"map","prestart") exports["TopBarChat"]:sendClientMessage ( 'للدخول الى الدريبي اكتب في الشات , ديربي ' ) RMoney = math.random("50000","300000") setElementData(resourceRoot,"winMoney",tonumber(RMoney)) exports["TopBarChat"]:sendClientMessage ( 'سيحصل الفائز في الديربي على ') setTimer(checkPlrs,30000,1) end function checkPlrs () c = 0 for i,p in pairs(getElementsByType("player"))do if checkExistPlrOnDuel(p) then c = c+1 end end if tonumber(c) > 1 then setElementData(resourceRoot,"map","yes") for i,p in pairs(getElementsByType("player"))do if checkExistPlrOnDuel(p) then setElementCollisionsEnabled(getPedOccupiedVehicle(p),true) exports["TopBarChat"]:sendClientMessage ( 'لقد بدأ الديربي , يمكنك الانطلاق' ) setElementFrozen(getPedOccupiedVehicle(p),false) end end else endDerby() setElementData(resourceRoot,"map","no") exports["TopBarChat"]:sendClientMessage ( '! لم يبدأ الديربي لعدم توفر الاعبين' ) setTimer(newDuel,60000,1) end end setTimer(newDuel,3000,1) function onStartLoadSpawns () file = fileOpen("map.map") localFile = fileOpen("map.xml") fileWrite(localFile,"") data = fileRead(file,999999) fileWrite(localFile,data) fileClose(localFile) xml = xmlLoadFile("map.xml") c = 0 for i,data in pairs(xmlNodeGetChildren(xml)) do if xmlNodeGetName(data) == "spawnpoint" then c = c+1 v,xx,yy,zz,rxx,ryy,rzz = xmlNodeGetAttribute(data,"vehicle"),xmlNodeGetAttribute(data,"posX"),xmlNodeGetAttribute(data,"posY"),xmlNodeGetAttribute(data,"posZ"),xmlNodeGetAttribute(data,"rotX"),xmlNodeGetAttribute(data,"rotY"),xmlNodeGetAttribute(data,"rotZ") table.insert(spawns,{id = c,model = v,x = xx,y = yy,z = zz,rx = rxx,ry = ryy,rz = rzz}) end end for i,data in pairs(xmlNodeGetChildren(xml)) do if xmlNodeGetName(data) == "object" then m,xx,yy,zz,rxx,ryy,rzz = xmlNodeGetAttribute(data,"model"),xmlNodeGetAttribute(data,"posX"),xmlNodeGetAttribute(data,"posY"),xmlNodeGetAttribute(data,"posZ"),xmlNodeGetAttribute(data,"rotX"),xmlNodeGetAttribute(data,"rotY"),xmlNodeGetAttribute(data,"rotZ") object = createObject(m,xx,yy,zz,rxx,ryy,rzz) setElementDimension(object,30) end end end setTimer(onStartLoadSpawns,3000,1) function endDerby() for i,p in pairs(getElementsByType("player"))do if checkExistPlrOnDuel(p) then killPed(p) end end for i,v in pairs(getElementsByType("vehicle"))do if getElementData(v,"creatorDerby") then destroyElement(v) end end end setTimer(function() for i,p in pairs(getElementsByType("player"))do sea(p) resetHan(p) checkVeh(p) checkModel(p) end end,1000,0) function sea(p) if checkExistPlrOnDuel(p) then x,y,z = getElementPosition(p) if tonumber(z) <= 0 then killPed(p) end end end function checkVeh(p) if (tonumber(getElementDimension(p)) == 30) and not (isPedInVehicle(p))then killPed(p) end end function resetHan(p) if checkExistPlrOnDuel(p) then setVehicleHandling (getPedOccupiedVehicle(p), true ) end end function checkModel(p) if checkExistPlrOnDuel(p) and isPedInVehicle(p) then if tonumber(getElementModel(getPedOccupiedVehicle(p))) ~= 411 then killPed(p) end end end التوب : screenX, screenY = guiGetScreenSize() topChat = { {"", 255, 50, 50}, } setTimer(function() table.remove(topChat, 1) end, 10000, 1) setTimer(function() table.remove(topChat, 1) end, 10000, 1) addEventHandler("onClientPreRender",root, function() dxDrawRectangle(screenX/4+(screenX/16),1*20-20,screenX/2-(screenX/16),20.0,tocolor(0,0,0,150),false) local x, y, z = getElementPosition(localPlayer) if #topChat >= 8 then table.remove(topChat, 1) end for k, v in ipairs(topChat) do dxDrawRectangle(screenX/4+(screenX/16),k*20,screenX/2-(screenX/16),20.0,tocolor(0,250,0,150),false) dxDrawText(" "..v[1],screenX/4+(screenX/16),k*40,screenX/2-(screenX/16),20.0,tocolor(v[2],v[3],v[4],255),1.0,"default-bold","left","center",false,false,false, true) end end ) function outputTopChat(message, r, g, b) table.insert(topChat, { message, r, g, b }) local thetime = getRealTime() outputConsole("["..string.format("%.2d:%.2d:%.2d", thetime.hour, thetime.minute, thetime.second).."] "..message:gsub("#%x%x%x%x%x%x", "")) setTimer(function() table.remove(topChat, 1) end, 60000, 1) end addEvent("outputTopChat", true) addEventHandler("outputTopChat", root, outputTopChat) ارجو الحل في ارع وقت Link to comment
Anis Posted July 14, 2016 Share Posted July 14, 2016 صارت مشكلة عندما غيرت مود التوب بار صار الديربي مايظهر في التوب ارجو الحلالديبري : spawns = {} setElementData(resourceRoot,"map","no") setElementData(resourceRoot,"winMoney","0") addEventHandler("onPlayerChat",getRootElement(),function(message) if tostring(message) == "ديربي" and checkDuel(source) == "prestart" and ( not checkExistPlrOnDuel(source) ) then online = countPlayersOnDerby() if tonumber(online)+1 < 32 then setData(source,"onCrossMap","yes") exports["TopBarChat"]:sendClientMessage ("المرجو الانتظار...") unbindKey("t","down") setD(source) spawnOnMap(source) else exports["TopBarChat"]:sendClientMessage ( 'عذرا الديربي الحالي ممتلئ نرجو الدخول لاحقا' ) end end end) function checkDuel(p) if tostring(getElementData(resourceRoot,"map")) == "yes" then exports["TopBarChat"]:sendClientMessage ( 'انتظر ريثما ينتهي الديربي الحالي' ) elseif tostring(getElementData(resourceRoot,"map")) == "no" then exports["TopBarChat"]:sendClientMessage ( 'انتظر ريثما يبدأ الديربي' ) end return tostring(getElementData(resourceRoot,"map")) end function checkExistPlrOnDuel(p) per = getElementData(p,"onCrossMap") if tostring(per) == "yes" then return true else return false end end function setData(element,key,vlr) setElementData(element,key,vlr) end function setD(element) setElementDimension(element,30) end function spawnOnMap(p) count = countPlayersOnDerby() spawned = "no" for i,data in pairs(spawns)do if tonumber(data.id) == tonumber(count) then spawned = "yes" v = createVehicle(411,data.x,data.y,data.z,data.rx,data.ry,data.rz) setElementDimension(v,30) setElementFrozen(v,true) setElementData(v,"creatorDerby","yes") break end end if spawned == "no" then randomS = math.random("1","32") for i,data in pairs(spawns)do if tonumber(data.id) == tonumber(randomS) then v = createVehicle(411,data.x,data.y,data.z,data.rx,data.ry,data.rz) setElementDimension(v,30) setElementFrozen(v,true) setElementData(v,"creatorDerby","yes") break end end end toggleControl(p,"enter_exit", false ) warpPedIntoVehicle(p,v) setCameraTarget(p,p) end function countPlayersOnDerby() c = -1 for i,p in pairs(getElementsByType("player"))do if checkExistPlrOnDuel(p) then c = c+1 end end return tonumber(c) end function eventCheck () if checkExistPlrOnDuel(source) then toggleControl(source,"enter_exit",true ) setData(source,"onCrossMap","no") checkEnd() end end addEventHandler("onPlayerWasted",getRootElement(),eventCheck) addEventHandler("onPlayerQuit",getRootElement(),eventCheck) addEventHandler("onPlayerJoin",getRootElement(),function() setData(source,"onCrossMap","no") end) for i,p in pairs(getElementsByType("player"))do setData(p,"onCrossMap","no") end function checkEnd() c = 0 for i,p in pairs(getElementsByType("player"))do if checkExistPlrOnDuel(p) then c = c+1 winner = p end end if tonumber(c) == 1 then givePlayerMoney(winner,tonumber(getElementData(resourceRoot,"winMoney"))) n = string.gsub(getPlayerName(winner), "#%x%x%x%x%x%x", "") outputChatBox("#00FF00[" .. n .. "]#FFFF00 Won the Derby and win#00FF00[" .. tonumber(getElementData(resourceRoot,"winMoney")) .. "$]",getRootElement(),255,255,0,true) setElementData(resourceRoot,"map","no") endDerby() setTimer(newDuel,30000,1) end end function newDuel() for i,p in pairs(getElementsByType("player"))do setData(p,"onCrossMap","no") end setElementData(resourceRoot,"map","prestart") exports["TopBarChat"]:sendClientMessage ( 'للدخول الى الدريبي اكتب في الشات , ديربي ' ) RMoney = math.random("50000","300000") setElementData(resourceRoot,"winMoney",tonumber(RMoney)) exports["TopBarChat"]:sendClientMessage ( 'سيحصل الفائز في الديربي على ') setTimer(checkPlrs,30000,1) end function checkPlrs () c = 0 for i,p in pairs(getElementsByType("player"))do if checkExistPlrOnDuel(p) then c = c+1 end end if tonumber(c) > 1 then setElementData(resourceRoot,"map","yes") for i,p in pairs(getElementsByType("player"))do if checkExistPlrOnDuel(p) then setElementCollisionsEnabled(getPedOccupiedVehicle(p),true) exports["TopBarChat"]:sendClientMessage ( 'لقد بدأ الديربي , يمكنك الانطلاق' ) setElementFrozen(getPedOccupiedVehicle(p),false) end end else endDerby() setElementData(resourceRoot,"map","no") exports["TopBarChat"]:sendClientMessage ( '! لم يبدأ الديربي لعدم توفر الاعبين' ) setTimer(newDuel,60000,1) end end setTimer(newDuel,3000,1) function onStartLoadSpawns () file = fileOpen("map.map") localFile = fileOpen("map.xml") fileWrite(localFile,"") data = fileRead(file,999999) fileWrite(localFile,data) fileClose(localFile) xml = xmlLoadFile("map.xml") c = 0 for i,data in pairs(xmlNodeGetChildren(xml)) do if xmlNodeGetName(data) == "spawnpoint" then c = c+1 v,xx,yy,zz,rxx,ryy,rzz = xmlNodeGetAttribute(data,"vehicle"),xmlNodeGetAttribute(data,"posX"),xmlNodeGetAttribute(data,"posY"),xmlNodeGetAttribute(data,"posZ"),xmlNodeGetAttribute(data,"rotX"),xmlNodeGetAttribute(data,"rotY"),xmlNodeGetAttribute(data,"rotZ") table.insert(spawns,{id = c,model = v,x = xx,y = yy,z = zz,rx = rxx,ry = ryy,rz = rzz}) end end for i,data in pairs(xmlNodeGetChildren(xml)) do if xmlNodeGetName(data) == "object" then m,xx,yy,zz,rxx,ryy,rzz = xmlNodeGetAttribute(data,"model"),xmlNodeGetAttribute(data,"posX"),xmlNodeGetAttribute(data,"posY"),xmlNodeGetAttribute(data,"posZ"),xmlNodeGetAttribute(data,"rotX"),xmlNodeGetAttribute(data,"rotY"),xmlNodeGetAttribute(data,"rotZ") object = createObject(m,xx,yy,zz,rxx,ryy,rzz) setElementDimension(object,30) end end end setTimer(onStartLoadSpawns,3000,1) function endDerby() for i,p in pairs(getElementsByType("player"))do if checkExistPlrOnDuel(p) then killPed(p) end end for i,v in pairs(getElementsByType("vehicle"))do if getElementData(v,"creatorDerby") then destroyElement(v) end end end setTimer(function() for i,p in pairs(getElementsByType("player"))do sea(p) resetHan(p) checkVeh(p) checkModel(p) end end,1000,0) function sea(p) if checkExistPlrOnDuel(p) then x,y,z = getElementPosition(p) if tonumber(z) <= 0 then killPed(p) end end end function checkVeh(p) if (tonumber(getElementDimension(p)) == 30) and not (isPedInVehicle(p))then killPed(p) end end function resetHan(p) if checkExistPlrOnDuel(p) then setVehicleHandling (getPedOccupiedVehicle(p), true ) end end function checkModel(p) if checkExistPlrOnDuel(p) and isPedInVehicle(p) then if tonumber(getElementModel(getPedOccupiedVehicle(p))) ~= 411 then killPed(p) end end end التوب : screenX, screenY = guiGetScreenSize() topChat = { {"", 255, 50, 50}, } setTimer(function() table.remove(topChat, 1) end, 10000, 1) setTimer(function() table.remove(topChat, 1) end, 10000, 1) addEventHandler("onClientPreRender",root, function() dxDrawRectangle(screenX/4+(screenX/16),1*20-20,screenX/2-(screenX/16),20.0,tocolor(0,0,0,150),false) local x, y, z = getElementPosition(localPlayer) if #topChat >= 8 then table.remove(topChat, 1) end for k, v in ipairs(topChat) do dxDrawRectangle(screenX/4+(screenX/16),k*20,screenX/2-(screenX/16),20.0,tocolor(0,250,0,150),false) dxDrawText(" "..v[1],screenX/4+(screenX/16),k*40,screenX/2-(screenX/16),20.0,tocolor(v[2],v[3],v[4],255),1.0,"default-bold","left","center",false,false,false, true) end end ) function outputTopChat(message, r, g, b) table.insert(topChat, { message, r, g, b }) local thetime = getRealTime() outputConsole("["..string.format("%.2d:%.2d:%.2d", thetime.hour, thetime.minute, thetime.second).."] "..message:gsub("#%x%x%x%x%x%x", "")) setTimer(function() table.remove(topChat, 1) end, 60000, 1) end addEvent("outputTopChat", true) addEventHandler("outputTopChat", root, outputTopChat) ارجو الحل في ارع وقت مو قبل ايام صلحتوا لك ؟ بمنسابة قلت لك مو مجرب تراني ماعندي الللعبة لكي اجرب مو نفس الكود للي صلحتوا 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