xTravax Posted February 20, 2012 Share Posted February 20, 2012 Hey,i need script for automatically car colour set. I want that admins always get black car colour moderators get red colour super moderators get blue colour and members get yellow colour.i asked this because other server have that On race gamemode Link to comment
Moderators IIYAMA Posted February 20, 2012 Moderators Share Posted February 20, 2012 (edited) setTimer ( black, 2000, 1) --check timer > function black. function black (player) local account = getAccountName(getPlayerAccount(player)) --get account if isObjectInACLGroup("user." .. account, aclGetGroup("Admin")) then --check if it is admin local theVehicle = getPlayerOccupiedVehicle ( player ) -- get the vehicle if theVehicle then -- check if it does exist setVehicleColor ( theVehicle, 0, 0, 0, [0, 0, 0,] [0, 0, 0,] [0, 0, 0] ) --setcolor end end end I used the timer because in a race map, you wont enter your vehicle.. but you spawn with it. -- Maybe this... I can't test it right now (school)..... I hope it works. Edited February 20, 2012 by Guest Link to comment
HunT Posted February 20, 2012 Share Posted February 20, 2012 function setAdminColor (player) local theAccount=getPlayerAccount(player) if theAccount then local accountName = getAccountName(theAccount) if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then local vehicle = getPedOccupiedVehicle(player) setVehicleColor ( vehicle, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ) -- Black rgb rgb2 rgb3 rgb4 setVehicleOverrideLights(vehicle, 2) -- Light on setVehicleHeadLightColor(vehicle, 0, 0, 0, 0) -- u can set the color light r g b alpha else setVehicleColor ( vehicle, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ) -- Yellow Normaly Player end end end function spawnAdmin() setTimer(setAdminColor,500,1,source) end addEventHandler("onPlayerLogin",getRootElement(),spawnAdmin) addEventHandler("onPlayerSpawn",getRootElement(),spawnAdmin) This is for admin,u can edit this for supermod and mod. Link to comment
Moderators IIYAMA Posted February 20, 2012 Moderators Share Posted February 20, 2012 You can better try that one of Hunterix.. Because I am not sure about my script Link to comment
drk Posted February 21, 2012 Share Posted February 21, 2012 You can better try that one of Hunterix.. Because I am not sure about my script timers, event handlers and command handlers functions have to be after the function because the function not exists. Link to comment
Moderators IIYAMA Posted February 21, 2012 Moderators Share Posted February 21, 2012 ops lol forgotten Link to comment
drk Posted February 21, 2012 Share Posted February 21, 2012 ops lol forgotten No problem Only don't forget: Don't use event, command handlers and timer function names before you create the function or you will get error. And pls, start tabulating your code 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