Sign in to follow this  
JehadGh

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

Share this post


Link to post

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
)

 

Share this post


Link to post
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

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.