Jump to content

h4x7o0r

Members
  • Posts

    203
  • Joined

  • Last visited

Everything posted by h4x7o0r

  1. Well i tried to get those values then convert them to hex and maybe somehow use them to fix my script . like this ? for k,v in pairs(team) do local r,g,b = getTeamColor(pTeam) if r and g and b then -- smth RGBToHex(r,g,b) end end
  2. like this ? function RGBToHex(red, green, blue, alpha) if((red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255) or (alpha and (alpha < 0 or alpha > 255))) then return nil end if(alpha) then return string.format("#%.2X%.2X%.2X%.2X", red,green,blue,alpha) else return string.format("#%.2X%.2X%.2X", red,green,blue) end end for k,v getElementsByType("vehicle")do local player = getVehicleController(k) if(player)then local pTeam = getPlayerTeam(player) if(pTeam)then local r,g,b = getTeamColor(pTeam) if r and g and b then -- smth RGBToHex(r,g,b) end end end end
  3. any help ? how can i retrieve, if only 2 teams are created, the colors and names for each one ?
  4. Hello there, I was trying to modify CW Resource but idk how exactly i can do it. This resource it's kinda "referee" that keeps the score between 2 teams. by default the admin should open the settings of the resource and set teams names and choice ONLY between 2 colors RED and BLUE. What i want is to modify this res, to get the team tag and team color directly without needed to set by admin. To making it work, i'm using autoteams (if a registered team tag is used it's automatically redirect the players and create the proper team. I wanna use that values on this script. To summarize all, i want this script to find if 2 teams are created already, and then to autocreate the name and color for eachteam for cw. Here's the server-part: ----------------- -- Variables ----------------- -- Names homeName = get('HomeName') enemyName = get('EnemyName') -- Tags homeTag = get('HomeTag') enemyTag = get('EnemyTag') -- Colors enemyColor = get('EnemyColor') homeColor = get('HomeColor') -- Maps Maps = get('Maps') -- Table team = {} addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), function(startedRes) if getResourceName(getThisResource()) == getResourceName(startedRes) then -- Spectators team team[3] = createTeam ( "Spectators", 255, 255, 255 ) -- Create home team if homeColor == "Red" then team[1] = createTeam ( homeName, 255, 0, 0 ) elseif homeColor == "Blue" then team[1] = createTeam ( homeName, 0, 0, 255 ) end -- Create enemey team if enemyColor == "Red" then team[2] = createTeam ( enemyName, 255, 0, 0 ) elseif enemyColor == "Blue" then team[2] = createTeam ( enemyName, 0, 0, 255 ) end -- Save in elementdata setElementData(team[1], "points", 0) setElementData(team[1], "alive", 0) setElementData(team[2], "points", 0) setElementData(team[2], "alive", 0) setElementData(team[1], "left", Maps) setElementData(team[1], "warState", "Waiting") end end ) addEvent("updateNameServer", true) addEventHandler("updateNameServer", getRootElement(), function(thePlayer) triggerClientEvent(thePlayer, "updateName", getRootElement(), homeName, homeTag, enemyName, enemyTag) end ) addEventHandler("onNotifyPlayerReady", getRootElement(), function() local playerTeam = getPlayerTeam (source) local PVeh= getPedOccupiedVehicle(source) if ( playerTeam ) then local teamName = getTeamName(playerTeam) -- Home Colors if teamName == homeName then if homeColor == "Red" then setVehicleColor(PVeh, 3, 3, 3, 3) setVehicleHeadLightColor(PVeh, 255, 0, 0) setElementModel(source, 264) elseif homeColor == "Blue" then setVehicleColor(PVeh, 79, 79, 79, 79) setVehicleHeadLightColor(PVeh, 0, 0, 255) setElementModel(source, 84) end -- Enemy Colors elseif teamName == enemyName then if enemyColor == "Red" then setVehicleColor(PVeh, 3, 3, 3, 3) setVehicleHeadLightColor(PVeh, 255, 0, 0) setElementModel(source, 264) elseif enemyColor == "Blue" then setVehicleColor(PVeh, 79, 79, 79, 79) setVehicleHeadLightColor(PVeh, 0, 0, 255) setElementModel(source, 84) end end end end ) addEventHandler("onPlayerPickUpRacePickup",getRootElement(), function() local playerTeam = getPlayerTeam (source) local PVeh= getPedOccupiedVehicle(source) if ( playerTeam ) then local teamName = getTeamName(playerTeam) if teamName == homeName then if homeColor == "Red" then setVehicleColor(PVeh, 3, 3, 3, 3) setVehicleHeadLightColor(PVeh, 255, 0, 0) elseif homeColor == "Blue" then setVehicleColor(PVeh, 79, 79, 79, 79) setVehicleHeadLightColor(PVeh, 0, 0, 255) end -- Enemy Colors elseif teamName == enemyName then if enemyColor == "Red" then setVehicleColor(PVeh, 3, 3, 3, 3) setVehicleHeadLightColor(PVeh, 255, 0, 0) elseif enemyColor == "Blue" then setVehicleColor(PVeh, 79, 79, 79, 79) setVehicleHeadLightColor(PVeh, 0, 0, 255) end end end end ) function getBlipAttachedTo( thePlayer ) local blips = getElementsByType( "blip" ) for k, theBlip in ipairs( blips ) do if getElementAttachedTo( theBlip ) == thePlayer then return theBlip end end return false end addEvent("onRaceStateChanging") addEventHandler("onRaceStateChanging",getRootElement(), function(old, new) if old == "Running" and new == "GridCountdown" then setElementData(team[1], "alive", countPlayersInTeam(team[1])) setElementData(team[2], "alive", countPlayersInTeam(team[2])) local players = getElementsByType("player") for k,v in ipairs(players) do local thePlayer = v local playerTeam = getPlayerTeam (thePlayer) if ( playerTeam ) then local teamName = getTeamName(playerTeam) -- Kill spectators if teamName == "Spectators" then setTimer( function() setElementHealth(thePlayer,0) end ,1000, 1) end end end end end ) addEvent("onRaceStateChanging") addEventHandler("onRaceStateChanging",getRootElement(), function(old, new) local players = getElementsByType("player") for k,v in ipairs(players) do local thePlayer = v local playerTeam = getPlayerTeam (thePlayer) local theBlip = getBlipAttachedTo(thePlayer) local r,g,b if ( playerTeam ) then if old == "Running" and new == "GridCountdown" then r, g, b = getTeamColor (playerTeam) setBlipColor(theBlip, tostring(r), tostring(g), tostring(b), 255) end end end end ) function playerDied() local playerTeam = getPlayerTeam(source) if ( playerTeam ) then local teamName = getTeamName(playerTeam) if teamName ~= "Spectators" then local newAlive = getElementData(playerTeam, "alive") - 1 if newAlive > -1 then setElementData(playerTeam, "alive", newAlive) end end end end addEventHandler ( "onPlayerWasted", getRootElement(), playerDied ) addEventHandler ( "onPlayerQuit", getRootElement(), playerDied ) function playerDied2() local alive = getAlivePlayers() if (#alive == 1) then local player = alive[1] local playerTeam = getPlayerTeam(player) local teamName = getTeamName(playerTeam) if teamName == homeName then Newpoints = getElementData(team[1], "points") + 1 setElementData(team[1], "points", Newpoints) newLeft = getElementData(team[1], "left") - 1 setElementData(team[1], "left", newLeft) elseif teamName == enemyName then Newpoints = getElementData(team[2], "points") + 1 setElementData(team[2], "points", Newpoints) newLeft = getElementData(team[1], "left") - 1 setElementData(team[1], "left", newLeft) end end end addEventHandler ( "onPlayerWasted", getRootElement(), playerDied2 ) addEventHandler ( "onPlayerQuit", getRootElement(), playerDied2 ) addCommandHandler("join", function(player, command, teamtag) if teamtag == tostring(homeTag) then setPlayerTeam(player, team[1]) outputChatBox("You've joined "..homeName, player, 0, 255, 0) end if teamtag == tostring(enemyTag) then setPlayerTeam(player, team[2]) outputChatBox("You've joined "..enemyName, player, 0, 255, 0) end if teamtag == "Spectators" then setPlayerTeam(player, team[3]) outputChatBox("You've joined Spectators", player, 0, 255, 0) end end ,false) ------------------- -- Admin Commands ------------------- -- get string or default function getString(var,default) local result = get(var) if not result then return default end return tostring(result) end -- AdminGroups from settings adminGroups = getString('Clanwar.Admingroup',"Admin") addCommandHandler("addpoint", function(
  5. That worked. Thank you for your help guys.
  6. As far as i know, you can't detect who triggered a projectile but maybe getDistanceBetweenPoints3D colshape would help u. Think that has been discussed in some previous posts like this : viewtopic.php?f=91&t=57003
  7. well it doesn't seems to work. just figure it out that i was changing the weight and height of the image and not the position. I've tried this but doesn't work : local screenWidth, screenHeight = guiGetScreenSize() addEventHandler("onClientRender", root, function () local a , b = 50 , 100 local x, y = interpolateBetween ( a, b, 0, a+10, b+20, 0, progress, "Linear") dxDrawImage( screenWidth - a, screenHeight - b , 63 , 62 ,"test.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) end) I want the transition to appear when a resource is starting.
  8. Thanks for your reply 50p. like this ? local screenWidth, screenHeight = guiGetScreenSize() local a , b = 50 , 100 local a , b = interpolateBetween ( a1, b1, 0, a2+10, b2+20, 0, progress, "Linear") dxDrawImage(screenWidth - 90,50 , a , b,"test.png",0.0,0.0,0.0,tocolor(255,255,255,200),false)
  9. Thank you for your reply. i'm trying to figure it out how to define variables but can't get it. The examples in the wiki aren't helping me. Still digging. local screenWidth, screenHeight = guiGetScreenSize() local a , b = 50 , 100 dxDrawImage(screenWidth - 90,50 , a , b,"test.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) local a , b = interpolateBetween ( a, b, 0, a+10, b+20, 0, progress, "Linear")
  10. Hey there, I wanna move an image from one place to another (fade it as well ). For example: dxDrawImage(screenWidth - 90,156,64,64,"test.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) --to be moved while fade it to : dxDrawImage(screenWidth - 90,50.0,63.0,62.0,"test.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) I've imported the arc_ library but couldn't find any info regarding dx functions. How can i make it ? Thanks in advance for your help.
  11. Thank you for your reply. I've found those parameters before but isn't what i'm looking for. what i want is to lift up a lil the entire votemanager not the to modify what's inside. Still waiting for help. LE: FIXED, tnx for help.
  12. Hey guys, i've tried to find where this votemanager's having its rendering window parameters, but without any luck. Can someone tell me what should i modify to move the entire votemanager (height) ? I've tried many ways within this votemanager_client.lua but i think the window isn't rendered from there.
  13. So yeah i've managed to fix the script , it;'s working well now even with hunter but i need to make it work only on dm maps. How can i restrict it to work only on dm maps? i mean to let player alive .
  14. Scoreboard is a standalone resource locate in : %MTADIR%/mod/deathmatch/resources/gameplay/scoreboard (or could be an archive like scoreboard.zip). I think you must modify : dxscoreboard_client.lua
  15. Is it anyone able to fix this ? thanks in advance
  16. I'm pretty sure that you use a panel that's not yours, so if i'm right you better change : triggerEvent("onNextmapBuy",source,mapName) with executeCommandHandler("nextmap", thePlayer, mapName)
  17. Thank you for your help guys. As i've seen there are no error in debugscript 3. @EvoGT : Thanks for your help but this modification was already made if u review the previous scripts. The problem is with the distinction between DD / DM / FDD and when last player alive on dm maps takes hunter. Still waiting for help guys.
  18. Well i've tried what you've suggested before but looks like the script still not working at all. Here's what i've tried but i think isn't the best choice to modify this function DestructionDerby:handleFinishActivePlayer(player) : function DestructionDerby:handleFinishActivePlayer(player) -- Update ranking board for player being removed if not self.rankingBoard then self.rankingBoard = RankingBoard:create() self.rankingBoard:setDirection( 'up', getActivePlayerCount() ) end local timePassed = self:getTimePassed() self.rankingBoard:add(player, timePassed) -- Do remove finishActivePlayer(player) -- Update ranking board if one player left local activePlayers = getActivePlayers() local resource = exports["mapmanager"]:getRunningGamemodeMap( ) local mapName = getResourceInfo ( resource, "name" ) if string.find ( mapName, "[DD]" ) then if #activePlayers == 1 then self.rankingBoard:add(activePlayers[1], timePassed) showMessage(getPlayerName(activePlayers[1]) .. ' won the map!', 255, 0, 0) RaceMode.endMap() end elseif string.find ( mapName, "[DM]" ) then if #activePlayers < 1 then if getElementModel (getPedOccupiedVehicle ( alivePlayers[1] )) == 425 then self.rankingBoard:add(activePlayers[1], timePassed) showMessage(getPlayerName(activePlayers[1]) .. ' won the map!', 255, 0, 0) RaceMode.endMap() end end end end
×
×
  • Create New...