Jump to content

meh

Members
  • Posts

    125
  • Joined

  • Last visited

Everything posted by meh

  1. like this? it doesn't work. -- Simple Police-Lights by MuLTi! p_lights = {} p_timer = {} p_lvar = {} p_pvar = {} p_lvar2 = {} p_lvar3 = {} p_lvar4 = {} function toggleLights(thePlayer, cmd, level) local level = tonumber(level) if not(level) then outputChatBox("#FF0000 Please select a level![1-2]", thePlayer, 255, 255, 255, true) return end if(level < 1) or (level > 2) then outputChatBox("#FF0000 Please select a level between 1-2!", thePlayer, 255, 255, 255, true) return end local veh = getPedOccupiedVehicle(thePlayer) local id = getElementModel(veh) local tVehicles = { [ 598 ] = true; [ 596 ] = true; [ 597 ] = true; [ 411 ] = true; [ 599 ] = true; } if ( tVehicles [ getPedOccupiedVehicle ( thePlayer ) ] ) then -- something here end if ( tVehicles [ getPedOccupiedVehicle ( thePlayer ) ] ) then if(level == 1) then if(p_lights[veh] == 0) or(p_lights[veh] == nil) then p_pvar[veh] = 1 p_lights[veh] = 1 outputChatBox("#FFFFFFYour Police-lights has been #00FF00enabled.", thePlayer, 0, 200, 100, true) setVehicleOverrideLights ( veh, 2 ) p_timer[veh] = setTimer( function() if(p_lvar[veh] == 0) or (p_lvar[veh] == nil) then p_lvar[veh] = 1 setVehicleLightState ( veh, 1, 0) setVehicleLightState ( veh, 2, 0) setVehicleLightState ( veh, 0, 1) setVehicleLightState ( veh, 3, 1) setVehicleHeadLightColor(veh, 0, 0, 255) else setVehicleLightState ( veh, 3, 0) setVehicleLightState ( veh, 0, 0) setVehicleLightState ( veh, 1, 1) setVehicleLightState ( veh, 2, 1) setVehicleHeadLightColor(veh, 255, 0, 0) p_lvar[veh] = 0 end end, 500, 0) else p_lights[veh] = 0 outputChatBox("#FFFFFFYour Police-lights has been #00FF00disabled.", thePlayer, 0, 200, 100, true) killTimer(p_timer[veh]) setVehicleLightState ( veh, 0, 0) setVehicleLightState ( veh, 1, 0) setVehicleLightState ( veh, 2, 0) setVehicleLightState ( veh, 3, 0) setVehicleHeadLightColor(veh, 255, 255, 255) setVehicleOverrideLights ( veh, 1 ) end elseif(level == 2) then if(p_lights[veh] == 0) or(p_lights[veh] == nil) then p_lights[veh] = 1 outputChatBox("#FFFFFFYour Police-lights has been #00FF00enabled.", thePlayer, 0, 200, 100, true) setVehicleOverrideLights ( veh, 2 ) p_timer[veh] = setTimer( function() if(p_lvar3[veh] == 4) then setTimer(function() p_lvar3[veh] = 0 end, 1000, 1) setTimer( function() if(p_lvar4[veh] == 1)then p_lvar4[veh] = 0 -- 0 = vorne links 1 = vorne rechts 2 = hinten links 3 = hinten rechts setVehicleLightState ( veh, 1, 0) setVehicleLightState ( veh, 2, 0) setVehicleLightState ( veh, 0, 1) setVehicleLightState ( veh, 3, 1) setVehicleHeadLightColor(veh, 77, 77, 255) else setVehicleLightState ( veh, 3, 0) ш setVehicleLightState ( veh, 0, 0) setVehicleLightState ( veh, 1, 1) setVehicleLightState ( veh, 2, 1) setVehicleHeadLightColor(veh, 255, 77, 77) p_lvar4[veh] = 1 end end, 50, 5) return end if(p_lvar2[veh] == 0) or (p_lvar2[veh] == nil) then p_lvar2[veh] = 1 -- 0 = vorne links 1 = vorne rechts 2 = hinten links 3 = hinten rechts setVehicleLightState ( veh, 1, 0) setVehicleLightState ( veh, 2, 0) setVehicleLightState ( veh, 0, 1) setVehicleLightState ( veh, 3, 1) setVehicleHeadLightColor(veh, 0, 0, 255) else setVehicleLightState ( veh, 3, 0) setVehicleLightState ( veh, 0, 0) setVehicleLightState ( veh, 1, 1) setVehicleLightState ( veh, 2, 1) setVehicleHeadLightColor(veh, 255, 0, 0) p_lvar2[veh] = 0 end if(p_lvar3[veh] == nil) then p_lvar3[veh] = 0 end p_lvar3[veh] = (p_lvar3[veh]+1) end, 500, 0) else p_lights[veh] = 0 outputChatBox("#FFFFFFYour Police-lights has been #00FF00disabled.", thePlayer, 0, 200, 100, true) killTimer(p_timer[veh]) setVehicleLightState ( veh, 0, 0) setVehicleLightState ( veh, 1, 0) setVehicleLightState ( veh, 2, 0) setVehicleLightState ( veh, 3, 0) setVehicleHeadLightColor(veh, 255, 255, 255) setVehicleOverrideLights ( veh, 1 ) end end end end addCommandHandler("lights", toggleLights) addEventHandler ( "onVehicleExplode", getRootElement(), function() if(p_lights[source] == 1) then killTimer(p_timer[source]) end end ) addEventHandler ( "onVehicleRespawn", getRootElement(), function() if(p_lights[source] == 1) then killTimer(p_timer[source]) end end ) addEventHandler("onElementDestroy", getRootElement(), function () if getElementType(source) == "vehicle" then if(p_lights[source] == 1) then killTimer(p_timer[source]) end end end)
  2. ye, when i copypasted seb's code it worked, really wierd. also: local tVehicles = { [ 598 ] = true; [ 596 ] = true; [ 597 ] = true; [ 411 ] = true; [ 599 ] = true; } i gotta paste to line 18-19, i guess?
  3. line 19 is the line that i quoted in my post. i've tried to chage it and i tired to add additional ids, but all was in vain. it didn't work. what do u mean lua tags?
  4. hello. today's resource is: https://community.multitheftauto.com/index.php?p= ... ls&id=3475 basically, what it does it makes a vehicle headlights look like this: well, this is not actually how this mod makes a vehicle headlights look like, but i hope you got the idea. and now let's talk about what i want to (with your help) improve in this script. as for now, it only works with some police vehicles, but after some experiments i found out that it's possible to make this script work with all other vehicles, but to do so, u gotta give urself a police vehicle, type /lights 1-2 and after that u can give urself any other vehicle (like infernus) and the script will still work. as you understand that's the really hard way to make this script do what i want. so, i wanna improve it. if i got it right, then this line's responsible for the vehicles with which this script works: local id = getElementModel(veh) if (id == 598) or (id == 596) or (id == 597) or (id == 599) then but, when i add another vehicle's id (like (id == 411) nothin really happens. why? here's the script's code itself: -- Simple Police-Lights by MuLTi! p_lights = {} p_timer = {} p_lvar = {} p_pvar = {} p_lvar2 = {} p_lvar3 = {} p_lvar4 = {} function toggleLights(thePlayer, cmd, level) local level = tonumber(level) if not(level) then outputChatBox("#FF0000 Please select a level![1-2]", thePlayer, 255, 255, 255, true) return end if(level < 1) or (level > 2) then outputChatBox("#FF0000 Please select a level between 1-2!", thePlayer, 255, 255, 255, true) return end local veh = getPedOccupiedVehicle(thePlayer) local id = getElementModel(veh) if (id == 598) or (id == 596) or (id == 597) or (id == 599) then if(level == 1) then if(p_lights[veh] == 0) or(p_lights[veh] == nil) then p_pvar[veh] = 1 p_lights[veh] = 1 outputChatBox("#FFFFFFYour Police-lights has been #00FF00enabled.", thePlayer, 0, 200, 100, true) setVehicleOverrideLights ( veh, 2 ) p_timer[veh] = setTimer( function() if(p_lvar[veh] == 0) or (p_lvar[veh] == nil) then p_lvar[veh] = 1 setVehicleLightState ( veh, 1, 0) setVehicleLightState ( veh, 2, 0) setVehicleLightState ( veh, 0, 1) setVehicleLightState ( veh, 3, 1) setVehicleHeadLightColor(veh, 0, 0, 255) else setVehicleLightState ( veh, 3, 0) setVehicleLightState ( veh, 0, 0) setVehicleLightState ( veh, 1, 1) setVehicleLightState ( veh, 2, 1) setVehicleHeadLightColor(veh, 255, 0, 0) p_lvar[veh] = 0 end end, 500, 0) else p_lights[veh] = 0 outputChatBox("#FFFFFFYour Police-lights has been #00FF00disabled.", thePlayer, 0, 200, 100, true) killTimer(p_timer[veh]) setVehicleLightState ( veh, 0, 0) setVehicleLightState ( veh, 1, 0) setVehicleLightState ( veh, 2, 0) setVehicleLightState ( veh, 3, 0) setVehicleHeadLightColor(veh, 255, 255, 255) setVehicleOverrideLights ( veh, 1 ) end elseif(level == 2) then if(p_lights[veh] == 0) or(p_lights[veh] == nil) then p_lights[veh] = 1 outputChatBox("#FFFFFFYour Police-lights has been #00FF00enabled.", thePlayer, 0, 200, 100, true) setVehicleOverrideLights ( veh, 2 ) p_timer[veh] = setTimer( function() if(p_lvar3[veh] == 4) then setTimer(function() p_lvar3[veh] = 0 end, 1000, 1) setTimer( function() if(p_lvar4[veh] == 1)then p_lvar4[veh] = 0 -- 0 = vorne links 1 = vorne rechts 2 = hinten links 3 = hinten rechts setVehicleLightState ( veh, 1, 0) setVehicleLightState ( veh, 2, 0) setVehicleLightState ( veh, 0, 1) setVehicleLightState ( veh, 3, 1) setVehicleHeadLightColor(veh, 77, 77, 255) else setVehicleLightState ( veh, 3, 0) ш setVehicleLightState ( veh, 0, 0) setVehicleLightState ( veh, 1, 1) setVehicleLightState ( veh, 2, 1) setVehicleHeadLightColor(veh, 255, 77, 77) p_lvar4[veh] = 1 end end, 50, 5) return end if(p_lvar2[veh] == 0) or (p_lvar2[veh] == nil) then p_lvar2[veh] = 1 -- 0 = vorne links 1 = vorne rechts 2 = hinten links 3 = hinten rechts setVehicleLightState ( veh, 1, 0) setVehicleLightState ( veh, 2, 0) setVehicleLightState ( veh, 0, 1) setVehicleLightState ( veh, 3, 1) setVehicleHeadLightColor(veh, 0, 0, 255) else setVehicleLightState ( veh, 3, 0) setVehicleLightState ( veh, 0, 0) setVehicleLightState ( veh, 1, 1) setVehicleLightState ( veh, 2, 1) setVehicleHeadLightColor(veh, 255, 0, 0) p_lvar2[veh] = 0 end if(p_lvar3[veh] == nil) then p_lvar3[veh] = 0 end p_lvar3[veh] = (p_lvar3[veh]+1) end, 500, 0) else p_lights[veh] = 0 outputChatBox("#FFFFFFYour Police-lights has been #00FF00disabled.", thePlayer, 0, 200, 100, true) killTimer(p_timer[veh]) setVehicleLightState ( veh, 0, 0) setVehicleLightState ( veh, 1, 0) setVehicleLightState ( veh, 2, 0) setVehicleLightState ( veh, 3, 0) setVehicleHeadLightColor(veh, 255, 255, 255) setVehicleOverrideLights ( veh, 1 ) end end end end addCommandHandler("lights", toggleLights) addEventHandler ( "onVehicleExplode", getRootElement(), function() if(p_lights[source] == 1) then killTimer(p_timer[source]) end end ) addEventHandler ( "onVehicleRespawn", getRootElement(), function() if(p_lights[source] == 1) then killTimer(p_timer[source]) end end ) addEventHandler("onElementDestroy", getRootElement(), function () if getElementType(source) == "vehicle" then if(p_lights[source] == 1) then killTimer(p_timer[source]) end end end)
  5. meh

    carfade issue

    thanx again, ur a magician
  6. need more key words. you're right on the fact that a lot of servers has this thingy, so it mustn't be this hard to find. but i need to now what do i search.
  7. sorry, this doesn't help at all. half of the race resources have this feature.
  8. well, that's pretty self explanatory. what's the name of resourse or command or whatever: and a bigger picture: http://imageshack.us/photo/my-images/593/54478651.png/ (it's in the bottom right corner)
  9. vortex will probably sue you.
  10. meh

    editing acl

    thanx! that works! only 1 more thing to solve: it's still possible "to start gamemode with map", even though i didn't add this right. how to remove it?
  11. solved. for more info: viewtopic.php?f=91&t=36744&p=398130&hilit=countdown#p398130 a big thanx goes to solidsnake.
  12. meh

    Nametag script

    and how you did it? i want to do it too.
  13. meh

    editing acl

    oh hai. today i've got a question about editing acl file in the admin resource. what i want to do with is to create a new "subadmin" group that only has rights to kick/mute/unmute/set a new map and press b(i guess it's called spectate), and i almost succeeded at it, but ran into an unexpected problem. again. the problem is that B doesn't work for this group, even though i did give it right "command.spectate" and also it's impossible to set a new map (technically it's possible but one has to use "start gamemode with map", but this is not what i want this group to be able to) altough i added right "command.setmap: for this group also. so guys, what do i do? how do i fix this issues?
  14. meh

    carfade issue

    problem solved. you rock, arezu. hey, while you sill here, maybe you can tell me how to lower position of that "press space to respawn" inscription in you training script? currently it's almost at the middle of screen and it's kinda uncomfortable for those who just wanna watch the game. hey, and a big thank you to those who participated in this discussion. your participation is much appreciated.
  15. meh

    carfade issue

    and what about smoke or fumes or whatever it's called?
  16. meh

    carfade issue

    lol, forget what has been said, i managed to get rid of nicknames. but still, vehicles headlights and smoke from pipes are still visible. what do i do? current settings of the script: local MAX_DIST = 500 local MIN_DIST = 0 local MIN_ALPHA = 0 local carfade = true addEventHandler("onClientRender", getRootElement(), function() local camTarget = getCameraTarget() local tarVehicle = false if(camTarget == false)then return end if(getElementType(camTarget) == "vehicle")then tarVehicle = camTarget elseif(getElementType(camTarget) == "player")then tarVehicle = getPedOccupiedVehicle(camTarget) end if (camTarget == false or tarVehicle == false)then return end local posX, posY, posZ = getElementPosition(tarVehicle) local camX, camY, camZ = getCameraMatrix() local player = getElementsByType("player") for i = 1, #player do local vehicle = getPedOccupiedVehicle(player[i]) if(vehicle ~= tarVehicle and vehicle ~= false)then local alpha = 255 local x, y, z = getElementPosition(vehicle) local playerDist = getDistanceBetweenPoints3D(posX, posY, posZ, x, y, z) local camDist = getDistanceBetweenPoints3D(camX, camY, camZ, x, y, z) -- If distance is more or less than maximum and minimum values, then set alpha to minimum alpha. if(playerDist <= MIN_DIST or camDist <= MIN_DIST)then alpha = MIN_ALPHA end local alpha_dist = (playerDist/MAX_DIST) if(alpha_dist >= 0)then alpha = alpha_dist * 255 if(alpha > 255)then alpha = 0 end if(alpha < MIN_ALPHA)then alpha = MIN_ALPHA end end if(carfade == false)then alpha = 255 end local state = getElementData(player[i], "state") or false if(state == "dead" or state == "not ready")then alpha = 0 end setElementAlpha(vehicle, alpha) setElementAlpha(player[i], alpha) end if(vehicle == tarVehicle and vehicle ~= false)then setElementAlpha(vehicle, 255) setElementAlpha(player[i], 255) end end end) bindKey("F1", "up", function() carfade = (not carfade) if(carfade)then outputChatBox("#FFFFFF[ENABLE]#FF5500Carfade is now #00FF00enabled#FF5500!", 255, 128, 0, true) else outputChatBox("#FFFFFF[DISABLE]#FF5500Carfade is now #FF0000disabled#FF5500!", 255, 128, 0, true) end end)
  17. meh

    carfade issue

    i need to add this code the carfade or to the racenametags.lua?
  18. meh

    carfade issue

    found it! so, what do i do? i gotta link this resource with carfade or what? nametag = {} local nametags = {} local g_screenX,g_screenY = guiGetScreenSize() local bHideNametags = false local NAMETAG_SCALE = 0.3 --Overall adjustment of the nametag, use this to resize but constrain proportions local NAMETAG_ALPHA_DISTANCE = 50 --Distance to start fading out local NAMETAG_DISTANCE = 120 --Distance until we're gone local NAMETAG_ALPHA = 120 --The overall alpha level of the nametag --The following arent actual pixel measurements, they're just proportional constraints local NAMETAG_TEXT_BAR_SPACE = 2 local NAMETAG_WIDTH = 50 local NAMETAG_HEIGHT = 5 local NAMETAG_TEXTSIZE = 0.7 local NAMETAG_OUTLINE_THICKNESS = 1.2 -- local NAMETAG_ALPHA_DIFF = NAMETAG_DISTANCE - NAMETAG_ALPHA_DISTANCE NAMETAG_SCALE = 1/NAMETAG_SCALE * 800 / g_screenY -- Ensure the name tag doesn't get too big local maxScaleCurve = { {0, 0}, {3, 3}, {13, 5} } -- Ensure the text doesn't get too small/unreadable local textScaleCurve = { {0, 0.8}, {0.8, 1.2}, {99, 99} } -- Make the text a bit brighter and fade more gradually local textAlphaCurve = { {0, 0}, {25, 100}, {120, 190}, {255, 190} } function nametag.create ( player ) nametags[player] = true end function nametag.destroy ( player ) nametags[player] = nil end addEventHandler ( "onClientRender", g_Root, function() -- Hideous quick fix -- for i,player in ipairs(g_Players) do if player ~= g_Me then setPlayerNametagShowing ( player, false ) if not nametags[player] then nametag.create ( player ) end end end if bHideNametags then return end local x,y,z = getCameraMatrix() for player in pairs(nametags) do while true do if not isPedInVehicle(player) or isPlayerDead(player) then break end local vehicle = getPedOccupiedVehicle(player) local px,py,pz = getElementPosition ( vehicle ) local pdistance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz ) if pdistance <= NAMETAG_DISTANCE then --Get screenposition local sx,sy = getScreenFromWorldPosition ( px, py, pz+0.95, 0.06 ) if not sx or not sy then break end --Calculate our components local scale = 1/(NAMETAG_SCALE * (pdistance / NAMETAG_DISTANCE)) local alpha = ((pdistance - NAMETAG_ALPHA_DISTANCE) / NAMETAG_ALPHA_DIFF) alpha = (alpha < 0) and NAMETAG_ALPHA or NAMETAG_ALPHA-(alpha*NAMETAG_ALPHA) scale = math.evalCurve(maxScaleCurve,scale) local textscale = math.evalCurve(textScaleCurve,scale) local textalpha = math.evalCurve(textAlphaCurve,alpha) local outlineThickness = NAMETAG_OUTLINE_THICKNESS*(scale) --Draw our text local r,g,b = 255,255,255 local team = getPlayerTeam(player) if team then r,g,b = getTeamColor(team) end local offset = (scale) * NAMETAG_TEXT_BAR_SPACE/2 dxDrawText ( getPlayerName(player), sx, sy - offset, sx, sy - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE, "default", "center", "bottom", false, false, false ) --We draw three parts to make the healthbar. First the outline/background local drawX = sx - NAMETAG_WIDTH*scale/2 drawY = sy + offset local width,height = NAMETAG_WIDTH*scale, NAMETAG_HEIGHT*scale dxDrawRectangle ( drawX, drawY, width, height, tocolor(0,0,0,alpha) ) --Next the inner background local health = getElementHealth(vehicle) health = math.max(health - 250, 0)/750 local p = -510*(health^2) local r,g = math.max(math.min(p + 255*health + 255, 255), 0), math.max(math.min(p + 765*health, 255), 0) dxDrawRectangle ( drawX + outlineThickness, drawY + outlineThickness, width - outlineThickness*2, height - outlineThickness*2, tocolor(r,g,0,0.4*alpha) ) --Finally, the actual health dxDrawRectangle ( drawX + outlineThickness, drawY + outlineThickness, health*(width - outlineThickness*2), height - outlineThickness*2, tocolor(r,g,0,alpha) ) end break end end end ) ---------------THE FOLLOWING IS THE MANAGEMENT OF NAMETAGS----------------- addEventHandler('onClientResourceStart', g_ResRoot, function() for i,player in ipairs(getElementsByType"player") do if player ~= g_Me then nametag.create ( player ) end end end ) addEventHandler ( "onClientPlayerJoin", g_Root, function() if source == g_Me then return end setPlayerNametagShowing ( source, false ) nametag.create ( source ) end ) addEventHandler ( "onClientPlayerQuit", g_Root, function() nametag.destroy ( source ) end ) addEvent ( "onClientScreenFadedOut", true ) addEventHandler ( "onClientScreenFadedOut", g_Root, function() bHideNametags = true end ) addEvent ( "onClientScreenFadedIn", true ) addEventHandler ( "onClientScreenFadedIn", g_Root, function() bHideNametags = false end )
  19. meh

    carfade issue

    hm, this doesn't seem to work. any idead why? local MAX_DIST = 0 local MIN_DIST = 0 local MIN_ALPHA = 0 local carfade = true addEventHandler("onClientRender", getRootElement(), function() local camTarget = getCameraTarget() local tarVehicle = false if(camTarget == false)then return end if(getElementType(camTarget) == "vehicle")then tarVehicle = camTarget elseif(getElementType(camTarget) == "player")then tarVehicle = getPedOccupiedVehicle(camTarget) end if (camTarget == false or tarVehicle == false)then return end local posX, posY, posZ = getElementPosition(tarVehicle) local camX, camY, camZ = getCameraMatrix() local player = getElementsByType("player") for i = 1, #player do local vehicle = getPedOccupiedVehicle(player[i]) if(vehicle ~= tarVehicle and vehicle ~= false)then local alpha = 255 local x, y, z = getElementPosition(vehicle) local playerDist = getDistanceBetweenPoints3D(posX, posY, posZ, x, y, z) local camDist = getDistanceBetweenPoints3D(camX, camY, camZ, x, y, z) -- If distance is more or less than maximum and minimum values, then set alpha to minimum alpha. if(playerDist <= MIN_DIST or camDist <= MIN_DIST)then alpha = MIN_ALPHA end local alpha_dist = (playerDist/MAX_DIST) if(alpha_dist >= 0)then alpha = alpha_dist * 255 if(alpha > 255)then alpha = 255 end if(alpha < MIN_ALPHA)then alpha = MIN_ALPHA end end if(carfade == false)then alpha = 255 end local state = getElementData(player[i], "state") or false if(state == "dead" or state == "not ready")then alpha = 0 end setElementAlpha(vehicle, alpha) setElementAlpha(player[i], alpha) setPlayerNametagShowing ( player, false ) end if(vehicle == tarVehicle and vehicle ~= false)then setElementAlpha(vehicle, 255) setElementAlpha(player[i], 255) setPlayerNametagShowing ( player, true ) end end end) bindKey("o", "up", function() carfade = (not carfade) if(carfade)then outputChatBox("#FFFFFF[ENABLE]#FF5500Carfade is now #00FF00enabled#FF5500!", 255, 128, 0, true) else outputChatBox("#FFFFFF[DISABLE]#FF5500Carfade is now #FF0000disabled#FF5500!", 255, 128, 0, true) end end)
  20. meh

    carfade issue

    so, basically i gotta addd this event to line 45 setPlayerNametagShowing ( v, false ) and this event to line 49 setPlayerNametagShowing right?
  21. meh

    carfade issue

    hi, today's resouce that i want to talk about is carfade (https://community.multitheftauto.com/index.php?p= ... ls&id=3668). basically, what i want it to do is to hide other players cars completely. and to do so, you just need to set min alpha to 0 as far as i know. sounds simple? it sure does. BUT, unfortunately everything is a bit more complecated. even though it's possible to hide other players cars, their nicknames are still visible! so, i'm looking for an advice how to hide players nicknames as well. please halp. here's the script's code: local MAX_DIST = 30 local MIN_DIST = 5 local MIN_ALPHA = 50 local carfade = true addEventHandler("onClientRender", getRootElement(), function() local camTarget = getCameraTarget() local tarVehicle = false if(camTarget == false)then return end if(getElementType(camTarget) == "vehicle")then tarVehicle = camTarget elseif(getElementType(camTarget) == "player")then tarVehicle = getPedOccupiedVehicle(camTarget) end if (camTarget == false or tarVehicle == false)then return end local posX, posY, posZ = getElementPosition(tarVehicle) local camX, camY, camZ = getCameraMatrix() local player = getElementsByType("player") for i = 1, #player do local vehicle = getPedOccupiedVehicle(player[i]) if(vehicle ~= tarVehicle and vehicle ~= false)then local alpha = 255 local x, y, z = getElementPosition(vehicle) local playerDist = getDistanceBetweenPoints3D(posX, posY, posZ, x, y, z) local camDist = getDistanceBetweenPoints3D(camX, camY, camZ, x, y, z) -- If distance is more or less than maximum and minimum values, then set alpha to minimum alpha. if(playerDist <= MIN_DIST or camDist <= MIN_DIST)then alpha = MIN_ALPHA end local alpha_dist = (playerDist/MAX_DIST) if(alpha_dist >= 0)then alpha = alpha_dist * 255 if(alpha > 255)then alpha = 255 end if(alpha < MIN_ALPHA)then alpha = MIN_ALPHA end end if(carfade == false)then alpha = 255 end local state = getElementData(player[i], "state") or false if(state == "dead" or state == "not ready")then alpha = 0 end setElementAlpha(vehicle, alpha) setElementAlpha(player[i], alpha) end if(vehicle == tarVehicle and vehicle ~= false)then setElementAlpha(vehicle, 255) setElementAlpha(player[i], 255) end end end) bindKey("F4", "up", function() carfade = (not carfade) if(carfade)then outputChatBox("#FFFFFF[ENABLE]#FF5500Carfade is now #00FF00enabled#FF5500!", 255, 128, 0, true) else outputChatBox("#FFFFFF[DISABLE]#FF5500Carfade is now #FF0000disabled#FF5500!", 255, 128, 0, true) end end)
  22. bump. i still need more info.
  23. lol u saved my ass again. thank you one more time. i think i love you (not in a gay way)
×
×
  • Create New...