Albinix Posted April 18, 2010 Share Posted April 18, 2010 Hello i wonder how to make this script work for only admins? And how to add Headlightcolor to this script? function randomVehColors() for i, car in ipairs( getElementsByType( "vehicle" ) ) do local color = {} color[1] = math.random(0,126) -- random from 0 to 126, because colors is from 0 to 126 color[2] = math.random(0,126) color[3] = math.random(0,126) color[4] = math.random(0,126) -- we take 4 random numbers because setVehicleColor have parameters with 4 colors setVehicleColor ( car, color[1], color[2], color[3], color[4] ) -- setting color to vehicle end end setTimer( randomVehColors, 500, 0 ) -- timer changes all vehicles colors to random every 0.5 sec. Link to comment
Maccer. Posted April 18, 2010 Share Posted April 18, 2010 First of all, you didn't need to create these extra variables. You can just simplify things by doing function randomVehColors() for i, car in ipairs( getElementsByType( "vehicle" ) ) do setVehicleColor ( car, math.random(0,126), math.random(0,126), math.random(0,126), math.random(0,126) ) -- setting color to vehicle end end setTimer( randomVehColors, 500, 0 ) -- timer changes all vehicles colors to random every 0.5 sec. I hope this is a client-side script. It should be straight forward on how to create headlight colors. Only headlights only take 3 params, and they range from 0-255, RGB. https://wiki.multitheftauto.com/wiki/Set ... LightColor The MTA wiki pwns. Link to comment
Albinix Posted April 18, 2010 Author Share Posted April 18, 2010 how to make it work for only one group? example admin Link to comment
50p Posted April 18, 2010 Share Posted April 18, 2010 how to make it work for only one group? example admin I don't know what you mean by that question.. The script changes headlight colours randomly. Link to comment
Albinix Posted April 19, 2010 Author Share Posted April 19, 2010 how to make it work for only one group? example admin I don't know what you mean by that question.. The script changes headlight colours randomly. like when a admin login it changes his car color to black for example, but when someone else login it dosen't changes his car to black. Link to comment
DakiLLa Posted April 19, 2010 Share Posted April 19, 2010 (edited) how to make it work for only one group? example admin I don't know what you mean by that question.. The script changes headlight colours randomly. like when a admin login it changes his car color to black for example, but when someone else login it dosen't changes his car to black. eh, something like addEventHandler( 'onPlayerLogin', root, function() local veh = getPedOccupiedVehicle( source ); if veh and isObjectInACLGroup( 'user.'..getPlayerName( source ), aclGetGroup( 'Admin' ) ) then setVehicleColor( veh, 0, 0, 0, 0 ); --color it with black end; end ); Edited April 19, 2010 by Guest Link to comment
Albinix Posted April 19, 2010 Author Share Posted April 19, 2010 Dosen't work, when i login nothing happends Link to comment
DakiLLa Posted April 19, 2010 Share Posted April 19, 2010 Dosen't work, when i login nothing happends Hmm, you must be in a car while login. Or you wanna change color of all existing vehicles on the server ? Link to comment
Albinix Posted April 19, 2010 Author Share Posted April 19, 2010 Dosen't work, when i login nothing happends Hmm, you must be in a car while login. Or you wanna change color of all existing vehicles on the server ? No when i login as admin i want my car black. And it's on a racemod server so i always in a car. Link to comment
dzek (varez) Posted April 19, 2010 Share Posted April 19, 2010 No when i login as admin i want my car black. And it's on a racemod server so i always in a car. the best thing is that after you hit the car change pickup it will change your color to random anyway Link to comment
50p Posted April 19, 2010 Share Posted April 19, 2010 No when i login as admin i want my car black. And it's on a racemod server so i always in a car. the best thing is that after you hit the car change pickup it will change your color to random anyway There is an event (onPlayerPickUpRacePickup) to prevent it from happening. Link to comment
Albinix Posted May 27, 2010 Author Share Posted May 27, 2010 can u make like if you have two teams like red and green, if you are in red your car is red ans if you is in green your car is green? Link to comment
50p Posted May 27, 2010 Share Posted May 27, 2010 Yes, you can. You just check what team the player is in when he enters the vehicle and change the colour to whatever team colour is. 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