Guest Posted April 23, 2008 Share Posted April 23, 2008 (edited) With this scipt vehicles will be shown on ther radar and the map. -- needs configurable blip colors, and team support root = getRootElement () color = { 196, 196, 196 } vehicles = {196, 196, 196} resourceRoot = getResourceRootElement ( getThisResource () ) function onResourceStart ( resource ) for id, vehicle in ipairs( getElementsByType ( "vehicle" ) ) do if ( vehicles[vehicle] ) then createBlipAttachedTo ( vehicle, 0, 2, vehicles[source][1], vehicles[source][2], vehicles[source][3] ) else createBlipAttachedTo ( vehicle, 0, 2, color[1], color[2], color[3] ) end end end function onVehicleSpawn ( spawnpoint ) if ( vehicles[source] ) then createBlipAttachedTo ( source, 0, 2, vehicles[source][1], vehicles[source][2], vehicles[source][3] ) else createBlipAttachedTo ( source, 0, 2, color[1], color[2], color[3] ) end end function onVehicleDestroy () destroyBlipsAttachedTo ( source ) end function setBlipsColor ( source, commandName, r, g, b ) if ( tonumber ( b ) ) then color = { tonumber ( r ), tonumber ( g ), tonumber ( b ) } for id, vehicle in ipairs( getElementsByType ( "vehicle" ) ) do destroyBlipsAttachedTo ( vehicle ) if ( vehicles[vehicle] ) then createBlipAttachedTo ( vehicle, 0, 2, vehicles[source][1], vehicles[source][2], vehicles[source][3] ) else createBlipAttachedTo ( vehicle, 0, 2, color[1], color[2], color[3] ) end end end end function setBlipColor ( source, commandName, r, g, b ) if ( tonumber ( b ) ) then destroyBlipsAttachedTo ( source ) vehicles[source] = { tonumber ( r ), tonumber ( g ), tonumber ( b ) } createBlipAttachedTo ( source, 0, 2, vehicles[source][1], vehicles[source][2], vehicles[source][3] ) end end addCommandHandler ( "setblipscolor", setBlipsColor ) addCommandHandler ( "setblipcolor", setBlipColor ) addEventHandler ( "onResourceStart", resourceRoot, onResourceStart ) addEventHandler ( "onVehicleSpawn", root, onVehicleSpawn ) addEventHandler ( "onVehicleDestroy", root, onVehicleDestroy ) function destroyBlipsAttachedTo(vehicle) local attached = getAttachedElements ( vehicle ) if ( attached ) then for k,element in ipairs(attached) do if getElementType ( element ) == "blip" then destroyElement ( element ) end end end end save it as vehicleblips.lua and this save as meta.xml: <meta> <script src="vehicleblips.lua" type="server" /> </meta> Now make a zip-file that contains the vehicleblips.lua and the meta.xml in it with the name vehicleblips.zip. Edited April 23, 2008 by Guest Link to comment
eAi Posted April 23, 2008 Share Posted April 23, 2008 How about releasing it as a zipped resource on community.multitheftauto.com? Link to comment
tma Posted April 23, 2008 Share Posted April 23, 2008 How does this even work ? addEventHandler ( "onVehicleSpawn", root, onVehicleSpawn ) addEventHandler ( "onVehicleDstroy", root, onVehicleDestroy ) onVehicleSpawn() should be onVehicleRespawn() ? onVehicleDstroy() (sic) should be onVehicleExplode() ? Even then it won't catch all vehicle clearances - only those that explode. Link to comment
silent785 Posted April 30, 2008 Share Posted April 30, 2008 Isn't it the same script as this one: https://community.multitheftauto.com/index.php?p=resources&s=details&id=128 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