Jw8. Posted April 19, 2019 Share Posted April 19, 2019 السلام عليكم ورحمة الله وبركاته في عندي مشكله بلمود ذه راح اطرح الكود function gold_gives( player ) givePlayerPackage( player, 'Gold' ) end addEvent("gold_gives",true) addEventHandler("gold_gives", root, gold_gives) كل ما اوزع ما اقدر يكتب لي بلديبق كلمات طبعا هاذا ملفات كلينت elseif source == GUIEditor.button[6] then row , col = guiGridListGetSelectedItem ( GUIEditor.gridlist[2] ) if row >= 0 then local playerName = guiGridListGetItemData(GUIEditor.gridlist[2], row, 1) if playerName and playerName ~= nil then local player = getPlayerFromName(playerName); triggerServerEvent( 'gold_gives', localPlayer, player ) end يكتب لي بلديبق https://d.top4top.net/p_1204j40wv1.png Link to comment
+Source|> Posted April 20, 2019 Share Posted April 20, 2019 function gold_gives( player ) givePlayerPackage( player, 'Gold' ) end addEvent("gold_give",true) addEventHandler("gold_give", root, gold_gives) elseif source == GUIEditor.button[6] then row , col = guiGridListGetSelectedItem ( GUIEditor.gridlist[2] ) if row >= 0 then local playerName = guiGridListGetItemData(GUIEditor.gridlist[2], row, 1) if playerName and playerName ~= nil then local player = getPlayerFromName(playerName); triggerServerEvent( 'gold_give', localPlayer, player ) end جرب ذا Link to comment
Jw8. Posted April 20, 2019 Author Share Posted April 20, 2019 21 minutes ago, +Source|> said: function gold_gives( player ) givePlayerPackage( player, 'Gold' ) end addEvent("gold_give",true) addEventHandler("gold_give", root, gold_gives) elseif source == GUIEditor.button[6] then row , col = guiGridListGetSelectedItem ( GUIEditor.gridlist[2] ) if row >= 0 then local playerName = guiGridListGetItemData(GUIEditor.gridlist[2], row, 1) if playerName and playerName ~= nil then local player = getPlayerFromName(playerName); triggerServerEvent( 'gold_give', localPlayer, player ) end جرب ذا نفس المشكله ما تغير بيه شي Link to comment
+Source|> Posted April 20, 2019 Share Posted April 20, 2019 (edited) elseif source == GUIEditor.button[6] then row = guiGridListGetSelectedItem ( GUIEditor.gridlist[2] ) col = guiGridListGetSelectedItem ( GUIEditor.gridlist[2] ) if row >= 0 then local playerName = guiGridListGetItemData(GUIEditor.gridlist[2], row, 1) if playerName and playerName ~= nil then local playerN = getPlayerFromName(playerName); triggerServerEvent( 'gold_give', localPlayer, playerN ) end function gold_gives( playerN ) local player = playerN givePlayerPackage( player, 'Gold' ) end addEvent("gold_give",true) addEventHandler("gold_give", root, gold_gives) جرب DmAr511 Edited April 20, 2019 by +Source|> Link to comment
Jw8. Posted April 20, 2019 Author Share Posted April 20, 2019 9 minutes ago, +Source|> said: elseif source == GUIEditor.button[6] then row = guiGridListGetSelectedItem ( GUIEditor.gridlist[2] ) col = guiGridListGetSelectedItem ( GUIEditor.gridlist[2] ) if row >= 0 then local playerName = guiGridListGetItemData(GUIEditor.gridlist[2], row, 1) if playerName and playerName ~= nil then local playerN = getPlayerFromName(playerName); triggerServerEvent( 'gold_give', localPlayer, playerN ) end function gold_gives( playerN ) local player = playerN givePlayerPackage( player, 'Gold' ) end addEvent("gold_give",true) addEventHandler("gold_give", root, gold_gives) جرب DmAr511 برضو نفس المشكله Link to comment
+Source|> Posted April 20, 2019 Share Posted April 20, 2019 43 minutes ago, DmAr511 said: برضو نفس المشكله اتوقع مافي خطأ في الاكواد يمكن كود ثاني فيه خطأ Link to comment
Jw8. Posted April 20, 2019 Author Share Posted April 20, 2019 3 minutes ago, +Source|> said: اتوقع مافي خطأ في الاكواد يمكن كود ثاني فيه خطأ بطرلحلك الاكود خاص تعال Link to comment
Guest Posted April 20, 2019 Share Posted April 20, 2019 مو كأنو أكواد الأخ جنرال ؟ @NX_CI Link to comment
nxFairlywell Posted April 20, 2019 Share Posted April 20, 2019 13 minutes ago, DABL said: مو كأنو أكواد الأخ جنرال ؟ @NX_CI it's ok يب ذا الكود كتبته قبل لواحد هنا , أي كود يطرح في المنتدى ما لأحد حق يقول كودي او شي زي كذا Link to comment
Jw8. Posted April 20, 2019 Author Share Posted April 20, 2019 1 minute ago, NX_CI said: it's ok يب ذا الكود كتبته قبل لواحد هنا , أي كود يطرح في المنتدى ما لأحد حق يقول كودي او شي زي كذا طيب وش الحل ليش خربان Link to comment
nxFairlywell Posted April 20, 2019 Share Posted April 20, 2019 1 minute ago, DmAr511 said: طيب وش الحل ليش خربان انت معدل عليه ؟ انا اذكر انه اشتغل اخر مره Link to comment
Jw8. Posted April 20, 2019 Author Share Posted April 20, 2019 Just now, NX_CI said: انت معدل عليه ؟ انا اذكر انه اشتغل اخر مره لا والله ما عدلت شي Just now, NX_CI said: انت معدل عليه ؟ انا اذكر انه اشتغل اخر مره واخذته من شخص Link to comment
KillerX Posted April 20, 2019 Share Posted April 20, 2019 21 hours ago, DmAr511 said: givePlayerPackage وين الفنكشن دا Link to comment
Jw8. Posted April 20, 2019 Author Share Posted April 20, 2019 38 minutes ago, KillerX said: وين الفنكشن دا local packs_kills = { ['Wooden']=5, ['Silver']=40, ['Gold']=50, } for k, v in ipairs ( getElementsByType('player') ) do removeElementData(v,"packages") end function calcKill( _, killer ) local data = getElementData( killer , 'kills' ); if data and type(data) == "number" and data ~= 0 then if data ~= packs_kills['Gold'] and data ~= packs_kills['Silver'] and data ~= packs_kills['Wooden'] then setElementData( killer, 'kills', data+1 ) elseif data == packs_kills['Wooden'] then setElementData( killer, 'kills', data+1 ) givePlayerPackage( killer, 'Wooden' ) elseif data == packs_kills['Silver'] then setElementData( killer, 'kills', data+1 ) givePlayerPackage( killer, 'Silver' ) elseif data == packs_kills['Gold'] then setElementData( killer, 'kills', 1 ) givePlayerPackage( killer, 'Gold' ) end else setElementData( killer, 'kills', 1 ) end end addEventHandler('onPlayerWasted', root, calcKill) function givePlayerPackage( player , package ) if player and package then if isElement( player ) then if type( package ) == 'string' then if package == 'Wooden' or package == 'Silver' or package == 'Gold' then local packs = getElementData( player, 'packages' ) if type(packs) == 'table' then local Wooden=packs.wooden local Silver=packs.silver local Gold=packs.gold if Wooden and Silver and Gold then if package == 'Wooden' then setElementData(player,'packages',{wooden=Wooden+1, silver=Silver, gold=Gold}) outputChatBox("You got a Wooden package",player) elseif package == 'Silver' then setElementData(player,'packages',{wooden=Wooden, silver=Silver+1, gold=Gold}) outputChatBox("You got a Silver package",player) elseif package == 'Gold' then setElementData(player,'packages',{wooden=Wooden, silver=Silver, gold=Gold+1}) outputChatBox("You got a Golden package",player) end end else if package == 'Wooden' then setElementData(player,'packages',{wooden=1, silver=0, gold=0}) outputChatBox("You got a Wooden package",player) elseif package == 'Silver' then setElementData(player,'packages',{wooden=0, silver=1, gold=0}) outputChatBox("You got a Silver package",player) elseif package == 'Gold' then setElementData(player,'packages',{wooden=0, silver=0, gold=1}) outputChatBox("You got a Golden package",player) end end end end end end end function takePlayerPackage( player, package ) if player and package then if isElement( player ) then if type( package ) == 'string' then if package == 'Wooden' or package == 'Silver' or package == 'Gold' then local packs = getElementData( player, 'packages' ) if type(packs) == 'table' then local Wooden=packs.wooden local Silver=packs.silver local Gold=packs.gold if Wooden and Silver and Gold then if package == 'Wooden' then if Wooden > 0 then setElementData(player,'packages',{wooden=Wooden-1, silver=Silver, gold=Gold}) outputChatBox("You have lost a Wooden package",player) end elseif package == 'Silver' then if Silver > 0 then setElementData(player,'packages',{wooden=Wooden, silver=Silver-1, gold=Gold}) outputChatBox("You have lost a Silver package",player) end elseif package == 'Gold' then if Gold > 0 then setElementData(player,'packages',{wooden=Wooden, silver=Silver, gold=Gold-1}) outputChatBox("You have lost a Golden package",player) end end end else if package == 'Wooden' then setElementData(player,'packages',{wooden=0, silver=0, gold=0}) outputChatBox("You have lost a Wooden package",player) elseif package == 'Silver' then setElementData(player,'packages',{wooden=0, silver=0, gold=0}) outputChatBox("You have lost a Silver package",player) elseif package == 'Gold' then setElementData(player,'packages',{wooden=0, silver=0, gold=0}) outputChatBox("You have lost a Golden package",player) end end end end end end end function wooden_gives( source ) givePlayerPackage( source, 'Wooden' ) end addEvent("wooden_gives",true) addEventHandler("wooden_gives", root, wooden_gives) function silver_gives( player ) givePlayerPackage( player, 'Silver' ) end addEvent("silver_gives",true) addEventHandler("silver_gives", root, silver_gives) function gold_gives( playerN ) local player = playerN givePlayerPackage( playerN, 'Gold' ) end addEvent("gold_give",true) addEventHandler("gold_give", root, gold_gives) function givePlayerGift( package ) if package == "Wooden" then takePlayerPackage( source, package ) randomMoney = math.random(1000, 5000) givePlayerMoney( source, randomMoney ); -- جائزة بكج ودن outputChatBox("Open package has been succesfully and you won : $"..tostring(randomMoney), source, 204,102,0) elseif package == "Silver" then takePlayerPackage( source, package ); randomMoney =math.random(5000, 10000) givePlayerMoney( source, randomMoney ); -- جائزة بكج السلفر outputChatBox("Open package has been succesfully and you won : $"..tostring(randomMoney), source, 155,155,155) elseif package == "Gold" then takePlayerPackage( source, package ); randomMoney=math.random(10000, 30000) givePlayerMoney( source, randomMoney ); -- جائزة بكج القولد outputChatBox("Open Golden package has been succesfully and you won : $"..tostring(randomMoney), source, 255,255,0) end end addEvent("givePlayerGift",true) addEventHandler("givePlayerGift", root, givePlayerGift) local packs_kills = { ['Wooden']=5, ['Silver']=40, ['Gold']=50, } for k, v in ipairs ( getElementsByType('player') ) do removeElementData(v,"packages") end function calcKill( _, killer ) local data = getElementData( killer , 'kills' ); if data and type(data) == "number" and data ~= 0 then if data ~= packs_kills['Gold'] and data ~= packs_kills['Silver'] and data ~= packs_kills['Wooden'] then setElementData( killer, 'kills', data+1 ) elseif data == packs_kills['Wooden'] then setElementData( killer, 'kills', data+1 ) givePlayerPackage( killer, 'Wooden' ) elseif data == packs_kills['Silver'] then setElementData( killer, 'kills', data+1 ) givePlayerPackage( killer, 'Silver' ) elseif data == packs_kills['Gold'] then setElementData( killer, 'kills', 1 ) givePlayerPackage( killer, 'Gold' ) end else setElementData( killer, 'kills', 1 ) end end addEventHandler('onPlayerWasted', root, calcKill) function givePlayerPackage( player , package ) if player and package then if isElement( player ) then if type( package ) == 'string' then if package == 'Wooden' or package == 'Silver' or package == 'Gold' then local packs = getElementData( player, 'packages' ) if type(packs) == 'table' then local Wooden=packs.wooden local Silver=packs.silver local Gold=packs.gold if Wooden and Silver and Gold then if package == 'Wooden' then setElementData(player,'packages',{wooden=Wooden+1, silver=Silver, gold=Gold}) outputChatBox("You got a Wooden package",player) elseif package == 'Silver' then setElementData(player,'packages',{wooden=Wooden, silver=Silver+1, gold=Gold}) outputChatBox("You got a Silver package",player) elseif package == 'Gold' then setElementData(player,'packages',{wooden=Wooden, silver=Silver, gold=Gold+1}) outputChatBox("You got a Golden package",player) end end else if package == 'Wooden' then setElementData(player,'packages',{wooden=1, silver=0, gold=0}) outputChatBox("You got a Wooden package",player) elseif package == 'Silver' then setElementData(player,'packages',{wooden=0, silver=1, gold=0}) outputChatBox("You got a Silver package",player) elseif package == 'Gold' then setElementData(player,'packages',{wooden=0, silver=0, gold=1}) outputChatBox("You got a Golden package",player) end end end end end end end function takePlayerPackage( player, package ) if player and package then if isElement( player ) then if type( package ) == 'string' then if package == 'Wooden' or package == 'Silver' or package == 'Gold' then local packs = getElementData( player, 'packages' ) if type(packs) == 'table' then local Wooden=packs.wooden local Silver=packs.silver local Gold=packs.gold if Wooden and Silver and Gold then if package == 'Wooden' then if Wooden > 0 then setElementData(player,'packages',{wooden=Wooden-1, silver=Silver, gold=Gold}) outputChatBox("You have lost a Wooden package",player) end elseif package == 'Silver' then if Silver > 0 then setElementData(player,'packages',{wooden=Wooden, silver=Silver-1, gold=Gold}) outputChatBox("You have lost a Silver package",player) end elseif package == 'Gold' then if Gold > 0 then setElementData(player,'packages',{wooden=Wooden, silver=Silver, gold=Gold-1}) outputChatBox("You have lost a Golden package",player) end end end else if package == 'Wooden' then setElementData(player,'packages',{wooden=0, silver=0, gold=0}) outputChatBox("You have lost a Wooden package",player) elseif package == 'Silver' then setElementData(player,'packages',{wooden=0, silver=0, gold=0}) outputChatBox("You have lost a Silver package",player) elseif package == 'Gold' then setElementData(player,'packages',{wooden=0, silver=0, gold=0}) outputChatBox("You have lost a Golden package",player) end end end end end end end function wooden_gives( source ) givePlayerPackage( source, 'Wooden' ) end addEvent("wooden_gives",true) addEventHandler("wooden_gives", root, wooden_gives) function silver_gives( player ) givePlayerPackage( player, 'Silver' ) end addEvent("silver_gives",true) addEventHandler("silver_gives", root, silver_gives) function gold_gives( playerN ) local player = playerN givePlayerPackage( playerN, 'Gold' ) end addEvent("gold_give",true) addEventHandler("gold_give", root, gold_gives) function givePlayerGift( package ) if package == "Wooden" then takePlayerPackage( source, package ) randomMoney = math.random(1000, 5000) givePlayerMoney( source, randomMoney ); -- جائزة بكج ودن outputChatBox("Open package has been succesfully and you won : $"..tostring(randomMoney), source, 204,102,0) elseif package == "Silver" then takePlayerPackage( source, package ); randomMoney =math.random(5000, 10000) givePlayerMoney( source, randomMoney ); -- جائزة بكج السلفر outputChatBox("Open package has been succesfully and you won : $"..tostring(randomMoney), source, 155,155,155) elseif package == "Gold" then takePlayerPackage( source, package ); randomMoney=math.random(10000, 30000) givePlayerMoney( source, randomMoney ); -- جائزة بكج القولد outputChatBox("Open Golden package has been succesfully and you won : $"..tostring(randomMoney), source, 255,255,0) end end addEvent("givePlayerGift",true) addEventHandler("givePlayerGift", root, givePlayerGift) Link to comment
KillerX Posted April 20, 2019 Share Posted April 20, 2019 لاحظت ف الصورة ان في خطا قبل اللي انتا مصورة صور الديبوق كامل Link to comment
Jw8. Posted April 20, 2019 Author Share Posted April 20, 2019 23 minutes ago, KillerX said: لاحظت ف الصورة ان في خطا قبل اللي انتا مصورة صور الديبوق كامل ذه اسمي حاذفه !! والاخطاء هي هي Link to comment
!# H E R O ,_ Posted April 21, 2019 Share Posted April 21, 2019 (edited) تحقق من الميتا ان ملف السيرفر الـ - type حقه server مثل كدا <meta> <script src="s.lua" type="server" cache="false"/> </meta> Edited April 21, 2019 by #Bad_Boy, Link to comment
Scripting Moderators xLive Posted April 21, 2019 Scripting Moderators Share Posted April 21, 2019 32 minutes ago, #Bad_Boy, said: تحقق من الميتا ان ملف السيرفر الـ - type حقه server مثل كدا <meta><script src="s.lua" type="server" cache="false"/></meta> cache م يحتاج تحط الـ بما ان الملف سيرفر سايد 1 Link to comment
Jw8. Posted April 21, 2019 Author Share Posted April 21, 2019 55 minutes ago, Live said: cache م يحتاج تحط الـ بما ان الملف سيرفر سايد كلو تمام في ملف ميتا المشكله هي هي Link to comment
Guest Posted April 21, 2019 Share Posted April 21, 2019 2 hours ago, DmAr511 said: كلو تمام في ملف ميتا المشكله هي هي أطرح جميع الأكواد بالكلنت والسيرفر Link to comment
Jw8. Posted April 21, 2019 Author Share Posted April 21, 2019 GUIEditor = { gridlist = {}, window = {}, button = {}, label = {} } local screenW, screenH = guiGetScreenSize() addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow((screenW - 325) / 2, (screenH - 259) / 2, 325, 259, ":: Package ::", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetVisible(GUIEditor.window[1], false) GUIEditor.gridlist[1] = guiCreateGridList(13, 25, 170, 224, false, GUIEditor.window[1]) guiGridListAddColumn(GUIEditor.gridlist[1], "Packages", 0.9) GUIEditor.button[2] = guiCreateButton(195, 29, 120, 26, "Open Package", false, GUIEditor.window[1]) GUIEditor.button[1] = guiCreateButton(195, 65, 120, 24, "Admin Panel", false, GUIEditor.window[1]) GUIEditor.label[4] = guiCreateLabel(195, 221, 74, 18, "Package v1", false, GUIEditor.window[1]) GUIEditor.label[1] = guiCreateLabel(198, 99, 122, 16, "Wooden package : 0", false, GUIEditor.window[1]) guiLabelSetColor(GUIEditor.label[2], 186, 149, 68) GUIEditor.label[2] = guiCreateLabel(198, 125, 122, 16, "Silver package : 0", false, GUIEditor.window[1]) guiLabelSetColor(GUIEditor.label[3], 15, 167, 238) GUIEditor.label[3] = guiCreateLabel(198, 151, 122, 16, "Golden package : 0", false, GUIEditor.window[1]) guiLabelSetColor(GUIEditor.label[4], 252, 95, 0) GUIEditor.button[3] = guiCreateButton(265, 223, 50, 26, "Close", false, GUIEditor.window[1]) --لوحة التوزيع GUIEditor.window[2] = guiCreateWindow((screenW - 226) / 2, (screenH - 257) / 2, 226, 257, ":: Gives ::", false) guiWindowSetSizable(GUIEditor.window[2], false) guiSetVisible(GUIEditor.window[2], false) GUIEditor.gridlist[2] = guiCreateGridList(9, 21, 144, 199, false, GUIEditor.window[2]) guiGridListAddColumn(GUIEditor.gridlist[2], "players", 0.9) GUIEditor.button[7] = guiCreateButton(153, 28, 63, 22, "بكج برونزي", false, GUIEditor.window[2]) GUIEditor.button[5] = guiCreateButton(153, 60, 63, 22, "بكج سلفر", false, GUIEditor.window[2]) GUIEditor.button[6] = guiCreateButton(154, 92, 62, 22, "بكج قولد", false, GUIEditor.window[2]) GUIEditor.button[8] = guiCreateButton(17, 228, 113, 19, "Close", false, GUIEditor.window[2]) end ) windowVisible = function() if guiGetVisible(GUIEditor.window[1]) then guiSetVisible( GUIEditor.window[1], false ) showCursor( false ) guiSetEnabled(GUIEditor.button[1], false) if timer and isTimer(timer) then killTimer(timer) end else guiSetVisible( GUIEditor.window[1], true ) showCursor( true ) guiGridListClear(GUIEditor.gridlist[1]) refreshPackageGridList() if getPlayerSerial(localPlayer) == "580F0C49F952A1322839284A4FFE6A53" then guiSetEnabled(GUIEditor.button[1], true) end timer = setTimer( function() setLabelPackagesCount() refreshPackageGridList() end, 5000, 0) end if guiGetVisible(GUIEditor.window[2]) then guiSetVisible(GUIEditor.window[2], false); guiGridListClear(GUIEditor.gridlist[2]) end end bindKey('F7', 'down', windowVisible) function setLabelPackagesCount() local count = getElementData(localPlayer,'packages') if count then guiSetText(GUIEditor.label[1],"Wooden package : "..tostring(count.wooden)) guiSetText(GUIEditor.label[2],"Silver package : "..tostring(count.silver)) guiSetText(GUIEditor.label[3],"Golden package : "..tostring(count.gold)) end end function getPlayerPackages( player ) if isElement(player) then if getElementType(player) == 'player' then local playerPacks = getElementData( player, 'packages') if playerPacks and type(playerPacks)=='table' then for k, v in ipairs (playerPacks) do return v end else return false end else return nil end else return nil end end function refreshPackageGridList() local clear=guiGridListClear(GUIEditor.gridlist[1]) if clear then local packs = getElementData(localPlayer, 'packages') if packs then if packs.wooden >= 1 or packs.silver >= 1 or packs.gold >= 1 then if packs then for i = 1, packs.wooden do local row = guiGridListAddRow ( GUIEditor.gridlist[1], i ) guiGridListSetItemText ( GUIEditor.gridlist[1], row, 1, 'Wooden', false, false ) guiGridListSetItemColor ( GUIEditor.gridlist[1], row, 1, 232, 108, 0 ) end for i = 1, packs.silver do local row = guiGridListAddRow ( GUIEditor.gridlist[1], i ) guiGridListSetItemText ( GUIEditor.gridlist[1], row, 1, 'Silver', false, false ) guiGridListSetItemColor ( GUIEditor.gridlist[1], row, 1, 155, 155, 155 ) end for i = 1, packs.gold do local row = guiGridListAddRow ( GUIEditor.gridlist[1], i ) guiGridListSetItemText ( GUIEditor.gridlist[1], row, 1, 'Gold', false, false ) guiGridListSetItemColor ( GUIEditor.gridlist[1], row, 1, 238, 238, 123 ) end end end end end end addEventHandler("onClientGUIClick", root, function() if source == GUIEditor.button[1] then local status=guiGetVisible(GUIEditor.window[2]); guiSetVisible(GUIEditor.window[2],not status); local clear = guiGridListClear(GUIEditor.gridlist[2]); if clear then guiGridListAddPlayers(); end elseif source == GUIEditor.button[8] then guiSetVisible(GUIEditor.window[2],false) guiGridListClear(GUIEditor.gridlist[2]) elseif source == GUIEditor.button[7] then row , col = guiGridListGetSelectedItem ( GUIEditor.gridlist[2] ) if row >= 0 then local playerName = guiGridListGetItemData(GUIEditor.gridlist[2], row, 1) if playerName and playerName ~= nil then local player = getPlayerFromName(playerName); triggerServerEvent( 'wooden_gives', localPlayer, player ) end else return outputChatBox('الرجاء تحديد اللاعب من القائمة', 255, 0 , 0) end elseif source == GUIEditor.button[5] then row , col = guiGridListGetSelectedItem ( GUIEditor.gridlist[2] ) if row >= 0 then local playerName = guiGridListGetItemData(GUIEditor.gridlist[2], row, 1) if playerName and playerName ~= nil then local player = getPlayerFromName(playerName); triggerServerEvent( 'silver_gives', localPlayer, player ) end else return outputChatBox('الرجاء تحديد اللاعب من القائمة', 255, 0 , 0) end elseif source == GUIEditor.button[6] then row = guiGridListGetSelectedItem ( GUIEditor.gridlist[2] ) col = guiGridListGetSelectedItem ( GUIEditor.gridlist[2] ) if row >= 0 then local playerName = guiGridListGetItemData(GUIEditor.gridlist[2], row, 1) if playerName and playerName ~= nil then local playerN = getPlayerFromName(playerName); triggerServerEvent( 'gold_give', localPlayer, playerN ) end else return outputChatBox('الرجاء تحديد اللاعب من القائمة', 255, 0 , 0) end elseif source == GUIEditor.button[3] then windowVisible() elseif source == GUIEditor.button[2] then guiSetEnabled(GUIEditor.button[2],false) setTimer(guiSetEnabled, 5000, 1, GUIEditor.button[2],true) local row, col = guiGridListGetSelectedItem(GUIEditor.gridlist[1]); if row >= 0 then local package = guiGridListGetItemText( GUIEditor.gridlist[1], row, 1 ); if package then if package == "Wooden" or package == "Silver" or package == "Gold" then triggerServerEvent("givePlayerGift", localPlayer, package); end end else return outputChatBox("Please Select Package", 255,0,0); end end end ) function guiGridListAddPlayers() for k, v in ipairs (getElementsByType("player"))do local names = getPlayerName(v) local row = guiGridListAddRow( GUIEditor.gridlist[2] ) local text = guiGridListSetItemText( GUIEditor.gridlist[2], row, 1, string.gsub(names,'#%x%x%x%x%x%x',''), false, false ) local data = guiGridListSetItemData(GUIEditor.gridlist[2], row, 1, names) guiGridListSetItemColor(GUIEditor.gridlist[2], row, 1, 255,255,0) end end local packs_kills = { ['Wooden']=5, ['Silver']=40, ['Gold']=50, } for k, v in ipairs ( getElementsByType('player') ) do removeElementData(v,"packages") end function calcKill( _, killer ) local data = getElementData( killer , 'kills' ); if data and type(data) == "number" and data ~= 0 then if data ~= packs_kills['Gold'] and data ~= packs_kills['Silver'] and data ~= packs_kills['Wooden'] then setElementData( killer, 'kills', data+1 ) elseif data == packs_kills['Wooden'] then setElementData( killer, 'kills', data+1 ) givePlayerPackage( killer, 'Wooden' ) elseif data == packs_kills['Silver'] then setElementData( killer, 'kills', data+1 ) givePlayerPackage( killer, 'Silver' ) elseif data == packs_kills['Gold'] then setElementData( killer, 'kills', 1 ) givePlayerPackage( killer, 'Gold' ) end else setElementData( killer, 'kills', 1 ) end end addEventHandler('onPlayerWasted', root, calcKill) function givePlayerPackage( player , package ) if player and package then if isElement( player ) then if type( package ) == 'string' then if package == 'Wooden' or package == 'Silver' or package == 'Gold' then local packs = getElementData( player, 'packages' ) if type(packs) == 'table' then local Wooden=packs.wooden local Silver=packs.silver local Gold=packs.gold if Wooden and Silver and Gold then if package == 'Wooden' then setElementData(player,'packages',{wooden=Wooden+1, silver=Silver, gold=Gold}) outputChatBox("You got a Wooden package",player) elseif package == 'Silver' then setElementData(player,'packages',{wooden=Wooden, silver=Silver+1, gold=Gold}) outputChatBox("You got a Silver package",player) elseif package == 'Gold' then setElementData(player,'packages',{wooden=Wooden, silver=Silver, gold=Gold+1}) outputChatBox("You got a Golden package",player) end end else if package == 'Wooden' then setElementData(player,'packages',{wooden=1, silver=0, gold=0}) outputChatBox("You got a Wooden package",player) elseif package == 'Silver' then setElementData(player,'packages',{wooden=0, silver=1, gold=0}) outputChatBox("You got a Silver package",player) elseif package == 'Gold' then setElementData(player,'packages',{wooden=0, silver=0, gold=1}) outputChatBox("You got a Golden package",player) end end end end end end end function takePlayerPackage( player, package ) if player and package then if isElement( player ) then if type( package ) == 'string' then if package == 'Wooden' or package == 'Silver' or package == 'Gold' then local packs = getElementData( player, 'packages' ) if type(packs) == 'table' then local Wooden=packs.wooden local Silver=packs.silver local Gold=packs.gold if Wooden and Silver and Gold then if package == 'Wooden' then if Wooden > 0 then setElementData(player,'packages',{wooden=Wooden-1, silver=Silver, gold=Gold}) outputChatBox("You have lost a Wooden package",player) end elseif package == 'Silver' then if Silver > 0 then setElementData(player,'packages',{wooden=Wooden, silver=Silver-1, gold=Gold}) outputChatBox("You have lost a Silver package",player) end elseif package == 'Gold' then if Gold > 0 then setElementData(player,'packages',{wooden=Wooden, silver=Silver, gold=Gold-1}) outputChatBox("You have lost a Golden package",player) end end end else if package == 'Wooden' then setElementData(player,'packages',{wooden=0, silver=0, gold=0}) outputChatBox("You have lost a Wooden package",player) elseif package == 'Silver' then setElementData(player,'packages',{wooden=0, silver=0, gold=0}) outputChatBox("You have lost a Silver package",player) elseif package == 'Gold' then setElementData(player,'packages',{wooden=0, silver=0, gold=0}) outputChatBox("You have lost a Golden package",player) end end end end end end end function wooden_gives( source ) givePlayerPackage( source, 'Wooden' ) end addEvent("wooden_gives",true) addEventHandler("wooden_gives", root, wooden_gives) function silver_gives( player ) givePlayerPackage( player, 'Silver' ) end addEvent("silver_gives",true) addEventHandler("silver_gives", root, silver_gives) function gold_gives( playerN ) local player = playerN givePlayerPackage( playerN, 'Gold' ) end addEvent("gold_give",true) addEventHandler("gold_give", root, gold_gives) function givePlayerGift( package ) if package == "Wooden" then takePlayerPackage( source, package ) randomMoney = math.random(1000, 5000) givePlayerMoney( source, randomMoney ); -- جائزة بكج ودن outputChatBox("Open package has been succesfully and you won : $"..tostring(randomMoney), source, 204,102,0) elseif package == "Silver" then takePlayerPackage( source, package ); randomMoney =math.random(5000, 10000) givePlayerMoney( source, randomMoney ); -- جائزة بكج السلفر outputChatBox("Open package has been succesfully and you won : $"..tostring(randomMoney), source, 155,155,155) elseif package == "Gold" then takePlayerPackage( source, package ); randomMoney=math.random(10000, 30000) givePlayerMoney( source, randomMoney ); -- جائزة بكج القولد outputChatBox("Open Golden package has been succesfully and you won : $"..tostring(randomMoney), source, 255,255,0) end end addEvent("givePlayerGift",true) addEventHandler("givePlayerGift", root, givePlayerGift) dda Link to comment
JustP Posted April 21, 2019 Share Posted April 21, 2019 (edited) On 20/04/2019 at 00:43, DmAr511 said: Previous Page Next Page السلام عليكم ورحمة الله وبركاته في عندي مشكله بلمود ذه راح اطرح الكود function gold_gives( player ) givePlayerPackage( player, 'Gold' ) end addEvent("gold_gives",true) addEventHandler("gold_gives", root, gold_gives) كل ما اوزع ما اقدر يكتب لي بلديبق كلمات طبعا هاذا ملفات كلينت elseif source == GUIEditor.button[6] then row , col = guiGridListGetSelectedItem ( GUIEditor.gridlist[2] ) if row >= 0 then local playerName = guiGridListGetItemData(GUIEditor.gridlist[2], row, 1) if playerName and playerName ~= nil then local player = getPlayerFromName(playerName); triggerServerEvent( 'gold_gives', localPlayer, player ) end يكتب لي بلديبق https://d.top4top.net/p_1204j40wv1.png Previous Page Next Page - givePlayerPackage اذا مو موجود في ملفات السيرفر حقك فلازم تسوي exports.resourcename:givePlayerPackage( player, 'gold') Edited April 21, 2019 by Sub[Z]ero Add lua code Link to comment
Jw8. Posted April 21, 2019 Author Share Posted April 21, 2019 2 hours ago, Sub[Z]ero said: - givePlayerPackage اذا مو موجود في ملفات السيرفر حقك فلازم تسوي exports.resourcename:givePlayerPackage( player, 'gold') ما في :] 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