Faycel... Posted June 15, 2018 Share Posted June 15, 2018 السلام عليكم ... مثلا نبي نسوي مود جوائز العشوائية في الشات نبيها تجي كل ساعة جوائز تجي لللاعب الي يختاره المود و واش فاز مود يختار 2 لاعبين مب واحد كود مطلوب هو الي يسوي random.math للداتا مثلا رح اسوي كم داتا مب وحدة بس حق اكس بي و لفل و شيء اخر و نبي داتا يختاره المود هو و 2 لاعبين فكر مليح و جاوب ... Link to comment
#RoLde Posted June 15, 2018 Share Posted June 15, 2018 (edited) setTimer getRandomPlayer table = { } table.random -- useful function getElementData + setElementData table.random = https://wiki.multitheftauto.com/wiki/Table.random Edited June 15, 2018 by #RoLde Link to comment
Faycel... Posted June 15, 2018 Author Share Posted June 15, 2018 (edited) تفضل ,ابهرنا ... function RandomPrizes() local players = getElementsByType ( "player" ) local randomPlayer = players[math.random(#players)] local Data = math.random("Money","XP","Launcher") exports["guimessages"]:outputServer(root, "#65E3FC[Random Prizes] #00FF00Player ".. getPlayerName ( randomPlayer ) .." #15FF00[#66AA0D".. XP .." XP#15FF00]#FFFFFF Has Won #15FF00[#66AA0D$".. Data .."#15FF00].", 0, 255, 0) exports["guimessages"]:outputServer(root, "#65E3FC[Random Prizes] #00FF00You Have Got #15FF00[#66AA0D".. getPlayerName ( randomPlayer ) .." #15FF00]#FFFFFF Has Won #15FF00[#66AA0D$".. Data .."#15FF00].", 0, 255, 0) setElementData(randomPlayer, "Data", (getElementData(randomPlayer, "Data") or 0) + Data) playSoundFrontEnd(5) end setTimer(RandomPrizes,*60,1000,0) setTimer(RandomPrizes,3000,1) Edited June 15, 2018 by #1'Maycle Link to comment
#Major . Posted June 15, 2018 Share Posted June 15, 2018 function table.random ( theTable ) return theTable[math.random ( #theTable )] end W = { "Money","XP","Launcher" } function RandomPrizes() local randomPlayer = getRandomPlayer ( ) local Data = table.random(W) exports["guimessages"]:outputServer(root, "#65E3FC[Random Prizes] #00FF00Player ".. getPlayerName ( randomPlayer ) .." #15FF00[#66AA0D".. XP .." XP#15FF00]#FFFFFF Has Won #15FF00[#66AA0D$".. Data .."#15FF00].", 0, 255, 0) exports["guimessages"]:outputServer(root, "#65E3FC[Random Prizes] #00FF00You Have Got #15FF00[#66AA0D".. getPlayerName ( randomPlayer ) .." #15FF00]#FFFFFF Has Won #15FF00[#66AA0D$".. Data .."#15FF00].", 0, 255, 0) setElementData(randomPlayer, ""..Data.."", (getElementData(randomPlayer, ""..Data.."") or 0) + Data) playSoundFrontEnd(5) end setTimer(RandomPrizes,*60,1000,0) setTimer(RandomPrizes,3000,1) جرب الكود سيرفر سايد Link to comment
Faycel... Posted June 15, 2018 Author Share Posted June 15, 2018 بنشوف و نقلك النوت ض Link to comment
Faycel... Posted June 15, 2018 Author Share Posted June 15, 2018 للاسف حتى عدلت عليه اخطاء كانت شوي و ماشتغل !! ذي الكودات حاليا function table.random ( theTable ) return theTable[math.random ( #theTable )] end Money = 20000 XP = 50 Launcher = 10 W = { "Money","XP","Launcher" } function RandomPrizes() local randomPlayer = getRandomPlayer ( ) local Data = table.random(W) exports["guimessages"]:outputServer(root, "#65E3FC[Random Prizes] #00FF00".. getPlayerName ( randomPlayer ) .." #FFFFFF Has Won #15FF00[#66AA0D$".. Data .."#15FF00].", 0, 255, 0) exports["guimessages"]:outputServer(root, "#65E3FC[Random Prizes] #00FF00[#66AA0D".. getPlayerName ( randomPlayer ) .." #15FF00]#FFFFFF Has Won #15FF00[#66AA0D$".. Data .."#15FF00].", 0, 255, 0) setElementData(randomPlayer, ""..Data.."", (getElementData(randomPlayer, ""..Data.."") or 0) + Data) playSoundFrontEnd(5) end setTimer(RandomPrizes,*1,1000,1) setTimer(RandomPrizes,3000,1) Link to comment
#RoLde Posted June 15, 2018 Share Posted June 15, 2018 (edited) W = { {"Money"}, {"XP"}, {"Launcher"}, } function RandomPrizes() local randomPlayer = getRandomPlayer ( ) local Data = table.random(W) local randomnumb = math.random(1,7) exports["guimessages"]:outputServer(root, "#65E3FC[Random Prizes] #00FF00Player ".. getPlayerName ( randomPlayer ) .." #FFFFFF Has Won #15FF00[#66AA0D".. Data .."#15FF00].", 0, 255, 0) setElementData(randomPlayer, ""..Data.."", (getElementData(randomPlayer, Data) or 0) + randomnumb) playSoundFrontEnd(5) end setTimer(RandomPrizes,*60,1000,0) setTimer(RandomPrizes,3000,1) Edited June 15, 2018 by #RoLde Link to comment
N3xT Posted June 16, 2018 Share Posted June 16, 2018 (edited) جرب كذا local prizes = {"EXP", "MONEY", "LEVEL"} function randomWinner () local randomPrize = prizes[math.random(#prizes)] local firstPlayer, secondPlayer = getRandomPlayer(), getRandomPlayer() if ( randomPrize ) then if ( firstPlayer and secondPlayer ) then outputChatBox("First Winner:" .. getPlayerName(firstPlayer) .. " : " .. randomPrize, root, 255, 255, 255, true) outputChatBox("Second Winner:" .. getPlayerName(secondPlayer) .. " : " .. randomPrize, root, 255, 255, 255, true) -- اعطي اللاعب جائزة على حسب كودك end end end setTimer(randomWinner,3600000,0) Edited June 16, 2018 by N3xT Link to comment
#RoLde Posted June 16, 2018 Share Posted June 16, 2018 3 hours ago, N3xT said: جرب كذا local prizes = {"EXP", "MONEY", "LEVEL"} function randomWinner () local randomPrize = prizes[math.random(#prizes)] local firstPlayer, secondPlayer = getRandomPlayer(), getRandomPlayer() if ( randomPrize ) then if ( firstPlayer and secondPlayer ) then outputChatBox("First Winner:" .. getPlayerName(firstPlayer) .. " : " .. randomPrize, root, 255, 255, 255, true) outputChatBox("Second Winner:" .. getPlayerName(secondPlayer) .. " : " .. randomPrize, root, 255, 255, 255, true) -- اعطي اللاعب جائزة على حسب كودك end end end setTimer(randomWinner,3600000,0) نسيت تحط setElementData Link to comment
N3xT Posted June 17, 2018 Share Posted June 17, 2018 9 hours ago, #RoLde said: نسيت تحط setElementData كاتب اعطي اللاعب الجائزة على حسب كودك, انا معرف كيف طريقة اكواده عشان اعطيه جائزة 1 Link to comment
Faycel... Posted June 17, 2018 Author Share Posted June 17, 2018 ناقص كود و يعطيكم العافية setElementData? كود سهل مدري اذا احط setElementData(prizes, هيك شيء Link to comment
N3xT Posted June 17, 2018 Share Posted June 17, 2018 اطرح اكواد الجوائز حقتك ولا على الاقل كيف فكرتها؟ Link to comment
Doffy Posted June 17, 2018 Share Posted June 17, 2018 local prizes = {"EXP", "MONEY", "LEVEL"} function randomWinner () local randomPrize = prizes[math.random(#prizes)] local firstPlayer, secondPlayer = getRandomPlayer(), getRandomPlayer() if ( randomPrize ) then if ( firstPlayer and secondPlayer ) then outputChatBox("First Winner:" .. getPlayerName(firstPlayer) .. " : " .. randomPrize, root, 255, 255, 255, true) setElementData(firstPlayer, randomPrize, (getElementData(firstPlayer, randomPrize) or 0 ) + الجائزة) outputChatBox("Second Winner:" .. getPlayerName(secondPlayer) .. " : " .. randomPrize, root, 255, 255, 255, true) setElementData(secondPlayer, randomPrize, (getElementData(secondPlayer, randomPrize) or 0 ) + الجائزة) -- اعطي اللاعب جائزة على حسب كودك end end end setTimer(randomWinner,3600000,0) الجائزة الي هي العدد حق الي تبيه ياخذه 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