Albinix Posted April 18, 2010 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.
Maccer. Posted April 18, 2010 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.
Albinix Posted April 18, 2010 Author Posted April 18, 2010 how to make it work for only one group? example admin
50p Posted April 18, 2010 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.
Albinix Posted April 19, 2010 Author 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.
DakiLLa Posted April 19, 2010 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
Albinix Posted April 19, 2010 Author Posted April 19, 2010 Dosen't work, when i login nothing happends
DakiLLa Posted April 19, 2010 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 ?
Albinix Posted April 19, 2010 Author 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.
dzek (varez) Posted April 19, 2010 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
50p Posted April 19, 2010 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.
Albinix Posted May 27, 2010 Author 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?
50p Posted May 27, 2010 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.
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