xXMADEXx Posted December 2, 2012 Share Posted December 2, 2012 Hey, i have a spawner script, and when the person spawns a car, i would like it to spawn in green. How would i do that: -- original server ship = createMarker( 2102.4775390625, -2956.5537109375, 16.2890625, "cylinder", 2, 0, 255, 0, 200 ) local vehicles = {} function spawnVeh4(id) local x, y, z = getElementPosition(source) local rx, ry, rz = getElementRotation(source) if isElement(vehicles[source]) then destroyElement(vehicles[source]) end vehicles[source] = createVehicle(id, 2112.7265625,-2939.427734375,18,0,0,90) end addEvent("CreVehice3",true) addEventHandler("CreVehice3", root, spawnVeh4) addEventHandler("onPlayerQuit", root, function () if isElement(vehicles[source]) then destroyElement(vehicles[source]) vehicles[source] = nil end end) function showGUI3(hitPlayer) local name = getTeamName(getPlayerTeam(hitPlayer)) if (not isPedInVehicle(hitPlayer)) then if ( name == "Military" ) or ( name == "Staff" ) then triggerClientEvent (hitPlayer,"showGUI3",getRootElement(),hitPlayer) end end end addEventHandler("onMarkerHit",ship,showGUI3) -- modified script server -- ship = createMarker( 2102.4775390625, -2956.5537109375, 16.2890625, "cylinder", 2, 0, 255, 0, 200 ) local vehicles = {} function spawnVeh4(id) local x, y, z = getElementPosition(source) local rx, ry, rz = getElementRotation(source) if isElement(vehicles[source]) then destroyElement(vehicles[source]) end vehicles[source] = createVehicle(id, 2112.7265625,-2939.427734375,18,0,0,90) vehicles[source] = setVehicleColor( id, x, y, z, rx, ry, rz, 0, 255, 0 ) end addEvent("CreVehice3",true) addEventHandler("CreVehice3", root, spawnVeh4) addEventHandler("onPlayerQuit", root, function () if isElement(vehicles[source]) then destroyElement(vehicles[source]) vehicles[source] = nil end end) function showGUI3(hitPlayer) local name = getTeamName(getPlayerTeam(hitPlayer)) if (not isPedInVehicle(hitPlayer)) then if ( name == "Military" ) or ( name == "Staff" ) then triggerClientEvent (hitPlayer,"showGUI3",getRootElement(),hitPlayer) end end end addEventHandler("onMarkerHit",ship,showGUI3) Link to comment
Renkon Posted December 2, 2012 Share Posted December 2, 2012 ship = createMarker( 2102.4775390625, -2956.5537109375, 16.2890625, "cylinder", 2, 0, 255, 0, 200 ) local vehicles = {} function spawnVeh4(id) local x, y, z = getElementPosition(source) local rx, ry, rz = getElementRotation(source) if isElement(vehicles[source]) then destroyElement(vehicles[source]) end vehicles[source] = createVehicle(id, 2112.7265625,-2939.427734375,18,0,0,90) setVehicleColor(vehicles[source], 0, 255, 0) end addEvent("CreVehice3",true) addEventHandler("CreVehice3", root, spawnVeh4) addEventHandler("onPlayerQuit", root, function () if isElement(vehicles[source]) then destroyElement(vehicles[source]) vehicles[source] = nil end end) function showGUI3(hitPlayer) local name = getTeamName(getPlayerTeam(hitPlayer)) if (not isPedInVehicle(hitPlayer)) then if ( name == "Military" ) or ( name == "Staff" ) then triggerClientEvent (hitPlayer,"showGUI3",getRootElement(),hitPlayer) end end end addEventHandler("onMarkerHit",ship,showGUI3) Link to comment
xXMADEXx Posted December 2, 2012 Author Share Posted December 2, 2012 ship = createMarker( 2102.4775390625, -2956.5537109375, 16.2890625, "cylinder", 2, 0, 255, 0, 200 ) local vehicles = {} function spawnVeh4(id) local x, y, z = getElementPosition(source) local rx, ry, rz = getElementRotation(source) if isElement(vehicles[source]) then destroyElement(vehicles[source]) end vehicles[source] = createVehicle(id, 2112.7265625,-2939.427734375,18,0,0,90) setVehicleColor(vehicles[source], 0, 255, 0) end addEvent("CreVehice3",true) addEventHandler("CreVehice3", root, spawnVeh4) addEventHandler("onPlayerQuit", root, function () if isElement(vehicles[source]) then destroyElement(vehicles[source]) vehicles[source] = nil end end) function showGUI3(hitPlayer) local name = getTeamName(getPlayerTeam(hitPlayer)) if (not isPedInVehicle(hitPlayer)) then if ( name == "Military" ) or ( name == "Staff" ) then triggerClientEvent (hitPlayer,"showGUI3",getRootElement(),hitPlayer) end end end addEventHandler("onMarkerHit",ship,showGUI3) Thanks 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