Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/02/22 in all areas

  1. give the source player to the timer like this function revivir1() revivir = 1 cancelText = nil setPedAnimation(source, ".", ".", -1, false, false, false, true) outputChatBox (".", source, 255, 0, 0) setTimer(function(source) -- Pass source player into timer si = 1 cancelText = cancelText if (cancelText==nil) then outputChatBox(".", source, 255, 0, 0) ------This is the wrong text end end, 600, 1, source) -- Pass source player into timer end addEvent("sistemarev", true) addEventHandler("sistemarev", root, revivir1)
    1 point
  2. triggerServerEvent is unable to receive data. If you take a look at the syntax of that function, you will see that it only returns a boolean(true/false): https://wiki.multitheftauto.com/wiki/TriggerServerEvent You can make it possible using this library, but that wouldn't create a solid system. The server should be in charge of the hunger and Thirst values. What you want is the following: Server A timer (or multiple timers) This one gets the Hunger and Thirst Updates the Hunger and Thirst (-1) according to your needs. Sets the health or kills the player. triggerClientEvent (or elementdata with https://wiki.multitheftauto.com/wiki/AddElementDataSubscriber + setElementData [syncMode is "subscribe"]) Client Just updates the UI to show the player his hunger and thirst values.
    1 point
  3. 1 point
  4. @IIYAMA sorry for late response i think my way of creating hunger and thirst system with get/setelementdata is complatly wrong and that cause of performance issues in future may i use only triggerevents and a variable to process
    1 point
  5. Wiki: except the transmission rate of the data contained in the arguments can be limited and other network traffic is not blocked while the data is being transferred. It does 2 things: - It can be limited - It does not block while transferring. If you increase the bandwidth to max 100 MB: 100*1024*1024 You basically undo the first thing. That is fine if you only send a little bit of data. What might lag for some players is the head movement. Which is caused by the non-block transfer thing. - If the player his download is not fast enough, there will be a delay. But there will be no/little lag created for other things, like remote-player movement. (Remote-players = other player elements than yourself in your game) - And if the player download is not fast enough and can't keep up. It will stack all those latent events in a queue, which only gets longer. If you are going to use this function, then I recommend to use getLatentEventStatus for each player to check if the player receives the data. If yes, then send the next update.
    1 point
  6. Use the engineSetModelLODDistance function to increase the render distance of your model. If you need a value greater than 300 units, you may have to consider using a low-LOD object using setLowLODElement
    1 point
  7. here thePlayer argument is invalid use for loop to add all players addEventHandler("onResourceStart", resourceRoot, function() for _,thePlayer in ipairs(getElementsByType("player")) do bindKey(thePlayer, "space", "down", pararAnim) end end ) function prueba(thePlayer) setPedAnimation(thePlayer, "finale", "fin_let_go", -1, false, false, false, false) end addCommandHandler("prueba", prueba) function pararAnim(thePlayer, key, keyState) setPedAnimation(thePlayer) end if you want to add for single player you can put it inside prueba command i don't know how to use it
    1 point
  8. This update rate is fine, unless you have about/more than ~40 players in your server. Fix for that: Client (set Thirst with sync disabled) Thirst = Thirst - 1 setElementData(localPlayer, "Thirst", Thirst, false) + https://wiki.multitheftauto.com/wiki/TriggerServerEvent (https://wiki.multitheftauto.com/wiki/TriggerLatentServerEvent) + Server (set Thirst with sync disabled) setElementData(client, "Thirst", Thirst, false)
    1 point
  9. Good job man, keep going at this what you're doing.
    1 point
  10. It can full fill that part if you want, since MTA has a build in webserver, but you might want to add some serverside stuff for your website as middleware for anti-abuse performance reasons. Anyway I leave an example below for those that are interested. Resource name: webserver Filename: meta.xml <meta> <info version="1.0.0" name="webserver" type="script" description="Web server info" /> <html src="playerCount.html" /> <script src="main_s.lua" type="server" /> <export function="getPlayerCount" http="true" /> </meta> Method: 1 Filename: playerCount.html <* httpWrite( #getElementsByType ( "player" ) ) *> URL: http://127.0.0.1:22005/webserver/playerCount.html Returns: <what ever you want> Method: 2 Filename: main_s.lua function getPlayerCount() return #getElementsByType( "player" ) end URL: http://127.0.0.1:22005/webserver/call/getPlayerCount Returns: JSON Skip login? (it is not recommended to skip for production, use middleware instead for the credentials) Add: <right name="resource.webserver.http" access="true"></right> Under default: <acl name="Default"> <right name="resource.webserver.http" access="true"></right>
    1 point
  11. E aí, @dextzone! Para fazer isso, você precisa levar em consideração o que a pessoa que atira está vendo. Neste caso, é feito o uso do evento onClientPlayerDamage. Pegando as informações que vêm desse evento, basta mandá-las para o servidor, através de um triggerServerEvent. Só tome cuidado pois você terá de cancelar esse evento, usando cancelEvent. Isso significa que todos os jogadores ficarão invencíveis, mas ainda ocorrerá o tratamento dos dados lá no servidor. Sendo assim, haverá uma perfeita sincronia. Qualquer dúvida, basta deixá-la aqui!
    1 point
×
×
  • Create New...