iFoReX Posted February 28, 2013 Share Posted February 28, 2013 how i can get the lenght of players on colshape ? i try it but it doesnt work :l and how i can make a countdown start on 10:00 with tickcounts ? :l cl : hour = "10" minutes = "00" addEvent("features",true) addEventHandler("features",root,function() addEventHandler("onClientRender",root,features) end ) ultimavezdeejecucion= getTickCount() despues = getTickCount() function features() sWidth,sHeight = guiGetScreenSize() for i,v in ipairs(getElementsByType"player") do if getElementData(v,"enbase") == "dentro" then if minutes == "00" then hour = hour-1 minutes = 60 elseif hour == "00" then triggerServerEvent("basefinished",root) end if (getTickCount()-ultimavezdeejecucion) > 1000 then minutes = getTickCount()-ultimavezdeejecucion minutes = minutes-1 end dxDrawText(hour..":"..tostring(minutes),sWidth*0.900, sHeight*0.400, sWidth*0.100, sHeight*0.997,tocolor(255,255,255,255),1,"default-bold","left","top",false,false,false) for i,v in ipairs(getElementsByType"player") do local estatus = getElementData(v,"enbase") if estatus == "dentro" then if #v == 1 then dxDrawText(getPlayerName ( v ):gsub ( "#%x%x%x%x%x%x", "" ),sWidth*0.900, sHeight*0.600, sWidth*0.100, sHeight*0.997,tocolor(255,255,255,255),1,"default-bold","left","top",false,false,false) elseif #v == 2 then dxDrawText(getPlayerName ( v[1] ):gsub ( "#%x%x%x%x%x%x", "" ),sWidth*0.900, sHeight*0.600, sWidth*0.100, sHeight*0.997,tocolor(255,255,255,255),1,"default-bold","left","top",false,false,false) dxDrawText(getPlayerName ( v[2] ):gsub ( "#%x%x%x%x%x%x", "" ),sWidth*0.900, sHeight*0.600, sWidth*0.100, sHeight*0.997,tocolor(255,255,255,255),1,"default-bold","left","top",false,false,false) end end end end end end ultimavezdeejecucion = getTickCount() sv reward = math.random(10000,30000) addCommandHandler("startbase",function(playerSource) x,y,z = getElementPosition(playerSource) local zona = getElementZoneName(playerSource) outputChatBox("#ffffff"..getPlayerName(playerSource).."#00D111, Ha Iniciado Una Base",root,0,0,0,true) outputChatBox("#00D111Base Localizada en #FFFFFF"..zona.."",root,0,0,0,true) outputChatBox("#00D111Iniciara en 3 segundos..",root,0,0,0,true) setTimer( function() outputChatBox("#00D111Base Iniciada",root,0,0,0,true) area = createRadarArea ( x-50, y+50, 80, -80, 255, 0, 0, 175 ) safecol = createColCuboid ( x-50, y-30, z-2, 70, 70, 20 ) createBlipAttachedTo(area,25) setTimer(function() for i,v in ipairs(getElementsByType"player") do if isElementWithinColShape(v,safecol) then setElementData(v,"enbase","dentro",true) end end end ,500,1) for i,v in ipairs(getElementsByType"player") do if getElementData(v,"enbase") == "dentro" then outputChatBox("#FFFFFFRecompensa por matarte : "..reward.."",v,0,0,0,true) triggerClientEvent("features",root) end end end ,3000,1) end ) addEventHandler("onColShapeHit",root,function(hitElement,matchingDimension) if source == safecol then setElementData(hitElement,"bando","enemigo") for i,v in ipairs(getElementsByType"player") do if getElementData(v,"enbase") == "dentro" and not getElementData(hitElement,"enbase") == "dentro" then outputChatBox(getPlayerName(hitElement):gsub ( "#%x%x%x%x%x%x", "" ).." Ha entrado a la base",v,255,0,0) elseif getElementData(hitElement,"enbase") == "dentro" then outputChatBox("Haz vuelto a la base",hitElement,0,255,0) end end end end ) addEventHandler("onColShapeLeave",root,function(leaveElement,matchingDimension) if source == safecol then if getElementData(leaveElement,"enbase") == "dentro" then outputChatBox("Vuelve a la base en 15 segundos o perderas",leaveElement,255,0,0) end end end ) Link to comment
Castillo Posted February 28, 2013 Share Posted February 28, 2013 Use: getElementsWithinColShape Link to comment
iFoReX Posted February 28, 2013 Author Share Posted February 28, 2013 and what i can do for countdown start in 10:00 ? Link to comment
Anderl Posted February 28, 2013 Share Posted February 28, 2013 Use getTickCount and some basic math to convert milliseconds to minutes. Link to comment
iFoReX Posted February 28, 2013 Author Share Posted February 28, 2013 what u mean with some basic math ? :l Link to comment
Alexs Posted February 28, 2013 Share Posted February 28, 2013 what u mean with some basic math ? :l + - * / 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