Jump to content

Erlkonig

Members
  • Posts

    105
  • Joined

  • Last visited

Everything posted by Erlkonig

  1. Okay, after the beer is over I had realized that I had not restarted an "admin" resource. This is my fault. Sorry for this topic. The problem is solved. Also I am sorry because it was a very stupid mistake. I lost about 2 hours on this.
  2. I tried to export function "aSetPlayerMuted" but got the debug "failed to call 'admin:aSetPlayerMuted' [string "?"], I don't give an anything what's wrong. Maybe I still did not realize how to use call function. I hope that someone will help cause I did not did anything since 2 litres a beer. Thanks everyone who will send something under. Code of the script: if str[1] == "/mute" then if str[2] and str[3] then if tonumber(str[3]) then local seconds = str[3] * 60 local thisPlayer = getPlayerFromName(str[2]) if thisPlayer then exports["admin"]:aSetPlayerMuted(thisPlayer, not isPlayerMuted (thisPlayer), seconds) I am sorry for the screen but this is the code from of the meta.xml I do not plan to sleep until I will fix it. The function of the admin-resource: function aSetPlayerMuted ( player, state, length ) if ( setPlayerMuted ( player, state ) ) then if not state then aRemoveUnmuteTimer( player ) elseif state and length and length > 0 then aAddUnmuteTimer( player, length ) end return true end return false end I'll be sorry if this is a very stupid mistake...
  3. Erlkonig

    [HELP] block

    Do you want block the health of the vehicle on 400 if the source of damage is minigun or just block any damages for vehicle from minigun? Use this https://wiki.multitheftauto.com/wiki/OnClientVehicleDamage
  4. Code: addEvent("Tic.addVeh", true) addEventHandler("Tic.addVeh", root, function(source, model) local query = dbPoll(dbQuery(database, "SELECT * FROM playersConce WHERE Account = ?", getAccountName(getPlayerAccount(source))), -1) if query and #query > 0 then if vehicleConces[source] then if isPedInVehicle(source) then local r1, g1, b1, r2, g2, b2, r3, g3, b3 = getVehicleColor(vehicleConces[source], true) local conceSQL = { vehLife = getElementHealth(vehicleConces[source]), vehColor = { r1, g1, b1, r2, g2, b2, r3, g3, b3, }, vehTunning = {}, vehUpgrade = {}, } removeElementData(vehicleConces[source], "Tic.vehicleBank") destroyElement(vehicleConces[source]) local vehFuel = dbPoll(dbQuery(database, "SELECT * FROM playersConce WHERE Account = ?", getAccountName(getPlayerAccount(source))), -1) setElementData(vehicleConces[source], "DNL:Combustivel", vehFuel) dxMsg(source, "Your vehicle was saved in the garage!", "success") dbExec(database, "UPDATE playersConce SET Estado = ?, Dados = ? WHERE Account = ? AND Model = ?", "Garage", toJSON(conceSQL), getAccountName(getPlayerAccount(source)), model) dbExec(database, "UPDATE playersConce SET Fuel = ? WHERE Account = ?", getElementData(source, "DNL:Combustivel"), getAccountName(getPlayerAccount(source))) else dxMsg(source, "Get inside the vehicle and try again.", "info") end else dxMsg(source, "Your not have a vehicle!", "info") end end end ) About the solve: As I understand, you had destroyed the element before setElementData ( destroyElement(vehicleConces[source] ). Also in dbExec you're trying to get ElementData from source, not from vehicleConces[source].
  5. Debug says it all. For more please send the client-side & server-side code.
  6. Thank you very much! Also thanks for the topic with tutorial. It works already. I have to learn it!
  7. Is the the syntax which I used is correctly? Just a moment, I'll send the picture. The same HTTP request with firefox:
  8. Hi! Thanks for reply! I tried but the table is empty while the string returns the information. The code below: function newResult(getupdates) if getupdates then outputConsole("Start of iteration") local jsonUpdates = fromJSON(getupdates) for i, v in ipairs(jsonUpdates) do outputConsole(i..": "..v) end outputConsole("End of iteration") outputConsole(getupdates) else outputDebugString("ERROR!", 3) end end fetchRemote(link, newResult)
  9. Hello everyone! Im trying to solve this problem already 3rd day but no results. I am calling HTTP request and it returns JSON. For example it works in browser (Firefox doing it better). When Im trying to call that request with a callRemote, I got returned the table but when I list that with a iteration it's clear as I understand. When I am doing that with fetchRemote, it returns the correct string but I need that the table ofc . I am sure that I am doing something wrong but I do not know what exactly I am doing wrong. Thanks for everyone who will reply.
  10. Рекомендую с помощью RESCPU отследить сначала сколько процентов потре:Oет ресурс.
  11. What did you write for this time?
  12. I tested this script, it works. Can you try to test it the default MTA server?
  13. Erlkonig

    help me

    As I understand you correctly? You want to fix the vehicle when the vehicle cloose to broke. You can use that in client-side and vehicles will never break. addEventHandler("onClientVehicleDamage", getRootElement(), function() cancelEvent() end)
  14. Erlkonig

    help me

    timer = {} function incHp(veh) timer[veh] = setTimer(setElementHealth(veh), 10, 10, veh, getElementHealth(veh)+5) end addEventHandler("onVehicleEnter", root, incHp) function stopincHP(veh) if(isTimer(timer[veh] ))then killTimer(timer[veh]) end end addEventHandler("onPlayerVehicleExit", root, stopincHP) I just put it in the "code". 1) You're using "onVehicleEnter" which returned as 1st "thePed", not vehicle. You need "onPlayerVehicleEnter". 2) About setTimer. You have to reference a function or create a function inside. What exactly do you want to do?
  15. Are you sure that this is the client-side?
  16. Can you show your code please? Did you try the group ID 3?
  17. Erlkonig

    help me

    https://wiki.multitheftauto.com/wiki/AttachElements
  18. The problem was resolved. Timer was inside the eventHandler The topic can be closed.
  19. Erlkonig

    help me

    Do you want just to attach the weapon object?
  20. Erlkonig

    help me

    -- client addEventHandler( "onClientKey", root, function(button,press) if button == "1" and press then triggerServerEvent("changeVehicleMode", localPlayer, "sportmod") elseif button == "2" and press then triggerServerEvent("changeVehicleMode", localPlayer, "business") end end ) -- server function setVehicleVelocity(mode) local veh = getPedOccupiedVehicle(client) if (not veh) or getPedOccupiedVehicleSeat((client) ~= 0 ) then return end if (mode == "sportmod") then setVehicleHandling(veh, "maxVelocity", 320) setVehicleHandling(veh, "engineAcceleration", 20) setVehicleHandling(veh, "driveType", "awd") setVehicleHandling(veh, "handlingFlags", 0x1008000) outputChatBox("Sport Mod Enabled", client, 255, 255, 0, true) elseif (mode == "business") then setVehicleHandling(veh, "maxVelocity", 180) setVehicleHandling(veh, "engineAcceleration", 20) setVehicleHandling(veh, "driveType", "awd") setVehicleHandling(veh, "handlingFlags", 0x1008000) outputChatBox("Business Mod Enabled", client, 255, 255, 0, true) end end addEvent("changeVehicleMode", true) addEventHandler("changeVehicleMode", root, setVehicleVelocity) Have a good night
  21. Erlkonig

    help me

    damn, gimme a time, I have to turn on my PC then, also the player should be called like "client"
  22. Erlkonig

    help me

    -- YOUR CLIENT: addEventHandler( "onClientKey", root, function(button,press) if button == "1" then triggerServerEvent("sportmod", localPlayer) elseif button == "2" then triggerServerEvent("business", localPlayer) end end ) -- SERVER: function setVehicleVelocity(player, mode) local veh = getPedOccupiedVehicle(player) if (not veh) or getPedOccupiedVehicleSeat(player) ~= 0 ) then return end if (mode == "sportmod") then setVehicleHandling(veh, "maxVelocity", 320) setVehicleHandling(veh, "engineAcceleration", 20) setVehicleHandling(veh, "driveType", "awd") setVehicleHandling(veh, "handlingFlags", 0x1008000) outputChatBox("Sport Mod Enabled", player, 255, 255, 0, true) elseif (mode == "business") then setVehicleHandling(veh, "maxVelocity", 180) setVehicleHandling(veh, "engineAcceleration", 20) setVehicleHandling(veh, "driveType", "awd") setVehicleHandling(veh, "handlingFlags", 0x1008000) outputChatBox("Business Mod Enabled", player, 255, 255, 0, true) end end addCommandHandler("sportmod", setVehicleVelocity) addCommandHandler("business", setVehicleVelocity) addEvent("sportmod", true) addEvent("business", true) addEventHandel("sportmod", root, setVehicleVelocity("sportmod")) addEventHandel("business", root, setVehicleVelocity("business")) I am note sure but try this.
  23. Erlkonig

    help me

    Send here client & server side code. Please use "Insert Code Snippet". It's near the smile.
×
×
  • Create New...