Jump to content

Script Problem


SteeLRO

Recommended Posts

hi all

i need some help with my script

Warning : "Bad argument @ setAccountData [ Expected account at argument 1, got boolean]"

lua code:

function licenta () 
  local playeraccount = getPlayerAccount ( source ) 
  setAccountData ( playeraccount, "Licenta", "licentiat" ) 
   
 takePlayerMoney ( source, 500)  
  
end 
addEvent( "onBuy", true ) 
addEventHandler( "onBuy", resourceRoot, licenta ) 

meta code:


Link to comment

Always make sure you optimize your code.

  
local function licenta (p) 
  
  local playeraccount = getPlayerAccount ( p ) 
  
  setAccountData ( playeraccount, "Licenta", "licentiat" ) 
  
 takePlayerMoney ( p, 500)  
  
end 
  
addEvent( "onBuy", true ) 
  
addEventHandler( "onBuy", resourceRoot, licenta ) 

  
  
local function trigger (b,s) 
if b == "left" and s == "up" then -- if you don't add this then triggerServerEvent will be called 2 times 
  
  triggerServerEvent ( "onBuy", resourceRoot, localPlayer ) 
end 
end 
  
addEventHandler ( "onClientGUIClick", buybtn, trigger, false ) 
  

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...