aBo.F[ra]G<3 Posted July 4, 2014 Author Share Posted July 4, 2014 --------------- --------------- --++-- rRoot = getResourceRootElement(getThisResource()) lp = getLocalPlayer() x,y = guiGetScreenSize() sw, sh = guiGetScreenSize() --++-- drawed = false function Draw(text,up,r,g,b,size,time) triggerServerEvent("textOut",localPlayer,localPlayer,text,time or 6,r or 255,g or 255,b or 0,255,0.38,0.85,size or 2.0) end ------------------------------------------------------------------ addEvent("Sound",true) addEventHandler("Sound",root,function() playSound("LevelUP.mp3") end ) ------------------------------------------------------------------ -- top 10 shit addEventHandler("onClientResourceStart",rRoot, function () triggerServerEvent("on10Request",lp) end ) function returnTop(num,pn,exp,lev,top1) guiGridListClear(top10grid) setTimer(function(top10grid) if num then row = guiGridListAddRow(top10grid) pNum = tostring(num) pName = tostring(pn) pExp = tostring(exp) pLev = tostring(lev) guiGridListSetItemText(top10grid, row, NumCol, pNum, false, false) guiGridListSetItemColor(top10grid, row, NumCol, 0,255,255) if top1 then guiGridListSetItemColor(top10grid, row, NumCol, 255,0,0) guiGridListSetItemText(top10grid, row, NumCol, pNum, true, true) end guiGridListSetItemText(top10grid, row, pNCol, pName, false, false) guiGridListSetItemColor(top10grid, row, pNCol,0,255,255) if top1 then guiGridListSetItemColor(top10grid, row, pNCol, 255,0,0) guiGridListSetItemText(top10grid, row, pNCol, pName, true, true) end guiGridListSetItemText(top10grid, row, ExpCol, pExp, false, false) guiGridListSetItemColor(top10grid, row, ExpCol, 0,255,255) if top1 then guiGridListSetItemColor(top10grid, row, ExpCol, 255,0,0) guiGridListSetItemText(top10grid, row, ExpCol, pExp, true, true) end guiGridListSetItemText(top10grid, row, LevCol, pLev, false, false) guiGridListSetItemColor(top10grid, row, LevCol, 0,255,255) if top1 then guiGridListSetItemColor(top10grid, row, LevCol, 255,0,0) guiGridListSetItemText(top10grid, row, LevCol, pLev, true, true) end end end,100,1,top10grid) end addEvent("returnTop",true) addEventHandler("returnTop",root,returnTop) top10grid = guiCreateGridList(435,427+5-10,407,188,false,wnd) guiSetVisible(top10grid,false) NumCol = guiGridListAddColumn(top10grid, "#", 0.13) pNCol = guiGridListAddColumn(top10grid, "Player Name", 0.40) LevCol = guiGridListAddColumn(top10grid, "Level", 0.20) ExpCol = guiGridListAddColumn(top10grid, "Exp", 0.20) function LevelSystem() local l,e,n = getElementData(lp,"Level") or "N/A",getElementData(lp,"Exp") or "N/A",getElementData(lp,"Next") or "N/A" dxDrawRectangle(488.0,260.0-10,300.0,360.5,tocolor(0,0,0,100),false) end function showLevelWindow() hideLevelWindow() guiMoveToBack(top10grid) guiSetAlpha(top10grid,tonumber(0.-- s8) -->) guiSetVisible(top10grid,true) addEventHandler("onClientRender",root,LevelSystem) end addEvent("showLevelWindow",true) addEventHandler("showLevelWindow",root,showLevelWindow) function hideLevelWindow() if guiGetVisible(top10grid) ~= false then removeEventHandler("onClientRender",root,LevelSystem) guiSetVisible(top10grid,false) end end addEvent("hideLevelWindow",true) addEventHandler("hideLevelWindow",root,hideLevelWindow) l = false bindKey(getElementData(rRoot,"openKey"),"down",function() if not l then l = true showLevelWindow() else hideLevelWindow() l = false end end ) -- fileDelete("LS-C.lua") Link to comment
acount deleted Posted July 4, 2014 Share Posted July 4, 2014 جرب شغل السكربت من غير الكلينت Link to comment
acount deleted Posted July 4, 2014 Share Posted July 4, 2014 عادي احفظه و بمكان ثاني و جربه من غير كلينت مجرد تجريب اذا مشتغل رجعه مثل ما كان Link to comment
acount deleted Posted July 4, 2014 Share Posted July 4, 2014 لا تنسى تحذف الملف كالينت من الميتا + احفظ المود كامل في مكان امن Link to comment
aBo.F[ra]G<3 Posted July 4, 2014 Author Share Posted July 4, 2014 ي شباب معاد باقي الا الشغله ذي كملو جميلكم Link to comment
TAPL Posted July 4, 2014 Share Posted July 4, 2014 plusLevel و الفنكشن upgrade وريني كود الفنكشن بالسيرفر ذا Link to comment
aBo.F[ra]G<3 Posted July 4, 2014 Author Share Posted July 4, 2014 الى طلبته ماحصلتهه بسس ذا اكواد الى بالسيرفر ---------------------- --------------- outputChatBox("Level System | #00FF00By Al3grab",root,255,255,0,true) outputDebugString("Level System By Al3grab | Started") --------------- --++-- rRoot = getResourceRootElement(getThisResource()) --++-- --NextPerx = 250 ----------- function restLevelData(player) if player then setElementData(player,"Level","Level 0") setElementData(player,"Exp",tonumber(0)) setElementData(player,"Next",tonumber(NextPerx)) end end addCommandHandler("restmylevel",function(plr) restLevelData(plr) end) addEventHandler("onPlayerJoin",root,function() restLevelData(source) end ) function saveLevelData(player) if player then hisAcc = getPlayerAccount(player) if hisAcc and ( not isGuestAccount(hisAcc) ) then Level = getElementData(player,"Level") Exp = getElementData(player,"Exp") Next = getElementData(player,"Next") if Level and Exp and Next then setAccountData(hisAcc,"Level",tostring(Level)) setAccountData(hisAcc,"Exp",tonumber(Exp)) setAccountData(hisAcc,"Next",tonumber(Next)) end end end end addEventHandler("onPlayerQuit",root,function() saveLevelData(source) end ) addEventHandler("onPlayerLogout",root,function(thePreviousAccount) player = source Level = getElementData(player,"Level") Exp = getElementData(player,"Exp") Next = getElementData(player,"Next") setAccountData(thePreviousAccount,"Level",tostring(Level)) setAccountData(thePreviousAccount,"Exp",tonumber(Exp)) setAccountData(thePreviousAccount,"Next",tonumber(Next)) setAccountData(thePreviousAccount,"pName",getPlayerName(source)) restLevelData(source) end ) function getLevelData(player) if not isElement(player) then player = source end hisAcc = getPlayerAccount(player) if hisAcc then Level = getAccountData(hisAcc,"Level") Exp = getAccountData(hisAcc,"Exp") Next = getAccountData(hisAcc,"Next") setAccountData(hisAcc,"pName",getPlayerName(player)) if Level and Exp and Next then setElementData(player,"Level",tostring(Level));setElementData(player,"Exp",tonumber(Exp));setElementData(player,"Next",tonumber(Next)) end end end addEventHandler("onPlayerLogin",getRootElement(),getLevelData) --------------------------------------------------------------------- function setUp() exports.scoreboard:scoreboardAddColumn("Level") exports.scoreboard:scoreboardAddColumn("Exp") exports.scoreboard:scoreboardAddColumn("Next") -- for k,v in ipairs ( getElementsByType("player") ) do -- getLevelData(v) end --[[ local lr = getResourceFromName("LoginRegister") if lr then st = getResourceState(lr) if st == "loaded" then startResource(lr) end end --]] -- key = get("Key") NextPerx = get("LevelNext") randomFrom,randomTo = get("RandomExpFrom"),get("RandomExpTo") if key and NextPerx and randomFrom and randomTo then setElementData(rRoot,"openKey",key) else for k=0,5 do outputChatBox("** Level System : Error in settings , resource might not work",root,255,0,0,true) end end end addEventHandler("onResourceStart",rRoot,setUp) --------------------------------------------------------------------- function plusExp(player) local hisExp = getElementData(player,"Exp") local random = math.random(randomFrom,randomTo) -- math.random(1,5) if random then setElementData(player,"Exp",hisExp+random) textOut(player,"+"..random.." Exp !",6,0,255,0,255,0.38,0.75,1.9) playSoundFrontEnd(player,40) saveLevelData(player) end end function plusLevel(player) local hisLevel = getElementData(player,"Level") if hisLevel then hisLevelNumber = gettok ( hisLevel, 2, string.byte(' ') ) setElementData(player,"Level","Level "..hisLevelNumber+1) end end function upgrade(player) if player then local hisNext = getElementData(player,"Next") local hisLevel = getElementData(player,"Level") if hisNext then setElementData(player,"Next",hisNext+NextPerx) ---------------------------------------------- textOut(player,"Up "..tostring(hisLevel).." !",10,255,255,0,255,0.38,0.88,4.2) triggerClientEvent(player,"Sound",player) triggerClientEvent(player,"showLevelWindow",player) setTimer(triggerClientEvent,10 * 1000 , 1 , player , "hideLevelWindow" , player ) outputChatBox("Congratulation's [ #FFFFFF"..getPlayerName(player).."#FF0000 ] You're up to #00FF00["..hisLevel.."] ",root,255,0,0,true) ---------------------------------------------- end end end --------------------------------------------------------------------- function onKill(ammo,killer) if ( killer ) and ( killer ~= source ) then local hisLevel = getElementData(killer,"Level") local hisExp = getElementData(killer,"Exp") local hisNext = getElementData(killer,"Next") if hisLevel and hisExp and hisNext then ----------------- plusExp(killer) ----------------- if tonumber(hisExp) > tonumber(math.floor(hisNext-1)) then plusLevel(killer) upgrade(killer) end end end end addEventHandler("onPlayerWasted",root,onKill) ---------------------------------------------------------------------- -- top 10 shit function redo10() TOP10 = sortAccounts() end setTimer(redo10,5000,1) setTimer(redo10,30 * 60 * 1000 , 0) function send10(plr) if not TOP10 then redo10() end for index, data in ipairs(TOP10) do local acName = getAccountData(data.account,"pName") or "N/A" if not getAccountData(data.account,"Exp") then setAccountData(data.account,"Exp",tonumber(0)) end local top1 = ( index == 1 and true or false ) triggerClientEvent(plr,"returnTop",plr,index,string.gsub(acName,'#%x%x%x%x%x%x', ''),data.points,data.level,top1) if index == 10 then break end end end addEvent("send10",true) addEventHandler("send10",root,redo10) function on10Request() send10(source) end addEvent("on10Request",true) addEventHandler("on10Request",root,on10Request) function sortAccounts() local rowdata = {} for index, account in pairs(getAccounts()) do rowdata[index] = { account = account, points = getAccountData(account,"Exp") or "N/A", level = getAccountData(account,"Level") or "N/A", } end local comp = function (a, b) return (tonumber(a.points) or 0) > (tonumber(b.points) or 0) end table.sort(rowdata, comp) setTimer(function(rowdata) rowdata = nil end , 5000 ,1,rowdata ) return rowdata end function textOut(Player,Text,Time,r,g,b,a,x,y,size) if ( Player and getElementType(Player) == "player" and tostring(Text) and tonumber(Time)) then newDisplay = textCreateDisplay() if newDisplay then newText = textCreateTextItem( tostring(Text), tonumber(x) or 0.4,tonumber(y) or 0.5,"medium",tonumber(r) or 255,tonumber(g) or 255,tonumber(b) or 255,tonumber(a) or 255,tonumber(size) or 2.0,"left","center",150) if newText then textDisplayAddText(newDisplay,newText) textDisplayAddObserver(newDisplay,Player) -- setTimer ( function ( Player , Display , Text ) if Player and Display and Text then textDestroyDisplay(Display) end end , Time * 1000 , 1 , Player , newDisplay , newText ) end end end end addEvent("textOut",true) addEventHandler("textOut",root,textOut) ---------------------------------------------------------------------- Link to comment
acount deleted Posted July 4, 2014 Share Posted July 4, 2014 --------------- --------------- --++-- rRoot = getResourceRootElement(getThisResource()) lp = getLocalPlayer() x,y = guiGetScreenSize() sw, sh = guiGetScreenSize() --++-- drawed = false function Draw(text,up,r,g,b,size,time) triggerServerEvent("textOut",localPlayer,localPlayer,text,time or 6,r or 255,g or 255,b or 0,255,0.38,0.85,size or 2.0) end ------------------------------------------------------------------ addEvent("Sound",true) addEventHandler("Sound",root,function() playSound("LevelUP.mp3") end ) ------------------------------------------------------------------ -- top 10 :~ addEventHandler("onClientResourceStart",rRoot, function () triggerServerEvent("on10Request",lp) end ) function returnTop(num,pn,exp,lev,top1) guiGridListClear(top10grid) setTimer(function(top10grid) if num then row = guiGridListAddRow(top10grid) pNum = tostring(num) pName = tostring(pn) pExp = tostring(exp) pLev = tostring(lev) guiGridListSetItemText(top10grid, row, NumCol, pNum, false, false) guiGridListSetItemColor(top10grid, row, NumCol, 0,255,255) if top1 then guiGridListSetItemColor(top10grid, row, NumCol, 255,0,0) guiGridListSetItemText(top10grid, row, NumCol, pNum, true, true) end guiGridListSetItemText(top10grid, row, pNCol, pName, false, false) guiGridListSetItemColor(top10grid, row, pNCol,0,255,255) if top1 then guiGridListSetItemColor(top10grid, row, pNCol, 255,0,0) guiGridListSetItemText(top10grid, row, pNCol, pName, true, true) end guiGridListSetItemText(top10grid, row, ExpCol, pExp, false, false) guiGridListSetItemColor(top10grid, row, ExpCol, 0,255,255) if top1 then guiGridListSetItemColor(top10grid, row, ExpCol, 255,0,0) guiGridListSetItemText(top10grid, row, ExpCol, pExp, true, true) end guiGridListSetItemText(top10grid, row, LevCol, pLev, false, false) guiGridListSetItemColor(top10grid, row, LevCol, 0,255,255) if top1 then guiGridListSetItemColor(top10grid, row, LevCol, 255,0,0) guiGridListSetItemText(top10grid, row, LevCol, pLev, true, true) end end end,100,1,top10grid) end addEvent("returnTop",true) addEventHandler("returnTop",root,returnTop) top10grid = guiCreateGridList(435,427+5-10,407,188,false,wnd) guiSetVisible(top10grid,false) NumCol = guiGridListAddColumn(top10grid, "#", 0.13) pNCol = guiGridListAddColumn(top10grid, "Player Name", 0.40) LevCol = guiGridListAddColumn(top10grid, "Level", 0.20) ExpCol = guiGridListAddColumn(top10grid, "Exp", 0.20) function LevelSystem() local l,e,n = getElementData(lp,"Level") or "N/A",getElementData(lp,"Exp") or "N/A",getElementData(lp,"Next") or "N/A" dxDrawRectangle(488.0,260.0-10,300.0,360.5,tocolor(0,0,0,100),false) end function showLevelWindow() hideLevelWindow() guiMoveToBack(top10grid) guiSetAlpha(top10grid,tonumber(0.-- s8) -->) guiSetVisible(top10grid,true) end addEvent("showLevelWindow",true) addEventHandler("showLevelWindow",root,showLevelWindow) function hideLevelWindow() if guiGetVisible(top10grid) ~= false then guiSetVisible(top10grid,false) end end addEvent("hideLevelWindow",true) addEventHandler("hideLevelWindow",root,hideLevelWindow) l = false bindKey(getElementData(rRoot,"openKey"),"down",function() if not l then l = true showLevelWindow() else hideLevelWindow() l = false end end ) -- fileDelete("LS-C.lua") مم احذف الافنتاتonClientRender حقت sowlevelwindow hidelevelwin Link to comment
aBo.F[ra]G<3 Posted July 4, 2014 Author Share Posted July 4, 2014 ضبط يعطيكم العافيهه Link to comment
K1NG Posted July 4, 2014 Share Posted July 4, 2014 getElementType عن طريقة وظيفة 'onZombieWasted' لاعب في حدث = killerناقصكـ تتحقق من أن الـ ( killer ~= source ) وبهالحالة هذي يصير مافيه داعي بأنك تتحقق من أن القاتل ليس المقتول 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