Jump to content

IIYAMA

Moderators
  • Posts

    6,058
  • Joined

  • Last visited

  • Days Won

    208

Everything posted by IIYAMA

  1. IIYAMA

    Simple help :D

    local position = "15,20,18" local x, y, z = unpack(split(position, ","))
  2. function deluxe ( ) local player = client addEventHandler doesn't work the same as the addCommandHandler. Use the predefined variable `client`, to get the player that did activate the event.
  3. That is not really an issue, since it doesn't freezes the code. The database will just queue the queries and not execute them in parallel. Creating tables is something you should do once, not every time you start your script. Or are you talking about saving player data when you stop the resource?
  4. if not p then return true -- there is no parent? end for i=1,5000 do local data = dgsElementData[p] if not data then error("Data mismatch... go spam thisdp", 2) end if not data.visible then return false end p = FatherTable[p] if not p then break end end hmmm maybe... ? can't test it
  5. IIYAMA

    Fetchremote

    Probably because your url contains an invalid protocol notation. Make sure to use https:// or http://
  6. The functions that @Tut provided are the way to go to achieve that. You can find here an example resource on how to use the second function:
  7. Then you probably need to replace that with: local vehicle = getElementData(player, "repairingvehicle");
  8. bindKey getPedOccupiedVehicle local timer = repairTimer[vehicle] isTimer killTimer repairTimer[vehicle] = nil
  9. If the health loss isn't subtracted, you will be able to detect the issue with the pre-event: https://wiki.multitheftauto.com/wiki/OnClientPlayerWeaponFire Since the health didn't change. + getTickCount to check if the damage is done within the same frame. And maybe include the ped task as well for validation.
  10. When that occurs, what was the loss value?
  11. Also without mods? There are some mods that do have some collision issues.
  12. You mean that there is no damage given? If that is the case: You could maybe use: https://wiki.multitheftauto.com/wiki/OnClientPlayerWeaponFire to save the latest player shot and set that as attacker. (with some tricks)
  13. Either the vehicle component has no orientation (or maybe the vehicle is streamed out or something else...). if x and y and z then end And if none of components work, then I have no idea.
  14. You didn't mess anything up, but it seems the function has been broken somewhere on the versioooon-way. The wiki example didn't work either. local baseElement = createElement("map-dinner") --[[ ]] local element = createObject ( 1337, 5540.6654, 1020.55122, 1240.545, 90, 0, 0 ) setElementParent(element, baseElement) --[[ ]] local file = xmlCreateFile ("map.xml", "map") saveMapData ( file, baseElement, true ) xmlSaveFile ( file ) xmlUnloadFile ( file ) --[[ <map> <object></object> </map> ]] local file = xmlCreateFile("saved.map", "map") if file then saveMapData ( file, getResourceRootElement(getThisResource()), true ) xmlSaveFile ( file ) xmlUnloadFile ( file ) end --[[ <map> <map> <map-dinner> <object></object> </map-dinner> </map> </map> ]] I am going to add a bug report. https://github.com/multitheftauto/mtasa-blue/issues/1473
  15. An alternative is to save an specific part of the element tree. Pick the method that works best for you. local file = xmlCreateFile ("map.xml", "map") local baseElement = createElement("temporary") --[[ ]] local element = -- createObject, createVehicle, etc. etc, setElementParent(element, baseElement) --[[ ]] saveMapData ( file, baseElement ) xmlSaveFile ( file ) xmlUnloadFile ( file ) destroyElement(baseElement) -- destroy every element, parent as well as the children thanks to propagation Pro's Flexibility, you do not have to write specific code for other elements. Cons: Serverside only No custom properties with special characters, for example : notations and code comments on the fly. All properties are copied, you do not have fully control which ones are saved.
  16. Looks very nice! ? Btw. you have currently tagged your topic as [SHOW], you might want to consider change it to [REL] since you actually released it.
  17. dano = {} function bloquear(source) dano[source] = 1 setTimer(tirar,8000,1,source) end addEventHandler ( "onPlayerDamage", root, bloquear ) function tirar(source) dano[source] = 0 end function clientPickupHit(thePlayer,pickup, matchingDimension) local pickupType = getPickupType( source ) if (dano[player] == 1) then if (pickupType == 0) or (pickupType == 1) then outputChatBox("Não é possivel pegar pickup em combate!",player, 255, 0, 0) cancelEvent() end end end addEventHandler("onPickupHit", root, clientPickupHit)
  18. yes, but only to a callback function as you can see in the example. callClient(prl, "getPlayerCustomAmmo", function (Ammo_) end )
  19. You can't use triggerClientEvent to return values. Only MTA-Communication-Enchantment can do that with a callback, like this: And I am not even sure that you need to do that, you can already provide that information on your first triggerServerEvent. triggerServerEvent("GiveWeaponToPlayer", root, Ammo) addEvent("GiveWeaponToPlayer", true) addEventHandler("GiveWeaponToPlayer", root, function(Ammo_) local prl = client giveWeapon(prl, 22, Ammo_, true) end)
  20. Maybe, there is no information about console being available here: https://wiki.multitheftauto.com/wiki/ExecuteCommandHandler So I am not sure if that is supported. But if you want to try that, you need to provide the element console and not the string "console".
  21. Wiki doesn't indicates that the client version of the event can be cancelled. https://wiki.multitheftauto.com/wiki/OnClientPickupHit While on serverside there is an indication: Cancel effect If this event is canceled, the pickup does not disappear and the player does not receive its bonus. https://wiki.multitheftauto.com/wiki/OnPickupHit So you will have to create it on serverside. dano = {} local player = source -- ... dano[player] = true -- block dano[player] = nil -- unblock / clear if dano[player] then end
  22. Set it to 2000, not 10000.
  23. Afaik the max vehicle health is +/- 2000. (Initial health is 1000.)
  24. If you find it difficult to work with the event system, you can also try this out: Example:
×
×
  • Create New...