Jump to content

i Need help in this code


Recommended Posts

its just not working

server-side

addEventHandler ( "onPlayerLogin", root,
    function ( thePlayer )
     local accName = getAccountName ( getPlayerAccount ( thePlayer ) )
     if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Console" ) ) then
          setElementData( source, "cons", true)
      else
	     setElementData( source, "cons", false)
    end
	end
)

client-side

 function fly()
     if ( getElementData ( localPlayer, "cons") == true ) then
	     if isWorldSpecialPropertyEnabled("aircars") then
	     setWorldSpecialPropertyEnabled("aircars", false)
	     outputChatBox("its off !", 255, 0, 0)
	     else
	      setWorldSpecialPropertyEnabled("aircars", true)
	      outputChatBox("its on !", 0, 255, 0 ))
	     end
	elseif ( getElementData ( localPlayer, "cons") == false ) then
	outputChatBox("You are not a admin")
	end
end
addCommandHandler("flyy", fly )

errors :

server.lua:3: Bad arrgument @ getPlayerAccount  [expected element at argument 1, got account]

server.lua:3: Bad arrgument @ getAccountname  [expected element at argument 1, got boolean]

server.lua:4: attempt to concatenate local 'accName' (a boolean value) 

thanks .

 

 

Edited by JehadGh
Link to comment
  • Moderators

https://wiki.multitheftauto.com/wiki/OnPlayerLogin

Quote

Parameters


account thePreviousAccount, account theCurrentAccount
  • thePreviousAccount: the account the player was logged into before.
  • theCurrentAccount: the account the player logged into just now.

 

-- SERVER

addEventHandler ( "onPlayerLogin", root,
    function ( thePreviousAccount, theCurrentAccount )
     local accName = getAccountName ( theCurrentAccount )
     if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Console" ) ) then
          setElementData( source, "cons", true)
      else
	     setElementData( source, "cons", false)
    end
	end
)

 

Link to comment
2 hours ago, stPatrick said:

https://wiki.multitheftauto.com/wiki/OnPlayerLogin

 


-- SERVER

addEventHandler ( "onPlayerLogin", root,
    function ( thePreviousAccount, theCurrentAccount )
     local accName = getAccountName ( theCurrentAccount )
     if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Console" ) ) then
          setElementData( source, "cons", true)
      else
	     setElementData( source, "cons", false)
    end
	end
)

 

bro you are really kind , thanks alot bro

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