Jump to content

Fabioxps

Members
  • Posts

    229
  • Joined

  • Last visited

Everything posted by Fabioxps

  1. all right but when you press f6 camera not back to the start why? local visible = true setCameraMatrix (117.5101852417, 163.30557250977, 5579.2065429688, 116.48139190674, 156.49519348145, 5579.0087890625) local progress = 0.0; function aa() if progress < 1 then progress = progress + 0.002; -- increase to move the camera faster end local x, y, z = interpolateBetween( 117.5101852417, 163.30557250977, 5579.2065429688, 120.94383239746,162.29713439941,5579.5678710938, progress, "Linear" ); setCameraMatrix (x, y, z, 116.48139190674, 156.49519348145, 5579.0087890625) end addEventHandler("onClientRender",root, aa) bindKey("F6","down", function() if visible then removeEventHandler("onClientRender",root, aa) visible = false else addEventHandler("onClientRender",root, aa) visible = true end end)
  2. Fabioxps

    Winner !!!

    Also local x, y = guiGetScreenSize ( ) Will be overwrite by this: local x, y, z = getElementPosition ( veh ) the problem in this "rank" but do not know fix
  3. Fabioxps

    Winner !!!

    names not yet appear
  4. Fabioxps

    Winner !!!

    What should we do? /debugscript 3? Is there a bug in it or what? viewtopic.php?f=91&t=47897 has no errors but does not appear the names of players
  5. Fabioxps

    Winner !!!

    can someone help me with this? Server addCommandHandler ( "a", function() local ped = createPed(0, 138.70454406738, 2491.1267089844, 16.484375) local pVeh = createVehicle(411, -73.699996948242, 2506.3999023438, 16.299999237061,0,0,270) local pedssss = createPed(0,-73.699996948242, 2500.3999023438, 16.299999237061) local cAmssss = createVehicle(411, -73.699996948242, 2500.3999023438, 16.299999237061,0,0,270) local pedsss = createPed(0,-73.699996948242, 2510.3999023438, 16.299999237061) local cAmsss = createVehicle(411, -73.699996948242, 2510.3999023438, 16.299999237061,0,0,270) warpPedIntoVehicle ( ped,pVeh ,0 ) warpPedIntoVehicle ( pedssss,cAmssss, 0 ) warpPedIntoVehicle ( pedsss,cAmsss ,0 ) triggerClientEvent("onCameraStart",root, ped,pVeh) triggerClientEvent("onCameraStarts",root, pedsss,cAmsss) triggerClientEvent("onCameraStartsss",root, pedssss,cAmssss) triggerClientEvent("stunts",getRootElement(),stunts) outputChatBox("test") end) Client local peds = { } local pedss = { } local pedsss = { } stunt = nil stunt2 = nil stunt3 = nil function stunts(tag) stunt = tag stunt2 = tag stunt3 = tag end addEvent("stunts",true) addEventHandler("stunts",getRootElement(),stunts) function camera ( ) for ped,veh in pairs(peds)do local x, y, z = getElementPosition(veh) setCameraMatrix(x+12, y+11, z+4, x, y, z) end end function cameraStarts(ped) setPedControlState(ped,"accelerate",true) setTimer(function() setPedControlState(ped,"accelerate",false) end,800,1) pVeh = getPedOccupiedVehicle(ped) if not peds[ped] then peds[ped] = pVeh end addEventHandler("onClientRender",root,camera) addEventHandler("onClientRender",getRootElement(),stunt) end addEvent( "onCameraStart", true ) addEventHandler( "onCameraStart",root, cameraStarts ) function cameraStartsss(pedsss) setPedControlState(pedsss,"accelerate",true) setTimer(function() setPedControlState(pedsss,"accelerate",false) end,600,1) cAmsss = getPedOccupiedVehicle(pedsss) if not pedss[pedsss] then pedss[pedsss] = cAmsss end addEventHandler("onClientRender",getRootElement(),stunt2) end addEvent( "onCameraStarts", true ) addEventHandler( "onCameraStarts",root, cameraStartsss ) function cameraStartssss(pedssss) setPedControlState(pedssss,"accelerate",true) setTimer(function() setPedControlState(pedssss,"accelerate",false) end,600,1) cAmssss = getPedOccupiedVehicle(pedssss) if not pedsss[pedssss] then pedsss[pedssss] = cAmssss end addEventHandler("onClientRender",getRootElement(),stunt3) end addEvent( "onCameraStartsss", true ) addEventHandler( "onCameraStartsss",root, cameraStartssss ) function stunt ( ) local x, y = guiGetScreenSize ( ) for _, veh in pairs ( peds ) do if ( veh ) then local x, y, z = getElementPosition ( veh ) local px, py, pz = x + 5, y + 10, z + 2 local distance = getDistanceBetweenPoints3D ( x, y, z, px, py, pz ) local rank = getElementData(localPlayer,"race rank") if ( distance <= 150 ) then local sx, sy = getScreenFromWorldPosition ( x, y, z + 0.55, 0.06 ) if ( sx ) then if stunt ~= nil then if ( rank == 1 ) then local scale = 1 / ( 0.3 * ( distance / 150 ) ) dxDrawImage ( sx - 100, sy - 105, 200, 70,"tooltip.png",0,0,0,tocolor(255,255,255,255)) dxDrawText ( "#ffffff1º ".. getPlayerName ( source ) .." Winner!", sx, sy - 70, sx, sy - 60, tocolor ( 255, 255, 255, 255 ), math.min ( 0.4 * ( 20 / distance ) * 1.4, 4 ), "default-bold", "center", "bottom", false, false, false, true ) end end end end end end end function stunt2 ( ) local x, y = guiGetScreenSize ( ) for _, veh in pairs ( pedss ) do if ( veh ) then local x, y, z = getElementPosition ( veh ) local px, py, pz = x + 5, y + 10, z + 2 local distance = getDistanceBetweenPoints3D ( x, y, z, px, py, pz ) if ( distance <= 150 ) then local sx, sy = getScreenFromWorldPosition ( x, y, z + 0.55, 0.06 ) local rank = getElementData(localPlayer,"race rank") if ( sx ) then if stunt2 ~= nil then if ( rank == 2 ) then local scale = 1 / ( 0.3 * ( distance / 150 ) ) dxDrawImage ( sx - 100, sy - 105, 200, 70,"tooltip.png",0,0,0,tocolor(255,255,255,255)) dxDrawText ( "#ffffff1º ".. getPlayerName ( source ) .." Winner!", sx, sy - 70, sx, sy - 60, tocolor ( 255, 255, 255, 255 ), math.min ( 0.4 * ( 20 / distance ) * 1.4, 4 ), "default-bold", "center", "bottom", false, false, false, true ) end end end end end end end function stunt3 ( ) local x, y = guiGetScreenSize ( ) for _, veh in pairs ( pedsss ) do if ( veh ) then local x, y, z = getElementPosition ( veh ) local px, py, pz = x + 5, y + 10, z + 2 local distance = getDistanceBetweenPoints3D ( x, y, z, px, py, pz ) if ( distance <= 150 ) then local sx, sy = getScreenFromWorldPosition ( x, y, z + 0.55, 0.06 ) local rank = getElementData(localPlayer,"race rank") if ( sx ) then if stunt3 ~= nil then if ( rank == 3 ) then local scale = 1 / ( 0.3 * ( distance / 150 ) ) dxDrawImage ( sx - 100, sy - 105, 200, 70,"tooltip.png",0,0,0,tocolor(255,255,255,255)) dxDrawText ( "#ffffff1º ".. getPlayerName ( source ) .." Third!", sx, sy - 70, sx, sy - 60, tocolor ( 255, 255, 255, 255 ), math.min ( 0.4 * ( 20 / distance ) * 1.4, 4 ), "default-bold", "center", "bottom", false, false, false, true ) end end end end end end end
  6. This function shows the blips of alive players TO alive players and blips of in-training players TO in-training players rotationRotator = 0 addEventHandler("onClientHUDRender", getRootElement(), function() showPlayerHudComponent("radar", false) local px, py, pz = getElementPosition(localPlayer) local pr = getPedRotation(localPlayer) local cx,cy,_,tx,ty = getCameraMatrix() local north = findRotation(cx,cy,tx,ty) dxDrawImage(posx,posy,height,height, "img/radar.png") dxDrawImage(posx,posy,height,height, "img/north.png", north) for id, player in ipairs(getElementsByType("player")) do local veh = getPedOccupiedVehicle(player) local dimension = getElementDimension(player) if getElementData(player, "state") == getElementData(localPlayer, "state") then if player ~= localPlayer then local _,_,rot = getElementRotation(veh) local ex, ey, ez = getElementPosition(veh) local dist = getDistanceBetweenPoints2D(px,py,ex,ey) if dist > range then dist = tonumber(range) end local angle = 180-north + findRotation(px,py,ex,ey) local cblipx, cblipy = getDistanceRotation(0, 0, height*(dist/range)/2, angle) local blipx = centerleft+cblipx-blipsize/2 local blipy = centertop+cblipy-blipsize/2 local yoff = 0 local r,g,b,a = 255,255,255,255 if getPlayerTeam(player) then r,g,b = getTeamColor( getPlayerTeam(player) ) end local img = "img/blip.png" if (ez - pz) >= 5 then img = "img/blipup.png" elseif (ez - pz) <= -5 then img = "img/blipdown.png" end if tonumber(getElementModel(veh)) == 425 then img = "img/hunter.png" end dxDrawImage(blipx, blipy, blipsize, blipsize, img, north-rot+45, 0, 0, tocolor(r,g,b,a)) if img == "img/hunter.png" then rotationRotator = rotationRotator + 1.25 dxDrawImage(blipx, blipy, blipsize, blipsize, "img/rotor.png", north-rot+45+rotationRotator, 0, 0) end end end local vehicle = getPedOccupiedVehicle(localPlayer) dxDrawImage(centerleft - lpsize/2, centertop - lpsize/2, lpsize,lpsize, "img/local.png", north-pr,0,0,tocolor(255,255,255,255)) end end ) thx,thank you
  7. but I want to hide the blips of players alive when I'm in training I see blips of all players
  8. has no errors but the beeps(blips) of players who are in training appears to them that are with state alive
  9. can someone tell me what's wrong with line 63 and 65 local localPlayer = getLocalPlayer() local sx,sy = guiGetScreenSize() local posx = sy * 0.05 local posy = sy * 0.725 local height = sy * 0.225 local centerleft = posx + height / 2 local centertop = posy + height / 2 local blipsize = height / 16 local lpsize = height / 8 local range = 180 function findRotation(x1,y1,x2,y2) local t = -math.deg(math.atan2(x2-x1,y2-y1)) if t < 0 then t = t + 360 end return t end function getDistanceRotation(x, y, dist, angle) local a = math.rad(90 - angle) local dx = math.cos(a) * dist local dy = math.sin(a) * dist return x+dx, y+dy end local huntersonly = false setTimer( function() huntersonly = true for id, player in ipairs(getElementsByType("player")) do if getElementData(player, "state") == "alive" then if getPedOccupiedVehicle(player) and getElementModel(getPedOccupiedVehicle(player)) ~= 425 then huntersonly = false end end end local target = getCameraTarget() if target and getElementType(target) == "vehicle" then localPlayer = getVehicleOccupant(target) else localPlayer = getLocalPlayer() end end,1000,0) rotationRotator = 0 addEventHandler("onClientHUDRender", getRootElement(), function() showPlayerHudComponent("radar", false) local px, py, pz = getElementPosition(localPlayer) local pr = getPedRotation(localPlayer) local cx,cy,_,tx,ty = getCameraMatrix() local north = findRotation(cx,cy,tx,ty) dxDrawImage(posx,posy,height,height, "img/radar.png") dxDrawImage(posx,posy,height,height, "img/north.png", north) for id, player in ipairs(getElementsByType("player")) do local veh = getPedOccupiedVehicle(player) local dimension = getElementDimension(player) if getElementData(localPlayer, "state") == "alive" or getElementData(localPlayer, "state") == "Training" and veh and dimension and player ~= localPlayer then local _,_,rot = getElementRotation(veh) local ex, ey, ez = getElementPosition(veh) local dist = getDistanceBetweenPoints2D(px,py,ex,ey) if dist > range then dist = tonumber(range) end local angle = 180-north + findRotation(px,py,ex,ey) local cblipx, cblipy = getDistanceRotation(0, 0, height*(dist/range)/2, angle) local blipx = centerleft+cblipx-blipsize/2 local blipy = centertop+cblipy-blipsize/2 local yoff = 0 local r,g,b,a = 255,255,255,255 if getPlayerTeam(player) then r,g,b = getTeamColor( getPlayerTeam(player) ) end local img = "img/blip.png" if (ez - pz) >= 5 then img = "img/blipup.png" elseif (ez - pz) <= -5 then img = "img/blipdown.png" end if tonumber(getElementModel(veh)) == 425 then img = "img/hunter.png" end dxDrawImage(blipx, blipy, blipsize, blipsize, img, north-rot+45, 0, 0, tocolor(r,g,b,a)) if img == "img/hunter.png" then rotationRotator = rotationRotator + 1.25 dxDrawImage(blipx, blipy, blipsize, blipsize, "img/rotor.png", north-rot+45+rotationRotator, 0, 0) end end local vehicle = getPedOccupiedVehicle(localPlayer) dxDrawImage(centerleft - lpsize/2, centertop - lpsize/2, lpsize,lpsize, "img/local.png", north-pr,0,0,tocolor(255,255,255,255)) end end )
  10. you can add something that might move the panel?
  11. Fabioxps

    dxDrawText

    how to change the text in a dxDrawText guiSetText?
  12. I want to see the three players who die in last place
  13. Fabioxps

    Rank !!!

    I want to do this: https://forum.multitheftauto.com/viewtopic.php?f=91&t=56664
  14. I'm getting both players won addCommandHandler ( "rank", function (player) for _, player in ipairs ( getElementsByType ( "player" ) ) do local rank = exports.race:getPlayerRank ( player ) if ( rank == 1 ) then outputChatBox ( "#ffffff1º ".. getPlayerName ( player ) .." Winner!", root, 0, 0, 0, true ) elseif ( rank == 2 ) then outputChatBox ( "#ffffff2º ".. getPlayerName ( player ) .." Second!", root, 0, 0, 0, true ) elseif ( rank == 3 ) then outputChatBox ( "#ffffff3º ".. getPlayerName ( player ) .." Third!", root, 0, 0, 0, true ) end end end )
  15. I want to know what were the three players who died in the end
  16. when I type the command appears my name
  17. if I type the command does not show the names of the players, but my
  18. I want to appear the nick of the player who is in the rank and not on who types the command
  19. can someone help me please?
  20. this is correct? addCommandHandler ( "rank", function(rankPlayersWasted) local rank = exports.race:getPlayerRank(rankPlayersWasted)+0 if (rank == 1) then outputChatBox("#ffffff1º "..getPlayerName(rankPlayersWasted).." Winner!",getRootElement(),0,0,0,true) elseif(rank == 2) then outputChatBox("#ffffff1º "..getPlayerName(rankPlayersWasted).." Second!",getRootElement(),0,0,0,true) elseif(rank == 3) then outputChatBox("#ffffff1º "..getPlayerName(rankPlayersWasted).." Third!",getRootElement(),0,0,0,true) end end)
  21. Fabioxps

    Rank !!!

    can someone tell me what do this wrong please addCommandHandler ( "a", function() local nick = getPlayerName() local players = getPlayerFromName(nick) local rank = exports.race:getPlayerRank(players)+0 outputChatBox( "Ganhador "..rank ) end)
  22. messages are for players of the same language if getElementData(player,"Idiomas") == "inglês" then Client local g_Window = nil function exemplo() if g_Window then return end g_Window = {} local screenWidth, screenHeight = guiGetScreenSize() g_Window.windowWidth, g_Window.windowHeight = 400, 315 local left = screenWidth/2 - g_Window.windowWidth/2 local top = screenHeight/2 - g_Window.windowHeight/2 g_Window.window = guiCreateWindow(left, top, g_Window.windowWidth, g_Window.windowHeight, "Idiomas", false) g_Window.portugues = guiCreateButton(50, 100, 150, 100, "Portugues", false, g_Window.window) g_Window.ingles = guiCreateButton(200, 100, 150, 100, "inglês", false, g_Window.window) g_Window.closeBtn = guiCreateButton(320, 285, 150, 100, "Close", false, g_Window.window) guiWindowSetSizable(g_Window.window, false) guiWindowSetMovable(g_Window.window, false) guiSetEnabled(g_Window.window, false) guiSetVisible(g_Window.window, true) g_Window.startTime = getTickCount() g_Window.startSize = {0, 0} g_Window.endSize = {g_Window.windowWidth, g_Window.windowHeight} g_Window.endTime = g_Window.startTime + 1000 addEventHandler("onClientRender", getRootElement(), popWindowUp) end bindKey ( "f1", "down", exemplo) function Portugues() outputChatBox("idioma Portugues.", 0, 255, 0, false) setElementData(localPlayer, "Idioma", "Portugues") end function Ingles() outputChatBox("idioma inglês.", 0, 255, 0, false) setElementData(localPlayer, "Idioma", "inglês") end function on_closeBtn_clicked(button, state, absoluteX, absoluteY) if (button ~= "left") or (state ~= "up") then return end if not g_Window then return end showCursor(false) guiSetEnabled(g_Window.window, false) guiWindowSetMovable(g_Window.window, false) local screenWidth, screenHeight = guiGetScreenSize() local posX, posY = guiGetPosition(g_Window.window, false) g_Window.startTime = getTickCount() g_Window.startSize = {g_Window.windowWidth, g_Window.windowHeight} g_Window.startCenter = { posX + g_Window.windowWidth/2, posY + g_Window.windowHeight/2, } g_Window.endSize = {0, 0} g_Window.endTime = g_Window.startTime + 1000 g_Window.endCenter = { screenWidth, screenHeight } addEventHandler("onClientRender", getRootElement(), popWindowDown) end function popWindowUp() local now = getTickCount() local elapsedTime = now - g_Window.startTime local duration = g_Window.endTime - g_Window.startTime local progress = elapsedTime / duration local width, height, _ = interpolateBetween ( g_Window.startSize[1], g_Window.startSize[2], 0, g_Window.endSize[1], g_Window.endSize[2], 0, progress, "OutElastic") guiSetSize(g_Window.window, width, height, false) local screenWidth, screenHeight = guiGetScreenSize() guiSetPosition(g_Window.window, screenWidth/2 - width/2, screenHeight/2 - height/2, false) if not guiGetVisible(g_Window.window) then guiSetVisible(g_Window.window, true) guiBringToFront(g_Window.window) end if now >= g_Window.endTime then guiSetEnabled(g_Window.window, true) guiBringToFront(g_Window.window) removeEventHandler("onClientRender", getRootElement(), popWindowUp) addEventHandler("onClientGUIClick", g_Window.closeBtn, on_closeBtn_clicked, false) addEventHandler("onClientGUIClick", g_Window.portugues, Portugues, false) addEventHandler("onClientGUIClick", g_Window.ingles, Ingles, false) showCursor(true) guiWindowSetMovable(g_Window.window, true) end end function popWindowDown() local now = getTickCount() local elapsedTime = now - g_Window.startTime local duration = g_Window.endTime - g_Window.startTime local progress = elapsedTime / duration local width, height, _ = interpolateBetween ( g_Window.startSize[1], g_Window.startSize[2], 0, g_Window.endSize[1], g_Window.endSize[2], 0, progress, "InQuad") guiSetSize(g_Window.window, width, height, false) local centerX, centerY, _ = interpolateBetween ( g_Window.startCenter[1], g_Window.startCenter[2], 0, g_Window.endCenter[1], g_Window.endCenter[2], 0, progress, "InQuad") guiSetPosition(g_Window.window, centerX - width/2, centerY - height/2, false) if now >= g_Window.endTime then removeEventHandler("onClientRender", getRootElement(), popWindowDown) destroyElement(g_Window.window) g_Window = nil end end Server chat_range=100 addEventHandler("onPlayerJoin",getRootElement(), function () bindKey(source,"l","down","chatbox","Language") bindKey(source,"g","down","chatbox","Global") end) addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function () for index, player in pairs(getElementsByType("player")) do bindKey(player,"l","down","chatbox","Language") bindKey(player,"g","down","chatbox","Global") end end) function isPlayerInRangeOfPoint(player,x,y,z,range) local px,py,pz=getElementPosition(player) return ((x-px)^2+(y-py)^2+(z-pz)^2)^0.5<=range end function onChat(player,_,...) --if getElementData(player,"Idiomas") == "inglês" then local px,py,pz = getElementPosition(player) local msg = table.concat({...}, " ") local nick = getPlayerName(player) local idiomas = getElementData(player,"Idioma") for _,v in ipairs(getElementsByType("player")) do if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) then outputChatBox("#ff0000("..idiomas..")#ffffff "..nick.."#ffffff: "..msg,v,r,g,b,true) end end --end end addCommandHandler("Language",onChat) function Globals(player,_,...) local px,py,pz = getElementPosition(player) local msg = table.concat({...}, " ") local nick = getPlayerName(player) for _,v in ipairs(getElementsByType("player")) do if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) then outputChatBox("#FF6464(Global)#ffffff "..nick.."#ffffff: "..msg,v,r,g,b,true) end end end addCommandHandler("Global",Globals)
×
×
  • Create New...