Monty Posted June 20, 2012 Share Posted June 20, 2012 why the console says bad argument? basegate = createObject ( 3115, 1728.8000488281, -1378.0999755859, 13.5, 0, 90, 0 ) basecol = createColCircle ( 1728.8000488281, -1378.0999755859, 13.5, 7 ) function openbase_area69gates ( thePlayer ) local gang = exports [ 'ROADgang' ]:getAccountGang ( getAccountName ( getPlayerAccount ( client ) ) ) --changed source to client (for safety reasons) if ( gang == "SWAT" ) then moveObject ( basegate, 5000, 1728.8000488281, -1378.0999755859, 0 ) end end addEventHandler ( "onColShapeHit", basecol, openbase_area69gates ) function closebase_area69gates(thePlayer) local gang = exports [ 'ROADgang' ]:getAccountGang ( getAccountName ( getPlayerAccount ( client ) ) ) --changed source to client (for safety reasons) if ( gang == "SWAT" ) then moveObject (basegate, 5000, 1728.8000488281, -1378.0999755859, 13.5 ) end end addEventHandler( "onColShapeLeave", basecol, closebase_area69gates ) Link to comment
Castillo Posted June 20, 2012 Share Posted June 20, 2012 That's because you're using "client" as player element, but your player element is: "thePlayer". Link to comment
Monty Posted June 20, 2012 Author Share Posted June 20, 2012 i tried with the player, it works, but the console always says bad argument Link to comment
Monty Posted June 20, 2012 Author Share Posted June 20, 2012 [2012-06-20 19:50:03] WARNING: ROADadmin\base_area69.lua:6: Bad argument @ 'getAccountName' [Expected account at argument 1, got boolean] [2012-06-20 19:50:08] WARNING: ROADadmin\base_area69.lua:15: Bad argument @ 'getAccountName' [Expected account at argument 1, got boolean] Link to comment
Anderl Posted June 20, 2012 Share Posted June 20, 2012 client is source, as far as I know. Source in those events is the marker, not the player element. Link to comment
Monty Posted June 21, 2012 Author Share Posted June 21, 2012 tried also with source, not working Link to comment
Anderl Posted June 21, 2012 Share Posted June 21, 2012 Source in those events is the marker, not the player element. Link to comment
Al3grab Posted June 21, 2012 Share Posted June 21, 2012 basegate = createObject ( 3115, 1728.8000488281, -1378.0999755859, 13.5, 0, 90, 0 ) basecol = createColCircle ( 1728.8000488281, -1378.0999755859, 13.5, 7 ) function openbase_area69gates ( thePlayer ) if not getElementType(thePlayer) == "player" then return end -- if the hit element isn't a player then cancel .. local acc = getPlayerAccount(thePlayer) -- get the player account if isGuestAccount(acc) then return end -- if it is a guest account then cancel local accName = getAccountName(acc) -- get the account name if not accName then return end -- if didn't got it then cancel local gang = exports [ 'ROADgang' ]:getAccountGang (accName) --changed source to client (for safety reasons) -- if ( gang and tostring(gang) == "SWAT" ) then moveObject ( basegate, 5000, 1728.8000488281, -1378.0999755859, 0 ) end end addEventHandler ( "onColShapeHit", basecol, openbase_area69gates ) function closebase_area69gates(thePlayer) if not getElementType(thePlayer) == "player" then return end -- if the hit element isn't a player then cancel .. local acc = getPlayerAccount(thePlayer) -- get the player account if isGuestAccount(acc) then return end -- if it is a guest account then cancel local accName = getAccountName(acc) -- get the account name if not accName then return end -- if didn't got it then cancel local gang = exports [ 'ROADgang' ]:getAccountGang (accName) --changed source to client (for safety reasons) -- if ( gang and tostring(gang) == "SWAT" ) then moveObject (basegate, 5000, 1728.8000488281, -1378.0999755859, 13.5 ) end end addEventHandler( "onColShapeLeave", basecol, closebase_area69gates ) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now