Jump to content

كيف اعطي حساب شي محدد


xb0

Recommended Posts

السلام عليكم ورحمه الله وبركاته

اخواني

ابغى اعرف طريقه او اكواد تساعدني

وهي ابغى كود= اني اعطي حساب شخص غير متوواجد بالسيرفر فلوس

وبس

Link to comment
addEventHandler("onPlayerJoin",root,function() 
    getAccount(username,password ) 
               local playermoney = getPlayerMoney ( source ) 
            setAccountData ( playeraccount, "piraterpg.money", playermoney ) 
      end 
end 
  
  

account getAccount ( string username, [ string password ] ) 

getAccount("username","password" )

Link to comment

شوف تقدر تجيب الحساب عبر الاسم والباس

وتحط داتا للحساب وتحط القيمة

مثلا فلوس ، سلاح، رصاص ، اسم للاعب ..الخ

local acc = getAccount( "xb0", "1234" ) -- first arg = username , second arg = password 
function :  
value = money, ammo, weapon, name ...etc. 
setAccountData( acc, "anyThing", value ) -- value = money, var, count, weapons. etc.. 
end -- function 
  

Link to comment

بجرب

انا عندي مثلا ابي اعطي عضويه محدد الفلوس يعني

ابغى زي الامر

باف8 احط الحساب مسافه الفلوس مثلا

++++++++++++++++++

لسا ماجربت الكود حقكم بس بعطيكم الطريقه الي ابغاها لو موجودة

Link to comment
addCommandHandler("setMoney", 
function( player, cmd, account, count ) 
     if cmd and account then 
            local money = tonumber( count ) 
            local acc = getAccount( account ) 
            setAccountData( acc, "accMoney", money ) 
     else return end 
end ) 
  
addEventHandler( "onPlayerLogin", root, 
function( acc ) 
      if acc then 
           local data = getAccountData( acc, "accMoney" ) 
      elseif data then 
           givePlayerMoney( source, tonumber( data ) ) 
     else return end 
end ) 
  

جرب كود سيرفر بس ماني مجربه

Link to comment
addCommandHandler("setMoney", 
function( player, cmd, account, count ) 
     if cmd and account then 
            local money = tonumber( count ) 
            local acc = getAccount( account ) 
            setAccountData( acc, "accMoney", money ) 
     else return end 
end ) 
  
addEventHandler( "onPlayerLogin", root, 
function( acc ) 
      if acc then 
           local data = getAccountData( acc, "accMoney" ) 
      elseif data then 
           givePlayerMoney( source, tonumber( data ) ) 
     else return end 
end ) 
  

جرب كود سيرفر بس ماني مجربه

ماضبط

بس في ملاحظة

الحين

addCommandHandler

مو المفروض تكون تحت فنكشن

function( acc ) 

؟؟؟

Link to comment
القسم للمساعدة مو عشان نبرمج عنك

الحين انا قلت برمجولي ؟؟

انا قلت ابي كودددد او فنكشن :evil::evil:

getAccount -- تجيب الحساب من اسمه 
setAccountData -- تغير الأكاونت داتا 

:evil::evil::evil:

Link to comment

addCommandHandler ("giveMoney", function (plr, cmd, accName, money) 
  if (accName and money) then 
    local acc = getAccount (accName) 
     if (acc) then 
      setAccountData (acc, "MoneyData", tostring (money)) 
    else 
      outputChatBox ("There is no account with this name.", plr, 255, 0, 0) 
    end 
  else 
    outputChatBox ("Syntax: < Account Name > < Money >", plr, 255, 255, 0) 
   end 
 end 
) 
  
addEventHandler ("onPlayerLogin", root, function (_, acc) 
 if getAccountData (acc, "MoneyData") then 
   -- Your stuff  
 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...