Jump to content

SoundWave

Members
  • Posts

    39
  • Joined

  • Last visited

Everything posted by SoundWave

  1. I know it does, because I am creating a multiroom. Do you have any idea what is bugging?
  2. I am creating a custom scoreboard. But i'm quite stuck at the moment. Since I don't find any bugs in debugscript 3 I thought someone here might know the problem. It draws some part of it but not all. Here is the client side: local scrX,scrY = guiGetScreenSize(); local g_Me = getLocalPlayer(); local players = {}; addEvent("spl",true) addEventHandler("spl",root, function(arg) players = arg; end) local scroll = 1; local anim_x = 0; local anim_y = 20; local board_x = 360; local size_info = 60; local size_title = 20; local p_space = 20; local function init_scoreboard() local pcount = #players+3; local y = pcount*p_space+size_info; local fits = pcount; if scrY-300 < y then y = scrY-300; fits = (y-size_info)/p_space; end fits = math.floor(fits); dxDrawRectangle(scrX/2-anim_x,scrY/2-anim_y/2,anim_x*2,anim_y,tocolor(0,0,0,130)); if anim_x < board_x then anim_x = anim_x + p_space; else if anim_y < y then anim_y = anim_y + p_space; else --// Info dxDrawRectangle(scrX/2-anim_x,scrY/2-y/2,anim_x*2,size_info-size_title,tocolor(5,25,40,255)); dxDrawText("The Insane Players gaming server.",0,scrY/2-y/2,scrX,0,tocolor(220,220,220,255),1,"default-bold","center"); dxDrawText("Players: "..#getElementsByType("player").."/100",scrX/2-anim_x+5,scrY/2-y/2,0,0,tocolor(220,220,220,255),1,"default-bold"); dxDrawText("Website: [url=http://www.insaneplayers.eu]http://www.insaneplayers.eu[/url]",scrX/2-anim_x+5,scrY/2-y/2+20,0,0,tocolor(220,220,220,255),1,"default-bold"); --// Player info local function draw_player_info(arg,x,y,v,k,room) if (arg == "player") then dxDrawRectangle(x,y,22,20,tocolor(0,0,0,130)); local color = tocolor(255,255,255,255); if (v == g_Me) then color = tocolor(100,180,255,255); end dxDrawText(k,x+5,y,0,0,color,1,"default-bold","left","top",false,false,false,true); dxDrawText(getPlayerName(v):gsub("#%x%x%x%x%x%x", ""),x+31,y+1,1,1,tocolor(0,0,0,200),1,"default-bold","left","top",false,false,false,true); dxDrawText(getPlayerName(v),x+30,y,0,0,tocolor(255,255,255,255),1,"default-bold","left","top",false,false,false,true); if (room ~= "lobby") then if (room == "dm") then dxDrawText(getElementData(v,"State") or "Not ready",x+166,y+1,1,1,tocolor(0,0,0,200),1,"default-bold","left","top",false,false,false,true); dxDrawText(getElementData(v,"State") or "Not ready",x+165,y,0,0,tocolor(255,255,255,255),1,"default-bold","left","top",false,false,false,true); dxDrawText(getElementData(v,"Map"):sub(1,50) or "No map",x+230,y+1,1,1,tocolor(0,0,0,200),1,"default-bold","left","top",false,false,false,true); dxDrawText(getElementData(v,"Map"):sub(1,50) or "No map",x+230,y,0,0,tocolor(255,255,255,255),1,"default-bold","left","top",false,false,false,true); else dxDrawText(getElementData(v,"Map") or "No map",x+166,y+1,1,1,tocolor(0,0,0,200),1,"default-bold","left","top",false,false,false,true); dxDrawText(getElementData(v,"Map") or "No map",x+165,y,0,0,tocolor(255,255,255,255),1,"default-bold","left","top",false,false,false,true); end end if getElementData(v,"Country") then dxDrawText(getElementData(v,"Country"):upper(),x+626,y+1,1,1,tocolor(0,0,0,200),1,"default-bold","left","top",false,false,false,true); dxDrawText(getElementData(v,"Country"):upper(),x+625,y,0,0,tocolor(255,255,255,255),1,"default-bold","left","top",false,false,false,true); dxDrawImage(x+605,y+1, 17, 13, ":admin/client/images/flags/"..getElementData(v,"Country"):lower()..".png") else dxDrawText("?",x+605,y,0,0,tocolor(255,255,255,255),1,"default-bold","left","top",false,false,false,true); end dxDrawText(getElementData(v,"FPS") or math.random(40,44),x+661,y+1,1,1,tocolor(0,0,0,200),1,"default-bold","left","top",false,false,false,true); dxDrawText(getElementData(v,"FPS") or math.random(40,44),x+660,y,0,0,tocolor(255,255,255,255),1,"default-bold","left","top",false,false,false,true); dxDrawText(getPlayerPing(v),x+691,y+1,1,1,tocolor(0,0,0,200),1,"default-bold","left","top",false,false,false,true); dxDrawText(getPlayerPing(v),x+690,y,0,0,tocolor(255,255,255,255),1,"default-bold","left","top",false,false,false,true); elseif (arg == "hunterinfo") then dxDrawRectangle(x,y,anim_x*2,20,tocolor(10,10,10,255)); dxDrawText("ID",x+5,y,0,0,tocolor(140,140,140,255),1,"default-bold"); dxDrawText("Name",x+30,y,0,0,tocolor(140,140,140,255),1,"default-bold"); dxDrawText("Map",x+165,y,0,0,tocolor(140,140,140,255),1,"default-bold"); dxDrawText("Country",x+605,y,0,0,tocolor(140,140,140,255),1,"default-bold"); dxDrawText("FPS",x+660,y,0,0,tocolor(140,140,140,255),1,"default-bold"); dxDrawText("Ping",x+690,y,0,0,tocolor(140,140,140,255),1,"default-bold"); elseif (arg == "traininginfo") then dxDrawRectangle(x,y,anim_x*2,20,tocolor(10,10,10,255)); dxDrawText("ID",x+5,y,0,0,tocolor(140,140,140,255),1,"default-bold"); dxDrawText("Name",x+30,y,0,0,tocolor(140,140,140,255),1,"default-bold"); dxDrawText("Map",x+165,y,0,0,tocolor(140,140,140,255),1,"default-bold"); dxDrawText("Country",x+605,y,0,0,tocolor(140,140,140,255),1,"default-bold"); dxDrawText("FPS",x+660,y,0,0,tocolor(140,140,140,255),1,"default-bold"); dxDrawText("Ping",x+690,y,0,0,tocolor(140,140,140,255),1,"default-bold"); elseif (arg == "dminfo") then dxDrawRectangle(x,y,anim_x*2,20,tocolor(10,10,10,255)); dxDrawText("ID",x+5,y,0,0,tocolor(140,140,140,255),1,"default-bold"); dxDrawText("Name",x+30,y,0,0,tocolor(140,140,140,255),1,"default-bold"); dxDrawText("State",x+165,y,0,0,tocolor(140,140,140,255),1,"default-bold"); dxDrawText("Map",x+230,y,0,0,tocolor(140,140,140,255),1,"default-bold"); dxDrawText("Country",x+605,y,0,0,tocolor(140,140,140,255),1,"default-bold"); dxDrawText("FPS",x+660,y,0,0,tocolor(140,140,140,255),1,"default-bold"); dxDrawText("Ping",x+690,y,0,0,tocolor(140,140,140,255),1,"default-bold"); elseif (arg == "lobbyinfo") then dxDrawRectangle(x,y,anim_x*2,20,tocolor(10,10,10,255)); dxDrawText("ID",x+5,y,0,0,tocolor(140,140,140,255),1,"default-bold"); dxDrawText("Name",x+30,y,0,0,tocolor(140,140,140,255),1,"default-bold"); dxDrawText("Country",x+605,y,0,0,tocolor(140,140,140,255),1,"default-bold"); dxDrawText("FPS",x+660,y,0,0,tocolor(140,140,140,255),1,"default-bold"); dxDrawText("Ping",x+690,y,0,0,tocolor(140,140,140,255),1,"default-bold"); elseif (arg == "team") then dxDrawRectangle(x,y,anim_x*2,20,tocolor(15,15,15,200)); dxDrawText(v,x+5,y,0,0,tocolor(220,220,220,255),1,"default-bold"); else dxDrawRectangle(x,y,anim_x*2,20,tocolor(10,10,10,255)); dxDrawText(arg,0,y,scrX,0,tocolor(220,220,220,255),1,"default-bold","center"); end end local drawList = {}; drawList[1] = {false,false,""}; --hunter drawList[2] = {false,false,"hunterinfo"}; local teamPlayersA = {}; --//modsH local teamPlayersB = {}; --//adminsH local teamPlayersAT = {}; --//modsTraining local teamPlayersBT = {}; --//adminsTraining local teamPlayersAD = {}; --//modsDM local teamPlayersBD = {}; --//adminsDM local teamPlayersAM = {}; --//modsDD local teamPlayersBM = {}; --//adminsDD local teamPlayersAO = {}; --//modsOS local teamPlayersBO = {}; --//adminsOS local TrainingPlayers = {}; local DMPlayers = {}; local DDPlayers = {}; local OSPlayers = {}; local LobbyPlayers = {}; for k,v in ipairs(players) do if isElement(v) then local room = getElementData(v,"room"); if room then local team = getPlayerTeam(v); if team then if (getTeamName(team) == "Admins") then if (room == 1) then teamPlayersB[#teamPlayersB+1] = {v,k}; elseif (room == 2) then teamPlayersBT[#teamPlayersBT+1] = {v,k}; elseif (room == 4) then teamPlayersBD[#teamPlayersBD+1] = {v,k}; elseif (room == 5) then teamPlayersBM[#teamPlayersBM+1] = {v,k}; elseif (room == 6) then teamPlayersBO[#teamPlayersBO+1] = {v,k}; end else if (room == 1) then teamPlayersA[#teamPlayersA+1] = {v,k}; elseif (room == 2) then teamPlayersAT[#teamPlayersAT+1] = {v,k}; elseif (room == 4) then teamPlayersAD[#teamPlayersAD+1] = {v,k}; elseif (room == 5) then teamPlayersAM[#teamPlayersAM+1] = {v,k}; elseif (room == 6) then teamPlayersAO[#teamPlayersAO+1] = {v,k}; end end else if (room == 1) then drawList[#drawList+1] = {v,k}; elseif (room == 2) then TrainingPlayers[#TrainingPlayers+1] = {v,k}; elseif (room == 4) then DMPlayers[#DMPlayers+1] = {v,k}; elseif (room == 5) then DDPlayers[#DDPlayers+1] = {v,k}; elseif (room == 6) then OSPlayers[#OSPlayers+1] = {v,k}; end end else LobbyPlayers[#LobbyPlayers+1] = {v,k}; end else triggerServerEvent("gpl",getLocalPlayer()); end end drawList[1] = {false,false,"Hunter (Players: "..(#drawList-2)..")"}; drawList[#drawList+1] = {"team","Moderator(s) | Players: ("..#teamPlayersA..")"}; for k,v in ipairs(teamPlayersA) do drawList[#drawList+1] = {v[1],v[2]}; end drawList[#drawList+1] = {"team","Administrator(s) | Players: ("..#teamPlayersB..")"}; for k,v in ipairs(teamPlayersB) do drawList[#drawList+1] = {v[1],v[2]}; end --//TRAINING drawList[#drawList+1] = {false,false,"Training (Players: "..#TrainingPlayers + #teamPlayersBT + #teamPlayersAT..")"}; drawList[#drawList+1] = {false,false,"traininginfo"}; for k,v in ipairs(TrainingPlayers) do drawList[#drawList+1] = {v[1],v[2]}; end drawList[#drawList+1] = {"team","Moderator(s) | Players: ("..#teamPlayersAT..")"}; for k,v in ipairs(teamPlayersAT) do drawList[#drawList+1] = {v[1],v[2]}; end drawList[#drawList+1] = {"team","Administrator(s) | Players: ("..#teamPlayersBT..")"}; for k,v in ipairs(teamPlayersBT) do drawList[#drawList+1] = {v[1],v[2]}; end --//DEATHMATCH drawList[#drawList+1] = {false,false,"Deathmatch (Players: "..#DMPlayers + #teamPlayersBD + #teamPlayersAD..")"}; drawList[#drawList+1] = {false,false,"dminfo"}; for k,v in ipairs(DMPlayers) do drawList[#drawList+1] = {v[1],v[2]}; end drawList[#drawList+1] = {"team","Moderator(s) | Players: ("..#teamPlayersAD..")"}; for k,v in ipairs(teamPlayersAD) do drawList[#drawList+1] = {v[1],v[2]}; end drawList[#drawList+1] = {"team","Administrator(s) | Players: ("..#teamPlayersBD..")"}; for k,v in ipairs(teamPlayersBD) do drawList[#drawList+1] = {v[1],v[2]}; end --//DERBY drawList[#drawList+1] = {false,false,"Destruction Derby (Players: "..#DDPlayers + #teamPlayersBM + #teamPlayersAM..")"}; drawList[#drawList+1] = {false,false,"dminfo"}; for k,v in ipairs(DDPlayers) do drawList[#drawList+1] = {v[1],v[2],"dm"}; end drawList[#drawList+1] = {"team","Moderator(s) | Players: ("..#teamPlayersAM..")"};
  3. Hey everyone, I have a small question for you guys, which I just can't find. the rankingboard should normally show the colorcodes of the player that died, but it doesn't it's just white. client: local sx,sy = guiGetScreenSize() RankingBoard = {} RankingBoard.__index = RankingBoard RankingBoard.instances = {} local screenWidth, screenHeight = guiGetScreenSize() local topDistance = screenHeight-19*11 local bottomDistance = screenHeight-19*11 local posLeftDistance = screenWidth-120 local nameLeftDistance = 60 local labelHeight = 19 local maxPositions = 11 local rankingBoardEnabled = true posLabel = {} playerLabel = {} alphaElem = {} colorElem = {} biggestLabelWidth = 0 function resetRankingboard () for id, elem in pairs(posLabel) do setElementData(elem,"PlayerIsOffline",false) setElementData(elem,"spectated",false) end for i, val in ipairs(spectators) do table.remove(spectators, i) end for id, elem in pairs(posLabel) do setElementData(elem,"afkresult",false) end posLabel = {} playerLabel = {} spectators = {} alphaElem = {} colorElem = {} biggestLabelWidth = 0 end addEvent("onClientMapStopping",true) addEventHandler ( "onClientMapStopping", getRootElement(), resetRankingboard ) function resetSpectators () for i, val in ipairs(spectators) do table.remove(spectators, i) end for id, elem in pairs(posLabel) do setElementData(elem,"spectated",false) end spectators = {} end addEvent("onClientPlayerWasted",true) addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), resetSpectators ) function RankingBoard.create(id) RankingBoard.instances[id] = setmetatable({ id = id, direction = 'down', labels = {}, position = 0 }, RankingBoard) posLabel = {} playerLabel = {} end function RankingBoard.call(id, fn, ...) RankingBoard[fn](RankingBoard.instances[id], ...) end function RankingBoard:setDirection(direction, plrs) self.direction = direction if direction == 'up' then self.highestPos = plrs--#g_Players self.position = self.highestPos + 1 end end function RankingBoard:add(name, time) local position local y local doBoardScroll = false if self.direction == 'down' then self.position = self.position + 1 if self.position > maxPositions then return end y = topDistance + (self.position-1)*labelHeight elseif self.direction == 'up' then self.position = self.position - 1 local labelPosition = self.position if self.highestPos > maxPositions then labelPosition = labelPosition - (self.highestPos - maxPositions) if labelPosition < 1 then labelPosition = 0 doBoardScroll = true end elseif labelPosition < 1 then return end y = topDistance + (labelPosition-1)*labelHeight end posLabel[name], posLabelShadow = createShadowedLabelFromSpare(nameLeftDistance, y, 20, labelHeight, tostring(self.position) .. '.', 'right') if time then if not self.firsttime then self.firsttime = time time = ': ' .. msToTimeStr(time) else time = ': +' .. msToTimeStr(time - self.firsttime) end else time = '' end time = "" playerLabel[name], playerLabelShadow = createShadowedLabelFromSpare(nameLeftDistance, y, 250, labelHeight, "#FFFFFF"..name) table.insert(self.labels, posLabel[name]) table.insert(self.labels, posLabelShadow) table.insert(self.labels, playerLabel[name]) table.insert(self.labels, playerLabelShadow) alphaElem[playerLabel[name]] = 0 alphaElem[posLabel[name]] = 0 colorElem[playerLabel[name]] = {30,30,30} playSoundFrontEnd(7) guiSetAlpha(posLabel[name], 0) guiSetAlpha(posLabelShadow, 0) guiSetAlpha(playerLabel[name], 0) guiSetAlpha(playerLabelShadow, 0) if doBoardScroll then local anim = Animation.createNamed('race.boardscroll', self) anim:addPhase({ from = 0, to = 1, time = 500, fn = RankingBoard.scroll, firstLabel = posLabel[name] }) anim:addPhase({ fn = RankingBoard.destroyLastLabel, firstLabel = posLabel[name] }) anim:play() end for id, elem in pairs(playerLabel) do local widthRezise1 = dxGetTextWidth(string.gsub( guiGetText(elem), '#%x%x%x%x%x%x', '' ),1.1,"default-bold") if widthRezise1 > biggestLabelWidth then biggestLabelWidth = widthRezise1 posLeftDistance = screenWidth-biggestLabelWidth end end end function RankingBoard:scroll(param, phase) local firstLabelIndex = table.find(self.labels, phase.firstLabel) for i=firstLabelIndex,firstLabelIndex+3 do guiSetAlpha(self.labels[i], param) end local x, y for i=0,#self.labels/4-1 do for j=1,4 do x = (j <= 2 and posLeftDistance or nameLeftDistance) y = topDistance + ((maxPositions - i - 1) + param)*labelHeight if j % 2 == 0 then x = x + 1 y = y + 1 end guiSetPosition(self.labels[i*4+j], sx + x, y, false) end end for i=1,4 do guiSetAlpha(self.labels[i], 1 - param) end end function RankingBoard:destroyLastLabel(phase) for i=1,4 do destroyElementToSpare(self.labels[1]) guiSetVisible(self.labels[1],false) table.remove(self.labels, 1) end local firstLabelIndex = table.find(self.labels, phase.firstLabel) for i=firstLabelIndex,firstLabelIndex+3 do guiSetAlpha(self.labels[i], 1) end end function RankingBoard:addMultiple(items) for i,item in ipairs(items) do self:add(item.name, item.time) end end function testing (c,name) RankingBoard:add(name) end --addCommandHandler("addt",testing) function RankingBoard:clear() table.each(self.labels, destroyElementToSpare) self.labels = {} end function RankingBoard:destroy() self:clear() RankingBoard.instances[self.id] = nil end function isPlayerOnline (name) for i,sPlayer in ipairs(getElementsByType"player") do if getPlayerName(sPlayer) == name then playerIsOnline = true else playerIsOnline = false end end return playerIsOnline end function RankingBoardAddQuit(playername) setTimer( function () for id, elem in pairs(posLabel) do if id == playername then setElementData(elem,"PlayerIsOffline",true) end end end,500,1) end addEvent("addQuitPlayerToGUI",true) addEventHandler("addQuitPlayerToGUI",getLocalPlayer(),RankingBoardAddQuit) function RankingBoardAddJoin(playername) setTimer( function () for id, elem in pairs(posLabel) do if id == playername then setElementData(elem,"PlayerIsOffline",false) end end end,250,1) end addEvent("addJoinPlayerToGUI",true) addEventHandler("addJoinPlayerToGUI",getLocalPlayer(),RankingBoardAddJoin) function RankingBoardAddAFK(playername) setTimer( function () for id, elem in pairs(posLabel) do if id == playername then setElementData(elem,"afkresult",true) end end end,250,1) end addEvent("onAFKKillResult",true) addEventHandler("onAFKKillResult",getRootElement(),RankingBoardAddAFK) function RankingBoardAddAFK(playername) setTimer( function () for id, elem in pairs(posLabel) do if id == playername then setElementData(elem,"afkresult",false) end
  4. Ty AcitanoX it works and ty binSlayer for your help
  5. @ binSlayer1 it is in it i just did'nt paste it here.. but here you got it: 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 ) dxDrawText ( getPlayerName(player), sx + 1, sy - offset + 1, sx + 1, sy - offset + 1, tocolor(0,0,0,255), textscale*NAMETAG_TEXTSIZE, "bankgothic", "center", "bottom", false, false, false ) dxDrawColorText( getPlayerName(player,true), sx, sy - offset, sx, sy - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE, 'bankgothic', 'center', 'bottom' ) --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(178,178,178,0.4*alpha) ) --Finally, the actual health dxDrawRectangle ( drawX + outlineThickness, drawY + outlineThickness, health*(width - outlineThickness*2), height - outlineThickness*2, tocolor(r,g,b,alpha) ) end break end end end ) function dxDrawColorText(str, ax, ay, bx, by, color, scale, font, alignX, alignY) if alignX then if alignX == "center" then local w = dxGetTextWidth(str:gsub("#%x%x%x%x%x%x",""), scale, font) ax = ax + (bx-ax)/2 - w/2 elseif alignX == "right" then local w = dxGetTextWidth(str:gsub("#%x%x%x%x%x%x",""), scale, font) ax = bx - w end end if alignY then if alignY == "center" then local h = dxGetFontHeight(scale, font) ay = ay + (by-ay)/2 - h/2 elseif alignY == "bottom" then local h = dxGetFontHeight(scale, font) ay = by - h end end local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find(pat, 1) local last = 1 while s do if cap == "" and col then color = tocolor(tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)), 255) end if s ~= 1 or cap ~= "" then local w = dxGetTextWidth(cap, scale, font) dxDrawText(cap, ax, ay, ax + w, by, color, scale, font) ax = ax + w color = tocolor(tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)), 255) end last = e + 1 s, e, cap, col = str:find(pat, last) end if last <= #str then cap = str:sub(last) local w = dxGetTextWidth(cap, scale, font) dxDrawText(cap, ax, ay, ax + w, by, color, scale, font) end end
  6. Ok i really don't know what the problem is so here I go I tried, and i tried to create colorcoded namtags but no mather what it still remains white. Please help finding out what the problem is 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 ) dxDrawText ( getPlayerName(player), sx + 1, sy - offset + 1, sx + 1, sy - offset + 1, tocolor(0,0,0,255), textscale*NAMETAG_TEXTSIZE, "bankgothic", "center", "bottom", false, false, false ) dxDrawColorText( getPlayerName(player,true), sx, sy - offset, sx, sy - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE, 'bankgothic', 'center', 'bottom' ) --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(178,178,178,0.4*alpha) ) --Finally, the actual health dxDrawRectangle ( drawX + outlineThickness, drawY + outlineThickness, health*(width - outlineThickness*2), height - outlineThickness*2, tocolor(r,g,b,alpha) ) end break end end end )
  7. Hey everyone, I try to delete this deathlist ( circled below in the picture ) but i can't find where it is located. So if anybody knows where it is located tell me http://imageshack.us/photo/my-images/808/probsd.png/ Thanks in advance
  8. Ah ok but they used it in 1.0.5 so how did they do it then?
  9. hey everyone i have a question: how is this guiElement called:
  10. lol you should create a client.lua: with GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Window[1] = guiCreateWindow(782,176,240,493,"Alarm Menu",false) guiWindowSetMovable(GUIEditor_Window[1],true) guiWindowSetSizable(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[1],false) GUIEditor_Button[1] = guiCreateButton(22,56,196,55,"Nekluaralarm !",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(22,128,198,56,"Sturmwarnung",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(23,201,197,55,"Großalarm",false,GUIEditor_Window[1]) GUIEditor_Button[4] = guiCreateButton(22,274,198,56,"Feuer",false,GUIEditor_Window[1]) GUIEditor_Button[5] = guiCreateButton(22,344,199,57,"Freie Fahrt",false,GUIEditor_Window[1]) GUIEditor_Button[6] = guiCreateButton(131,425,87,38,"Abbruch",false,GUIEditor_Window[1]) GUIEditor_Button[7] = guiCreateButton(24,425,86,38,"Info (Chatbox)",false,GUIEditor_Window[1]) showCursor(false) bindKey("F5","down",function () showCursor(not isCursorShowing()) guiSetVisible(GUIEditor_Window[1], not guiGetVisible(GUIEditor_Window[1])) end) function buttonClicks() if (source == GUIEditor_Button[1]) then outputChatBox("Achtung! Eine Nekluarwarnung wurde ausgegeben, bitte alle zur Zentrale!\nBitte alle zur Bereitschaft zur Zentrale!", 126, 0, 0) triggerServerEvent("sendSound",getLocalPlayer(),"Nekluaralarm.mp3",false) elseif (source == GUIEditor_Button[2]) then outputChatBox("Achtung! Eine Sturmwarnug wurde ausgegeben, bitte alle zur Bereitschaft in die Zentrale", 126, 0, 0) triggerServerEvent("sendSound",getLocalPlayer(),"tornadoalarm.mp3",true) elseif (source == GUIEditor_Button[3]) then outputChatBox("Großalarm! Alle Einheiten sofort zur Zentrale", 126, 0, 0) triggerServerEvent("sendSound",getLocalPlayer(),"Grossalarm.mp3",false) elseif (source == GUIEditor_Button[4]) then outputChatBox("Einsatz! Achtung es wurde ein Feuer gemeldet, bitte alle ur Zentrale!", 126, 0, 0) triggerServerEvent("sendSound",getLocalPlayer(),"nma.mp3",false) elseif (source == GUIEditor_Button[5]) then outputChatBox("Es liegt zurzeit kein Einsatz vor!", 126, 0, 0) elseif (source == GUIEditor_Button[6]) then guiSetVisible(GUIEditor_Window[1],false) showCursor(false) elseif (source == GUIEditor_Button[7]) then outputChatBox("Infos: Bitte nur die Alarme auslösen auf den die Meldung zutrifft!\nBei missachtung kann es zum rausschmiss aus der Feuerwehr führen!\nBei freier Fahrt wird kein Alarm ausgelößt!") end end addEventHandler("onClientGUIClick",getRootElement(),buttonClicks) addEvent("returnSound",true) addEventHandler("returnSound",getRootElement(), function (sound,bool) playSound(tostring(sound),bool) end) and you should make a server.lua with: addEvent("sendSound",true) addEventHandler("sendSound",getRootElement(), function (sound, bool) triggerClientEvent("returnSound",getRootElement(),sound,bool) end) and i meta.xml you should write: < script src="client.lua" type="client" /> < script src="server.lua" type="server" /> and since you work with sounds you should also have < file src="YourSound.mp3" />
  11. Ow yea ofcourse thanks Sometimes i can be so stupid
  12. Hello guys, When i press f7 you enter in the userpanel well i tried to make dxDrawings (retangle, and bar,) but when i press f7 they only pop up 1 second and then dissapear. ( the panel stays ) Please help me. The script bindKey("F7", "down", function() if acc[player] == 1 then if not guiGetVisible(UserP) then guiSetVisible(UserP, true) guiSetVisible(Stats, true) guiSetVisible(StatsTab, true) ------- This Just Draws 1 second dxDrawRectangle(0, 0, ScreenX-SizeDraw, ScreenY-LenghtY*2, tocolor(0,0,0,100), false) ------- This Also dxDrawRectangle(ScreenX-SizeDraw, LenghtY*4, ScreenX, ScreenY-LenghtY*6, tocolor(0,0,0,100), false) ------- This Also dxDrawImage(0, ScreenY-LenghtY, ScreenX, LenghtY, "files/bar.png",0,0,0,tocolor(255,255,255,255), true ) guiSetInputEnabled(true) showCursor(true) guiSetSelectedTab(Stats, StatsTab) guiSetText(StatsText, removeColorCodingEx(getPlayerName(player)).. " his/her stats:") if PPlayed[player] then guiSetText(PMaps, "You played " ..tostring(PPlayed[player]).. " maps.") end if PWins[player] then guiSetText(Wins, "You won " ..tostring(PWins[player]).. " times.") end if PWins[player] then guiSetText(Ratio, "Your Ratio is: "..tostring(math.floor(PWins[player]/PPlayed[player]*100)).. "%") end if PDeaths[player] then guiSetText(Deaths, "You died "..tostring(PDeaths[player]).. " times.") end guiSetText(Visits, "You visited the server "..tostring(PVisits[player]).." times.") guiSetText(Money, "You have $"..tostring(getPlayerMoney(getLocalPlayer()))..".") -- Flip if TotalFlips[player] then guiSetText(TFlips, "You flipped: "..tostring(TotalFlips[player]).." times.") end if WonFlip[player] then guiSetText(WFlips, "You won: "..tostring(WonFlip[player]).." times.") end if WonFlip[player] then guiSetText(FRatio, "Your ratio is: "..tostring(WonFlip[player]/TotalFlips[player]*100).. "%") end if SpenMoneyFlip[player] then guiSetText(SMoneyFlips, "You spended $"..tostring(SpenMoneyFlip[player]).." on flipping.") end if WonMoneyFlip[player] then guiSetText(WMoneyFlips, "You won $"..tostring(WonMoneyFlip[player]).." with flipping.") end -- Roll if TotalRolls[player] then guiSetText(TRolls, "You rolled: "..tostring(TotalRolls[player]).." times.") end if WonRoll[player] then guiSetText(WRolls, "You won: "..tostring(WonRoll[player]).." times.") end if WonRoll[player] then guiSetText(RRatio, "Your ratio is: "..tostring(WonRoll[player]/TotalRolls[player]*100).."%") end if SpenMoneyRoll[player] then guiSetText(SMoneyRolls, "You spended $"..tostring(SpenMoneyRoll[player]).." on rolling.") end if WonMoneyRoll[player] then guiSetText(WMoneyRolls, "You won $"..tostring(WonMoneyRoll[player]).." with rolling.") end -- Spin if TotalSpins[player] then guiSetText(TSpins, "You spinned: "..tostring(TotalSpins[player]).." times.") end if WonSpin[player] then guiSetText(WSpins, "You won: "..tostring(WonSpins[player]).." times.") end if WonSpin[player] then guiSetText(SRatio, "Your ratio is: "..tostring(WonSpin[player]/TotalSpins[player]*100).."%") end if SpenMoneySpin[player] then guiSetText(SMoneySpins, "You spended $"..tostring(SpenMoneySpin[player]).." on spinning.") end if WonMoneySpin[player] then guiSetText(WMoneySpins, "You won $"..tostring(WonMoneySpin[player]).." with spinning.") end else guiSetVisible(UserP, false) guiSetVisible(Stats, false) guiSetVisible(StatsTab, false) guiSetVisible(ShopTab, false) guiSetInputEnabled(false) showCursor(false) end else outputChatBox("You must be #fffffflogged in #0000FFto use your userpanel!", 0, 0, 255,true) end end )
  13. Hey everyone i have a question I have a /br function ==> it repairs your vehicle when you press /br but it also repairs when the vehicle has 100% health my question: Is there a way to check the vehicles health because i didn't find the code on mta wiki. this means when a player types /br and his vehicle has 100% health it outputs in chatbox: Your vehicle doesn't need to be fixed. Thanks in advance
  14. Thanks man it works rly apreciate it
  15. Well i get this error login_server.lua:83: fileOpen; unable to load file THAT IS THE FUNCTION WHERE I GET THE ERROR Line 83 ==> local file = fileOpen( "logins.txt" ) function saveTheLogins( thePlayerName, theLogin ) if ( fileExists( "logins.txt" ) ) then local file = fileCreate( "logins.txt" ) if( file )then fileWrite( file, " The player "..thePlayerName.." have been registered with the login "..theLogin.."\r\n") fileClose( file ) end else local file = fileOpen( "logins.txt" ) if ( file ) then fileSetPos( file, fileGetSize( file ) ) fileWrite( file, " The player "..thePlayerName.." have been registered with the login "..theLogin.."\r\n" ) end end end
  16. Well now it shows when a player registers but when i am not online and someone registers i won't see their register nickname well is it possible to save there logins somewhere where i can see them
  17. @ Solidsnake14: No i don't want to see there passwords i only want to see their nicknames. @ Citizen: Well we have a site when a player when one of the leaders sends a private message to him that he can write an application then the leaders will decide if he can join or not so when we say YES you can join then i can see his login and so i can make him admin then here is the register code: client: function build_loginWin() confFile = xmlLoadFile("preferences.xml") if (confFile) then infoTable["account"] = xmlNodeGetAttribute(confFile,"username") infoTable["pass"] = xmlNodeGetAttribute(confFile,"pass") infoTable["save"] = xmlNodeGetAttribute(confFile,"save") else confFile = xmlCreateFile("preferences.xml","user") xmlNodeSetAttribute(confFile,"username","") xmlNodeSetAttribute(confFile,"pass","") xmlNodeSetAttribute(confFile,"save","false") infoTable["account"] = getPlayerName(localPlayer) infoTable["pass"] = "" infoTable["save"] = "false" end xmlSaveFile(confFile) ---- THIS IS NOT THE WHOLE CODE THE OTHER PART YOU DON'T NEED THAT IS THE GUI BUT IT IS SCRIPTED IN HERE ------ --REGISTER THE PLAYER function attemptToRegister(button, state) local username = guiGetText(Login_Edit[3]) local pass1 = guiGetText(Login_Edit[4]) local pass2 = guiGetText(Login_Edit[5]) if (guiCheckBoxGetSelected(Login_Check[1])) then if not (tostring(username) == "") then if not (tostring(pass1) == "") or not (tostring(pass1) == "") then if (pass1 == pass2) then showCursor(false,false) guiSetInputEnabled(false) triggerServerEvent("onClientSendRegisterDataToServer", getRootElement(), localPlayer, username, pass1) else reason = "The passwords do not match!" build_Warning(localPlayer, reason) end else reason = "No password was entered!" build_Warning(localPlayer, reason) end else reason = "No username was entered!" build_Warning(localPlayer, reason) end else reason = "You did not accept the rules!" build_Warning(localPlayer, reason) end end server: --REGISTER THE PLAYER function tryToRegsiterPlayer(player, username, pass) if not getAccount(username, pass) then theAccount = addAccount(username, pass) if (theAccount) then logIn(player, theAccount, pass) outputChatBox("* You successfully registered account '" ..username.. "' for player '" ..getPlayerName(player).. "' with password '" ..pass.."'!", player, 0, 255, 0, false) triggerClientEvent("onRegisterPlayWelcomeSound", player) triggerClientEvent("onPlayerFirstTimeSeen", player) triggerClientEvent("onPlayerDoneLogin", player) setTimer(triggerClientEvent, 3000, 1, "onPlayerPlayUEFASound", player, false) else reason = "The Account already exists!" triggerClientEvent("onServerWrongLoginRebuildLogin", root, player, reason) end else reason = "The Account already exists!" triggerClientEvent("onServerWrongLoginRebuildLogin", root, player, reason) end end addEvent("onClientSendRegisterDataToServer", true) addEventHandler("onClientSendRegisterDataToServer", getRootElement(), tryToRegsiterPlayer)
  18. yes i think, i want to be able to read there logins so when player becomes a member of our team i know his login.
  19. Ok so i use a login panel when player registers his account saves in preferences.xml this file will be created in mods so only the player who logged in can see his account and password is there a way that i can see those logins also?
  20. dont need help any more i fixed it
×
×
  • Create New...