Jump to content

Overkillz

Members
  • Posts

    545
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Overkillz

  1. It is defined, I just didn't post it .. for i,player in ipairs(arenaSrv.players) do arenaSrv.timers.cd2 = setTimer ( triggerClientEvent, 1000, 1, player,"onTestingCD",player,"2") arenaSrv.timers.cd1 = setTimer ( triggerClientEvent, 2000, 1, player,"onTestingCD",player,"1") arenaSrv.timers.cd0 = setTimer ( triggerClientEvent, 3000, 1, player,"onTestingCD",player,"GO!") end There is not a debugscript3 error. It is an issue with the table ... I would already realized about it ...
  2. It didn't work. I'm still not understanding why even a simpler code doesn't work. Check it out. It still printing those 3 timers in from the table. arenaSrv.timers.cd2 = setTimer ( triggerClientEvent, 1000, 1, player,"onTestingCD",player,"2") arenaSrv.timers.cd1 = setTimer ( triggerClientEvent, 2000, 1, player,"onTestingCD",player,"1") arenaSrv.timers.cd0 = setTimer ( triggerClientEvent, 3000, 1, player,"onTestingCD",player,"GO!") function destroyTimers() for i, theTimer in ipairs(arenaSrv.timers) do if isTimer(theTimer) then killTimer(theTimer) theTimer = nil end end iprint(arenaSrv.timers) end addCommandHandler("g",destroyTimers)
  3. Hello dear community. Today I'm having an issue storing some timers in a table and later kill them. I have tried several ways to reach my goal, but it doesn't work at all. My goal is to delete all the timers in a row without using a vairable and later add it on a table. Just using a similar way to the following one Note: I already note that a table with a name like this: tableName["Whatever"] is a personal table. But as I told before, I want to use a similar way to delete all the timers or get them from the table arenaSrv.timers. And no, I won't use getTimers() to delete the whole timers. function resetArenaTimer(timerName) if isTimer(arenaSrv.timers[timerName]) then killTimer(arenaSrv.timers[timerName]) arenaSrv.timers[timerName] = nil end end if not arenaSrv.timers["readyWarn"] then arenaSrv.timers["readyWarn"] = setTimer(resetArenaTimer,15000,1,arenaSrv.timers["readyWarn"]) end -- If all the players are ready before the 15 seconds then kill the timer resetArenaTimer(arenaSrv.timers["readyWarn"]) -- Lets add 3 timers arenaSrv.timers["Countdown2"] = setTimer ( triggerClientEvent, 1000, 1, player,"onTestingCD",player,"2") arenaSrv.timers["Countdown1"] = setTimer ( triggerClientEvent, 2000, 1, player,"onTestingCD",player,"1") arenaSrv.timers["Countdown0"] = setTimer ( triggerClientEvent, 3000, 1, player,"onTestingCD",player,"GO!") function clearTimersTable() --THIS FUNCTION IS EXECUTED BY A COMMAND BUT I DIDNT PUT IT for i, timer in ipairs(arenaSrv.timers) do resetArenaTimer(timer) end end Thanks for reading. Regards.
  4. And the key ? bindKey ( player thePlayer, string key, string keyState, function handlerFunction, [ var arguments, ... ] )
  5. In fact, u can rotate it. Just play with the axes.
  6. local team = getPlayerTeam(player) if team then if getTeamName(team) ~= "Polisss" then --Your code to make it visible end end
  7. Sorry, currentHealth variable is defined rightly. I just did the code again and I forgot to add math.max Respecting the shaders. Why should I put the shaders 255,255,255 ? It depends of the shader file and how it is coded or im wrong ? Regards.
  8. Hello dear community. Im currently trying to create multiple shaders using the same file. In fact they are created but with the same values. For example. To the second shader I set it a different colour but when I draw it, practically has the same value as the first one. Other issue is that sometimes one of the both shaders isn't draw. I can't really remember why because I have tested it few days ago. Anyways, the goal of this topic is that you could help me to fix it or give me some tips to reach the goal. currentHealth = 0 currentNos = 0 function startDrawing() dxDrawImage( 100, 350, 300, 300, myShader,0,0,0,tocolor(40,220,40,255) ) dxDrawImage( 450, 350, 300, 300, myShader2,0,0,0,tocolor(255,0,0,255) ) local theVehicle = getPedOccupiedVehicle(localPlayer) if theVehicle then local theHealth = getElementHealth(theVehicle) or 0 local theNos = getVehicleNitroLevel(theVehicle) or 0 currentHealth = (theHealth-250)/750 currentNos = theNos else currentHealth = 0 currentNos = 0 end dxSetShaderValue( myShader, "degrees", currentHealth*180 ) dxSetShaderValue( myShader2, "degrees", (currentNos*180) ) end function startShadeing() myShader = dxCreateShader( "ring/Circle.fx" ) --Health myShader2 = dxCreateShader( "ring/Circle.fx" ) --Nos myTexture = dxCreateTexture( "ring/emptyCircle.png" ) dxSetShaderValue( myShader, "tex", myTexture ) dxSetShaderValue( myShader2, "tex", myTexture ) dxSetShaderTransform(myShader2,180,180,0) dxSetShaderValue(myShader, "rgba", 0/255, 255/255, 40/255,1) dxSetShaderValue(myShader2, "rgba", 0/255, 40/255, 220/255,1) addEventHandler("onClientRender",root,startDrawing) end addEventHandler("onClientResourceStart",resourceRoot,startShadeing) Thanks for reading, best regards.
  9. EDIT: Issue fixed. It was the unfreeze function on clientside instead serverside. Thanks for ur help. Im using setCameraTarget Yes, here it is. Btw, the issue shouldn't be on the camera target. It must be on the spawning player, vehicle or soemthing like that due to I see the rest of players too lag. function spectateSomeoneC() for i,player in ipairs(cArenaPlayers) do if getElementData(player,"state") == "alive" then setCameraTarget(player) local cam = getCamera() local myDim = getElementData(localPlayer,"aDimension") setElementDimension(cam,myDim) return end end end addEvent( "onClientSpectateSomeone", true ) addEventHandler( "onClientSpectateSomeone", getRootElement(), spectateSomeoneC) And here it is my spawning player and vehicle function function spawnPlayerInVehicle(thePlayer) if thePlayer then local rSpawn = math.random(1,#arenaSpawns) local v,x,y,z,rz = unpack(arenaSpawns[rSpawn]) local pDimension = getElementData(thePlayer,"aDimension") spawnPlayer ( thePlayer, 0, 0, 5, 90, 0,0,pDimension ) myVehicle = createVehicle(v,x,y,z,0,0,rz) setElementDimension(thePlayer,pDimension) setElementDimension(myVehicle,pDimension) setElementInterior(thePlayer,0) setElementInterior(myVehicle,0) setElementFrozen(myVehicle,true) warpPedIntoVehicle ( thePlayer, myVehicle ) setCameraTarget(thePlayer) end end Btw, vehicle is unfrozen clientside. I don't know if this can affect to it. Regards.
  10. I tried making the spectating on both sides Client and server and I get the same result. I did it and Im still geting the same issue. Regards,
  11. I won't do undo my old function due to It is managed by other scripts too so I tried to implement your's one with mine one. Sadly I didn't get the solution Look, it is still not working function updatePlayersInArena() arenaPlayers = {} local players = getElementsByType("player") for i,player in ipairs(players) do if getElementData(player,"arenaTag") then table.insert(arenaPlayers,player) end end if #arenaPlayers < 1 or not arenaPlayers then outputChatBox("Arena is empty, setting default state") setRaceState("none") end end function playerLeavingServer() for id,player in ipairs(arenaPlayers) do if player == source then table.remove(arenaPlayers,id) end end updatePlayersInArena() end addEventHandler( "onPlayerQuit", getRootElement(), playerLeavingServer)
  12. Thats exactly what I mean. However, i think that Im going to change the way of adding players to if not arenaPlayer [thePlayer] then arenaPlayer [thePlayer] = true end And when the player stay in the arena and leaves the server arenaPlayer [thePlayer] = nil If you know another way which is similar to the first one commented, just leave an answer. Im not adding any player because the function shouldnt add any player if there is not anyone on the server. And the table.insert is before the check players in table condition. Thanls and regards.
  13. Hey dear community, today Im having a little issue when the player leave the server. Well, Im currently updating the players in a table when they join the arena, leave and quit. Well, the issue is when the arena is empty, I want to set a status but it doesn't work setRaceState function only changes the value of a variable, but it doesn't work. When I join and check the variable value with a different custom function it drops me the old one and not "none" as it should be due to the arenaPlayers table is 0. I don't know if you have gotten me at all, but I hope you can bring me a tip to fix it. function updatePlayersInArena() arenaPlayers = {} local players = getElementsByType("player") for i,player in ipairs(players) do if getElementData(player,"arenaTag") then table.insert(arenaPlayers,player) end end if #arenaPlayers <= 0 then outputChatBox("Arena is empty, setting default state") setRaceState("none") end end addEventHandler( "onPlayerQuit", getRootElement(), updatePlayersInArena) Best regards.
  14. Overkillz

    Hide the HUD

    Aqui tienes un codigo mas corto. Dado que el tuyo problamente te de errores. local showingHud = true -- AQUIT CAMBIALO POR 'false' si quieres que si/no se muestre desde el principio function toggleHUD() showingHud = not showingHud if showingHud then showChat(true) setPlayerHudComponentVisible ( "all", true ) outputChatBox("HUD Enabled") else showChat(false) setPlayerHudComponentVisible ( "all", false ) outputChatBox("HUD Disabled") end end bindKey("f5","down",toggleHUD)
  15. As MisterQuestions said you can follow his way, however, if u are going to draw text over the rectangle. Probabilly you will need to conver the size of the font on different resolutions. So, I recomend you to create a scaleConverter function. In my opinion is the best option because you only will need to muliply the sizes by the scale that returns your custom function. Regards.
  16. Well, when the players and the car is created I have set them the same dimension 11 and the same interior(0) The 3rd player you see on the video isn't in the arena. Objects are created in the same dimension (11) - Outputting Vehicle Dim and Players Dim Code function sayPVdIM() local players = getElementsByType("player") for i,player in ipairs(players) do local pName = getPlayerName(player) local pDimension = getElementDimension(player) local vehicle = getPedOccupiedVehicle(player) if vehicle then local vDim = getElementDimension(vehicle) outputChatBox(pName.."#ffffff Dim:"..pDimension.." | Vehicle Dim: "..vDim) else outputChatBox(pName.."#ffffff Dim:"..pDimension.." | Vehicle Dim: none") end end end - Spawning player in Vehicle Code function spawnPlayerInVehicle(thePlayer) if thePlayer then local rSpawn = math.random(1,#arenaSpawns) local v,x,y,z,rz = unpack(arenaSpawns[rSpawn]) local pDimension = getElementData(thePlayer,"aDimension") spawnPlayer ( thePlayer, 0.0, 0.0, 5, 90, 0,0,pDimension ) myVehicle = createVehicle(v,x,y,z,0,0,rz) setElementDimension(thePlayer,pDimension) setElementDimension(myVehicle,pDimension) setElementInterior(thePlayer,0) setElementInterior(myVehicle,0) end end Here I have done a second video about it Thanks for reading. Best regards.
  17. There are not renders errors. I have checked debugacript 3 on both machines. As I said, arent fps issues, are lags (like ping) issues. Might collision with objects or something like that but it is coded pretty well. I hope u can help me.
  18. Hello dear community. Im currently developing a game mode from scraths and recently I have found an issue which I have no idea how to fix it. When I die and I start to spectate someone, while im seeing to other player it is very very lag. I tried with my local machine and it is still looking lagging. I tried to use the following function after the vehicle is created but it doesn't work. myVehicle = createVehicle(v,x,y,z,0,0,rz) if setElementSyncer then setElementSyncer( myVehicle, false ) end I hope u can bring me a hand to fix it.
  19. Inside the loop if value == "whatever" then -- whatever u want to do return end
  20. function yourFunctionName (thePlayer,cmd,argument1,argument2) -- Your Code end addCommandHandler ("mute",yourFunctionName)
  21. Hello dear community, well, today I started to working with shaders and I have 2 questions about them. The first one is how can I modify the following variable float3 colorrgb = float3(255,255,255); with dxSetShaderValue. I tried to use: dxSetShaderValue(myShader, "colorrgb", 255,0,0) but it didn't work. Will give I get problem while using dxSetShaderValue on a render ? Thats all for now. I hope u can bring me a hand. Thanks for reading. Best regards.
  22. Hello dear community. I know that this question could sound so silly but I would like to know what is the max length of setAccountData and setElementData I want to storage several positions x,y,z like 32 times .. I want to storage them in a table and using toJSON thanks and best regards.
  23. Hello dear community. Im having a simple issue which is annoying me a lot ... Well, Im trying to sort a table like the following one by Player points. However, it doesn't return the ordered from high to lower. It doesn't even order it. simpleTable = { player1 = {points = 25, playerName = "RandomNick1"}, player2 = {points = 1, playerName = "RandomNick2"}, player3 = {points = 13, playerName = "RandomNick3"}, player4 = {points = 27, playerName = "RandomNick4"}, player5 = {points = 7, playerName = "RandomNick5"} } table.sort (simpleTable, function (a, b) return a.points > b.points end) I hope u can bring me a hand with my problem or another way to fix it. Thanks for reading. Regards.
×
×
  • Create New...