manve1 Posted December 5, 2012 Share Posted December 5, 2012 I just want this script to be fixed, i can't figure out how to fix it my self, so i though i would come here for help: addEventHandler('onPlayerLogin', getRootElement(), function( ) if isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(source)), aclGetGroup ("Admin")) then addCommandHandler( 'fixall', function() fixVehicle ( getElementsByType('vehicle') ) outputChatBox( '#FF0000[iNFO]: #FFFFFFAll vehicles were repaired by admin [ '.. getPlayerName( getRootElement() ) ..' ]', root, 255, 255, 255, true ) end ) end end ) Link to comment
Castillo Posted December 5, 2012 Share Posted December 5, 2012 addCommandHandler ( 'fixall', function ( thePlayer ) if isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( thePlayer ) ), aclGetGroup ( "Admin" ) ) then for _, vehicle in ipairs ( getElementsByType ( 'vehicle' ) ) do fixVehicle ( vehicle ) end outputChatBox ( '#FF0000[iNFO]: #FFFFFFAll vehicles were repaired by admin [ '.. getPlayerName ( thePlayer ) ..' ]', root, 255, 255, 255, true ) end end ) Errors: 1: Server side commands are created for everyone, you don't need to create it on login. 2: getElementsByType returns a table, not an element. 3: getRootElement is not the player who used the command. 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