maky55 Posted February 11, 2013 Share Posted February 11, 2013 I have made a script to respawn Vehicles and I wanted to output a message to the chatbox that states the players name, is this possible? Here is the script (server side): function respawn() local accountname = getAccountName (getPlayerAccount(source)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then outputChatBox("") setTimer(function () local vehicles = getElementsByType ( "vehicle" ) for k, vehicle in ipairs ( vehicles ) do if checkEmpty( vehicle ) then local seats = getVehicleMaxPassengers(vehicle) resetVehicleIdleTime ( vehicle ) respawnVehicle ( vehicle ) end end end, 10000, 1) end end addEvent( "respawn", true ) addEventHandler( "respawn", getRootElement(), respawn ) function checkEmpty( vehicle ) local passengers = getVehicleMaxPassengers( vehicle ) if type( passengers ) == 'number' then for seat = 0, passengers do if getVehicleOccupant( vehicle, seat ) then return false end end end return true end Thanks Link to comment
Castillo Posted February 11, 2013 Share Posted February 11, 2013 function respawn ( ) local accountname = getAccountName ( getPlayerAccount ( client ) ) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then outputChatBox ( "" ) setTimer ( function ( ) for _, vehicle in ipairs ( getElementsByType ( "vehicle" ) ) do if checkEmpty ( vehicle ) then local seats = getVehicleMaxPassengers ( vehicle ) resetVehicleIdleTime ( vehicle ) respawnVehicle ( vehicle ) end end end , 10000, 1 ) outputChatBox ( getPlayerName ( client ) .." has respawned all empty vehicles.", root, 255, 50, 0 ) end end addEvent ( "respawn", true ) addEventHandler ( "respawn", getRootElement(), respawn ) function checkEmpty ( vehicle ) local passengers = getVehicleMaxPassengers ( vehicle ) if ( type ( passengers ) == 'number' ) then for seat = 0, passengers do if getVehicleOccupant ( vehicle, seat ) then return false end end end return true end 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