Jump to content

IIYAMA

Moderators
  • Posts

    6,097
  • Joined

  • Last visited

  • Days Won

    218

Everything posted by IIYAMA

  1. Daar leren ze als goed is geen lua. Dus nee, voornamelijk zelfstudie.
  2. That's only for custom weapons.(created weapons) For player weapons: onClientPlayerWeaponFire Which can't cancel. I know there is some confusion with: onClientPlayerWeaponFire and onClientWeaponFire Just read the wiki better guys and the brains will !
  3. ehm? How are you outputting it? / store it. The function you called select is a lua function, I will not recommend you to use it as overwrite. select (index, ···) If index is a number, returns all arguments after argument number index. Otherwise, index must be the string "#", and select returns the total number of extra arguments it received.
  4. it doesn't matter, the client is loading the script even if he joins or if he is already ingame.
  5. It can be done more ways, I only need one event, you two. My example will reduce warnings when re-communicate with the clients directly after the binds. Also gives the option to register players and start large data transfers without problems. But yours is quicker. @Miika822 what is it Miika822?
  6. The important thing is that you check if the elementdata has changed. Elementdata has it's own update rate(so NO not every frame), but it will also update when you set the elementdata to the same value. "Why does it updates(synchronisation) when the value is the same?" Because serverside/clientside can use the elementdata without synchronisation, so it has to be updated on the other side too. Can simply be reduced with: if getElementData(element,"key") ~= newData then setElementData(element,"key",newData) end The update rate of elementdata is very quick, so getTickCount() can reduce the amount of updates. local nextUpdate = 0 addEventHandler("onClientRender",root, function () local timeNow = getTickCount() if timeNow > nextUpdate then nextUpdate = timeNow+1000 outputChatBox("update!!!!!") end end) Elementdata can be handy but you have to be careful how many times you execute it (on both sides).
  7. client addEventHandler("onClientResourceStart",resourceRoot, function () triggerServerEvent("bindKeysFadeCamera",localPlayer)-- when the player has loaded end) server function fadeBind(thePlayer) if getCameraTarget(thePlayer) then fadeCamera(thePlayer, false, 1) else fadeCamera(thePlayer, true, 1) end end addEvent("bindKeysFadeCamera",true) addEventHandler("bindKeysFadeCamera",root, function () if isElement(client) then bindKey(client, "f12", "down", fadeBind) end end)
  8. aha, thx
  9. try it yourself: Resource 1: addCommandHandler("lol1", function() outputChatBox("lol1") showCursor( not isCursorShowing() ) end) Resource 2: addCommandHandler("lol2", function() outputChatBox("lol2") showCursor(false) end) Also there also another problem, which will overwrite showCursor. That happens when you change the gui input mode. I am not a gui expert and I probably only created circa 12 gui's in my live, but this is what I know about enable the mouse.
  10. Hi, Is the function getPlayerCommunityID able to use? and yes it does exist, only it isn't on the wiki.
  11. I am telling you, that it isn't going to work what ever you do. Unless you try to understand the meaning of what I just said. If you do not understand (my)English, then find somebody who can translate it for you.
  12. You have to scroll more down: (client part) setWeaponProperty Syntax (weapon creation) bool setWeaponProperty ( weapon theWeapon, string strProperty, value theValue ) Required Arguments theWeapon: the weapon to change the property of. strProperty: the property to edit such as damage per hit ( "damage" ): "weapon_range" - float "target_range" - float "accuracy" - float "damage" - int FROM VERSION 1.4 r6693 ONWARDS "fire_rotation" - vector - For aligning fire direction with model theValue: The value to set the property to. Returns Returns true if the property was set. Requirements Minimum supported server n/a Minimum supported client 1.3.0-9.04555
  13. (most) weapon property's don't work custom weapons. I already found out that problem when I tried them on their release. They haven't fixed them...... yet....... I also reported a related bug on 2013-07-13. https://bugs.multitheftauto.com/view.php?id=7706 Those weapons where suppose to be serverside too........ But it seems they lost their interest in custom weapons. It is shame.
  14. Especially line 5, will totally destroy the network traffic. Always check if elementdata must be overwritten or not. Overwrite elementdata with the same value is stupid, unless you are editing the same elementdata key on the other side too.
  15. Every resource is using it's own showCursor management. They all can enable it, but they all must disabled it in order to hide it. Short saying: They have no influences at each other.
  16. IIYAMA

    Return values

    It can't be done, because of the network. Code can't wait for network traffic. You can pause the code if you want, but you still need to return the value back with another trigger and resume the code. The only trouble with that is, when a packet failed/serverside code failed, your code stays frozen and is still in the memory. The best thing you can do is using two functions.
  17. Use a lua table, to manage the data. Save the dat(to xml) a ones in the 30 min and when you shut it down.
  18. By reducing requests of your database. ( make updates after a while )
  19. You are a funny guy. Showing me a few lines and telling me the code I posted doesn't work, your other code doesn't work what about that? and you are defining source as argument, source isn't meant as argument.
  20. function ( source ) if getElementData(localPlayer,"state") == "alive"or getElementData(localPlayer,"state") == "Training" then local playerVehicle = getPedOccupiedVehicle(localPlayer) if playerVehicle then local vehicleHealth = getElementHealth ( playerVehicle ) local vehicleSpeed = getElementVelocity ( playerVehicle )
  21. function ( source ) for index,player in ipairs(getElementsByType("player")) do if getElementData(player,"state") == "alive"or getElementData(player,"state") == "Training" then local playerVehicle = getPedOccupiedVehicle(player) local vehicleHealth = getElementHealth ( playerVehicle ) local vehicleSpeed = getElementVelocity ( playerVehicle )
  22. IIYAMA

    "Or" function

    debug it manually then. I can't help you if you aren't debugging your variables and elementdata.
  23. I would suggest. (how I created it) When you hit somebody, you trigger a server event. You put a delay between them, like 200 ms per update. -- to save a lot of data transfer. If you use elementdata, you will be using more depending on the player count in the server and you will be constantly using the network. The next step, which you are asking for in this post. - Start exporting your data from resource to resource. (which I do recommend, because of the clean way of doing) - You can also use triggerEvent, like MrBrutus said. But that one uses a lot of memory even it isn't a bad idea. - Also you use setElementData without synchronisation, which will not use and bandwidth. (but it also creates trash, you have to delete it when you stop the resource) That are your options.
  24. IIYAMA

    "Or" function

    if itemName == "Box of Matches" -- if itemName is Box of Matches and ( -- start a new priority ( ( -- tonumber converts it to a number, tonumber(getElementData(localPlayer, "Wood Pile") ) or 0) > 0 or -- if not a number then it is 0 and check if it is higher then 0. ( -- same here tonumber(getElementData(localPlayer, "Wooden Sticks") ) or 0) > 0 ) -- end priority then
  25. IIYAMA

    "Or" function

    then something is wrong with your elementdata. This should work: (your code, not changed at all) if itemName == "Box of Matches" and (getElementData(getLocalPlayer(), "Wood Pile") == 0 or getElementData(getLocalPlayer(), "Wooden Sticks") == 0) then
×
×
  • Create New...