SOoORA Posted January 11, 2016 Share Posted January 11, 2016 سلام عليكم و رحمة الله و بركاته اريد تعديل علي هاذا سكريبت هاذا سكريبت يرسل عن طريق الاسم فقط اريد تعديله يرسل لي حساب لاعب او تختار اسم لاعب مشان ترسل له و شكرا ارجوا الرد سريع addEventHandler("onResourceStart",resourceRoot, function() for _, player in ipairs(getElementsByType("player")) do setElementData(player, "moneycoins", 0) end end ) addEventHandler("onPlayerJoin",root, function() if get("EnableAdminCommands") == "true" then addCommandHandler("givediamond",_givePlayerCoin) addCommandHandler("takediamond",_takePlayerCoin) end setElementData(source, "moneycoins", 0) end ) addEventHandler("onPlayerJoin",root, function() setElementData(source,"moneycoins",0) end) function takePlayerCoin(thePlayer, number) if ( getElementType ( thePlayer ) == "player" ) then setElementData(thePlayer,"moneycoins",getElementData(thePlayer, "moneycoins")-tonumber(number)) end end function setPlayerCoin(thePlayer, number) if ( getElementType ( thePlayer ) == "player" ) then setElementData(thePlayer,"moneycoins",tonumber(number)) end end function givePlayerCoin(thePlayer, number) if ( getElementType ( thePlayer ) == "player" ) then setElementData(thePlayer,"moneycoins",getElementData(thePlayer, "moneycoins")+tonumber(number)) end end function getPlayerCoin(thePlayer) local data = getElementData(thePlayer, "moneycoins") thePoints = tonumber(data) return thePoints end function _takePlayerCoin(thePlayer, command, who, amount) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Console" ) ) then if not tonumber ( amount ) then exports.TopBarChat:sendClientMessage("ff0000DiamondSystem: /takeDiamond ", thePlayer, 255, 211, 100) return end local receiver = getPlayerFromName(who) if not (receiver) then exports.TopBarChat:sendClientMessage("Account not found.", thePlayer, 255, 100, 100, true) return end if not(tonumber ( amount ) <= 0) and not( tonumber ( amount ) >= 999 ) then setPlayerCoin (receiver, getElementData(receiver, "moneycoins")-amount) exports.TopBarChat:sendClientMessage("Admin Take "..amount.." In your Diamond "..acc:gsub('#%x%x%x%x%x%x', '').."!", thePlayer, 100, 255, 100, true) else exports.TopBarChat:sendClientMessage("", thePlayer, 255, 100, 100, true) end end end function _givePlayerCoin(thePlayer, command, who, amount) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Console" ) ) then if not tonumber ( amount ) then exports.TopBarChat:sendClientMessage("DiamondSystem: /giveDiamond ", thePlayer, 255, 211, 100) return end local receiver = getPlayerFromName(who) if not (receiver) then exports.TopBarChat:sendClientMessage("Account not found.", thePlayer, 255, 100, 100, true) return end if not(tonumber ( amount ) <= 0) and not( tonumber ( amount ) >= 999 ) then setPlayerCoin (receiver, getElementData(receiver, "moneycoins")+amount) exports.TopBarChat:sendClientMessage("Admin Give You "..amount.." Diamonds "..getPlayerAccount:gsub('#%x%x%x%x%x%x', '').."!", thePlayer, 100, 255, 100, true) exports.TopBarChat:sendClientMessage("You Give "..amount.." Diamond For "..getPlayerAccount(thePlayer):gsub('#%x%x%x%x%x%x', '').."!", receiver, 100, 255, 100, true) else exports.TopBarChat:sendClientMessage("You can' Give 0 Diamond", thePlayer, 255, 100, 100, true) end end end addCommandHandler("givediamond",_givePlayerCoin) addCommandHandler("takediamond",_takePlayerCoin) Link to comment
a7zan Posted January 11, 2016 Share Posted January 11, 2016 سؤال ماله دخل بالموضوع ليه مقلد سورا؟ Link to comment
The Killer Posted January 11, 2016 Share Posted January 11, 2016 addEventHandler ("onResourceStart", resourceRoot, function () for _, player in ipairs (getElementsByType ("player")) do setElementData (player, "moneycoins", 0) end end ) addEventHandler ("onPlayerJoin",root, function () if get ("EnableAdminCommands") == "true" then addCommandHandler ("givediamond", _givePlayerCoin) addCommandHandler ("takediamond", _takePlayerCoin) end setElementData (source, "moneycoins", 0) end ) function _takePlayerCoin (thePlayer, _, who, amount) local acc = getPlayerAccount (thePlayer) if not isGuestAccount (acc) then local accName = getAccountName (acc) if isObjectInACLGroup ("user." .. accName, aclGetGroup ("Console")) then if (who and amount) then if tonumber (amount) ~= nil then if getAccount (who) then for _,v in ipairs (getElementsByType ("player")) do local pacc = getPlayerAccount (v) if not isGuestAccount (pacc) then local paccName = getAccountName (pacc) if (paccName == who) then setElementData (v, "moneycoins", (getElementData (v, "moneycoins") or 0) - amount) exports.TopBarChat:sendClientMessage ("Admin has taked " .. amount .. " diamonds from you.", v, 100, 255, 100, true) exports.TopBarChat:sendClientMessage ("You have taked " .. amount .. " diamonds from him.", v, 100, 255, 100, true) break end end end else exports.TopBarChat:sendClientMessage ("Account not found.", thePlayer, 255, 100, 100, true) end else exports.TopBarChat:sendClientMessage ("Only numbers are allowed.", thePlayer, 255, 0, 0, true) end else exports.TopBarChat:sendClientMessage ("Syntax: < Account Name > < Amount >", thePlayer, 255, 100, 100) end end end end function _givePlayerCoin (thePlayer, _, who, amount) local acc = getPlayerAccount (thePlayer) if not isGuestAccount (acc) then local accName = getAccountName (acc) if isObjectInACLGroup ("user." .. accName, aclGetGroup ("Console")) then if (who and amount) then if tonumber (amount) ~= nil then if getAccount (who) then for _,v in ipairs (getElementsByType ("player")) do local pacc = getPlayerAccount (v) if not isGuestAccount (pacc) then local paccName = getAccountName (pacc) if (paccName == who) then setElementData (v, "moneycoins", (getElementData (v, "moneycoins") or 0) + amount) exports.TopBarChat:sendClientMessage ("Admin has gave you " .. amount .. " diamonds.", v, 100, 255, 100, true) exports.TopBarChat:sendClientMessage ("You have given him " .. amount .. " diamonds.", v, 100, 255, 100, true) break end end end else exports.TopBarChat:sendClientMessage ("Account not found.", thePlayer, 255, 100, 100, true) end else exports.TopBarChat:sendClientMessage ("Only numbers are allowed.", thePlayer, 255, 0, 0, true) end else exports.TopBarChat:sendClientMessage ("Syntax: < Account Name > < Amount >", thePlayer, 255, 100, 100) end end end end addCommandHandler ("givediamond", _givePlayerCoin) addCommandHandler ("takediamond", _takePlayerCoin) Link to comment
SOoORA Posted January 11, 2016 Author Share Posted January 11, 2016 شكرا اخي the killer لاكن للاسف لساتوا يرسل من الاسم و ما ينحفظوا انا نسيت احط تسوي كود يحفظهم بس عادي مو مشكلة Link to comment
The Killer Posted January 11, 2016 Share Posted January 11, 2016 كيف يرسل من الاسم تطقطق انت ؟ خخ انا مجربه ويرسل على حسابي # امكن انت الي تبي ترسل له حسابه نفس اسمه وبس # Link to comment
SOoORA Posted January 11, 2016 Author Share Posted January 11, 2016 كيف يرسل من الاسم تطقطق انت ؟ خخانا مجربه ويرسل على حسابي # امكن انت الي تبي ترسل له حسابه نفس اسمه وبس # طيب كيف تسويهم ينحفظوا الجواهر؟ Link to comment
SycroX Posted January 11, 2016 Share Posted January 11, 2016 function playerLogin (thePreviousAccount, theCurrentAccount, autoLogin) if not (isGuestAccount (getPlayerAccount(source))) then local accountData = getAccountData (theCurrentAccount, "moneycoins") if (accountData) then local playerMoney = getAccountData(theCurrentAccount, "moneycoins") setElementData(source, "moneycoins", playerMoney) else setElementData(source, "moneycoins", 50000) end end end addEventHandler("onPlayerLogin", getRootElement(), playerLogin) function onQuit() if not (isGuestAccount (getPlayerAccount (source))) then account = getPlayerAccount (source) if (account) then setAccountData(account,"moneycoins", tostring(getElementData(source, "moneycoins"))) end end end addEventHandler("onPlayerQuit", getRootElement(), onQuit) طبعا ملف سيرفر Link to comment
SOoORA Posted January 11, 2016 Author Share Posted January 11, 2016 function playerLogin (thePreviousAccount, theCurrentAccount, autoLogin) if not (isGuestAccount (getPlayerAccount(source))) then local accountData = getAccountData (theCurrentAccount, "moneycoins") if (accountData) then local playerMoney = getAccountData(theCurrentAccount, "moneycoins") setElementData(source, "moneycoins", playerMoney) else setElementData(source, "moneycoins", 50000) end end end addEventHandler("onPlayerLogin", getRootElement(), playerLogin) function onQuit() if not (isGuestAccount (getPlayerAccount (source))) then account = getPlayerAccount (source) if (account) then setAccountData(account,"moneycoins", tostring(getElementData(source, "moneycoins"))) end end end addEventHandler("onPlayerQuit", getRootElement(), onQuit) طبعا ملف سيرفر شكرا لك اخي الكريم Link to comment
Mr.Ronaldo Posted January 11, 2016 Share Posted January 11, 2016 اذا تبيه يحفظ عند ايقاف وتشغيل السكربت addEventHandler("onResourceStart",resourceRoot, function() for _, player in ipairs(getElementsByType("player")) do source = player local accountxa = getPlayerAccount(source) if not isGuestAccount(accountxa) and accountxa then local pp = getAccountData(accountxa,"moneycoins") or 0 setElementData(source,"moneycoins",pp) else setElementData(source,"moneycoins",0) end end end ) addEventHandler("onResourceStop",resourceRoot, function(getResourceStoped) if getResourceStoped == getThisResource() then for _, player in ipairs(getElementsByType("player")) do source = player local account = getPlayerAccount(source) local coins = getElementData(source,"moneycoins") or 0 setAccountData(account,"moneycoins",coins) end end end ) 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