Jump to content

setPlayerMoney على حساب الاعب


M-d-MR

Recommended Posts

اهلا شباب انا استخدمت

givePlayerMoney 

كيف اخلي الاعطاء على حساب الاعب

وبعدها خرج من السيرفر nae متلا شخص سجل بالسيرفر واسم حسابه

كيف اعطيه فلوس وهو بخارج السيرفر ؟

Link to comment
getAccountData(account,"money") 

انا اكتب الاسم في

guiCreateMemo 

يعني

addEvent ( "setMoney",true) 
addEventHandler ( "setMoney", getRootElement(), 
function() 
givePlayerMoney(source,1000) 
--  Memoاعطي لاعب بأسم حسابه حتى لو كان مو موجود اسم حساب الاعب احدده في sourceالحين ابي بدال 
-- Memoالى اسم الحساب الي احدده فيsourceانا مسوي كل شي بس ابي بدل 
end 
) 

Edited by Guest
Link to comment
اطرح الكود كامل ..#
function playerLogin (thePreviousAccount, theCurrentAccount, autoLogin) 
    if not (isGuestAccount (getPlayerAccount(source))) then 
        local accountData = getAccountData (theCurrentAccount, "money") 
        if (accountData) then 
            local playerMoney = getAccountData(theCurrentAccount, "money") 
            setPlayerMoney(source, playerMoney) 
             
        else 
     
        setPlayerMoney(source, 0) 
        end 
    end 
end 
addEventHandler("onPlayerLogin", getRootElement(), playerLogin) 
  
function onQuit() 
    if not (isGuestAccount (getPlayerAccount (source))) then 
        account = getPlayerAccount (source) 
        if (account) then 
            setAccountData(account,"money", tostring(getPlayerMoney(source))) 
        end 
    end 
end 
addEventHandler("onPlayerQuit", getRootElement(), onQuit) 

Memo = guiCreateMemo(70,10,10,50,"Account Name",false,WND) 
triggerServerEvent ( "setMoney",localPlayer,guiGetText( Memo )) 

addEvent ( " setMoney",true) 
addEventHandler( "setMoney",getRootElement(), 
function() 
givePlayerMoney(account,1000) -- اسم الاعب من حسابهaccountابي محل 
end) 

Link to comment
-- Server Side 
addCommandHandler ( "setMoney", 
    function ( thePlayer, _, toWho, aMoney ) 
        if toWho and aMoney then 
            local theAccount = getAccount ( toWho ) 
            if theAccount then 
                local theMoney = tonumber ( aMoney ) 
                if theMoney and theMoney >= 0 then 
                    setAccountData ( theAccount, "money", theMoney ) 
                    outputChatBox ( "[setMoney]: Account [ "..getAccountName ( theAccount ).." ] And Money [ $"..theMoney.." ] Done !", thePlayer, 255, 255, 0 , true ) 
                else 
                    outputChatBox ( "[setMoney]: Error, Add Real Number !!", thePlayer, 255, 0, 0 , true ) 
                end 
            else 
                outputChatBox ( "[setMoney]: Error, Not Found This Account!!", thePlayer, 255, 0, 0 , true ) 
            end 
        else 
            outputChatBox ( "/setMoney [account] [money]", thePlayer, 150, 150, 0, true ) 
        end 
    end 
) 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...