Jump to content

Search the Community

Showing results for tags 'client'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • User Guides
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • MTA Community
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
    • General
    • Multi Theft Auto 0.5r2
    • Third party GTA mods
  • Archive
    • Archived Items
    • Trash

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Gang


Location


Occupation


Interests

  1. Advanced Compass is a fully client Quality of Life resource to ease navigation in MTA SA world. Features: - A compass Hud display with cardinal and ordinal directions (N, NE, E, SE, S, SW, W, NW) and degree markers. - Blip System: * supports displaying server-made / Client-made blips on the compass and in the game world (for client player only). image: https://imgur.com/o72ASg2 - Blip Management: *GUI for creating blips. *Right-click on map to create or delete blips. *Option to delete all player-created blips at once. * Settings to controls blips visibility (/csettings). image: https://imgur.com/ksXoNbu -Persistence: *Custom blips and settings are saved for your next login. image: https://imgur.com/ajZhLj1 -Commands: */csettings to open settings panel . */blip <Blipid> <visible on compass> <visible in-game world> : a short cut to create a blip at your location. ex: /blip 14 true false : create blip id 14, shows on your compas but not in the game world. Video showcase: Gameplay Video: Download link: advancedcompassv1 | Multi Theft Auto | Community
  2. Dears, it says: ERROR: Client triggered serverside event loginAccount, but event is not added serverside Can someone check it why? I couldn't find the error. client.lua : -- Create the login GUI local loginWindow = guiCreateWindow(400, 300, 300, 200, "Login", false) local usernameLabel = guiCreateLabel(20, 30, 80, 20, "Username:", false, loginWindow) local usernameEdit = guiCreateEdit(100, 30, 160, 20, "", false, loginWindow) local passwordLabel = guiCreateLabel(20, 60, 80, 20, "Password:", false, loginWindow) local passwordEdit = guiCreateEdit(100, 60, 160, 20, "", false, loginWindow) local rememberCheckbox = guiCreateCheckBox(20, 90, 200, 20, "Remember me", false, false, loginWindow) local loginButton = guiCreateButton(20, 120, 120, 30, "Login", false, loginWindow) guiSetVisible( loginWindow, false ) -- Create the registration GUI local registerWindow = guiCreateWindow(400, 300, 300, 250, "Registration", false) local regUsernameLabel = guiCreateLabel(20, 30, 80, 20, "Username:", false, registerWindow) local regUsernameEdit = guiCreateEdit(100, 30, 160, 20, "", false, registerWindow) local regPasswordLabel = guiCreateLabel(20, 60, 80, 20, "Password:", false, registerWindow) local regPasswordEdit = guiCreateEdit(100, 60, 160, 20, "", false, registerWindow) local regConfirmLabel = guiCreateLabel(20, 90, 80, 20, "Confirm:", false, registerWindow) local regConfirmEdit = guiCreateEdit(100, 90, 160, 20, "", false, registerWindow) local regEmailLabel = guiCreateLabel(20, 120, 80, 20, "Email:", false, registerWindow) local regEmailEdit = guiCreateEdit(100, 120, 160, 20, "", false, registerWindow) local registerButton = guiCreateButton(20, 150, 120, 30, "Register", false, registerWindow) guiSetVisible( registerWindow, false ) -- Show the login GUI when the resource starts and show cursor addEventHandler("onClientResourceStart", resourceRoot, function() guiSetVisible( loginWindow, true ) showCursor( true ) end) -- Login Event addEventHandler("onClientGUIClick", loginButton, function() local username = guiGetText(usernameEdit) local password = guiGetText(passwordEdit) local rememberMe = guiCheckBoxGetSelected(rememberCheckbox) triggerServerEvent("loginAccount", resourceRoot, username, password, rememberMe) end, false) -- Register Event addEventHandler("onClientGUIClick", registerButton, function() local username = guiGetText(regUsernameEdit) local password = guiGetText(regPasswordEdit) local passwordAgain = guiGetText(regConfirmEdit) local email = guiGetText(regEmailEdit) triggerServerEvent("registerAccount", resourceRoot, username, password, passwordAgain, email) end, false) -- Login Success Event addEvent("onAccountLoggedIn", true) addEventHandler("onAccountLoggedIn", resourceRoot, function() -- Handle login success end) -- Login Failure Event addEvent("onAccountLoginFailed", true) addEventHandler("onAccountLoginFailed", resourceRoot, function() -- Handle login failure end) -- Registration Success Event addEvent("onAccountRegistered", true) addEventHandler("onAccountRegistered", resourceRoot, function() -- Handle registration success end) -- Registration Failure Event addEvent("onAccountRegistrationFailed", true) addEventHandler("onAccountRegistrationFailed", resourceRoot, function() -- Handle registration failure end) server.lua : addEvent("loginAccount", true) addEventHandler("loginAccount", resourceRoot, function(username, password, rememberMe) local player = client if not isPlayerBanned(player) then if handleLogin(username, password, rememberMe) then triggerClientEvent(player, "onAccountLoggedIn", player) else triggerClientEvent(player, "onAccountLoginFailed", player) end else triggerClientEvent(player, "onAccountBanned", player) end end) addEvent("registerAccount", true) addEventHandler("registerAccount", resourceRoot, function(username, password, passwordAgain, email) local player = client local ip = getPlayerIP(player) local serial = getPlayerSerial(player) if handleRegistration(username, password, passwordAgain, email, ip, serial) then triggerClientEvent(player, "onAccountRegistered", player) else triggerClientEvent(player, "onAccountRegistrationFailed", player) end end) meta.xml: <meta> <info author="" name="Account system" version="1.0" type="script" /> <script src="server.lua" type="server" /> <script src="client.lua" type="client" /> </meta> mysq/server.lua: -- Create a function to handle database queries function queryHandler(query, ...) local query = dbQuery(connection, query, ...) if not query then outputDebugString("Can't do the request") return end local result, num_affected_rows, last_insert_id = dbPoll(query, -1) return result, num_affected_rows, last_insert_id end
  3. https://pastebin.multitheftauto.com/6557549668
  4. Pelo amor de Deus alguém me ajuda, eu estou tentando inserir uma modelagem que fiz no scketchup no editor de mapas, consegui a princípio, mas o mod não inicia pois dá esse erro no debug ( https://drive.google.com/file/d/1RA3G7Vf5wD8lWeUbvUqrsnr_yhXmVCTM/view?usp=sharing ) Assim está meu código: https://drive.google.com/file/d/1kA5smwEpQDZYRTMThDx3NqU-HqabCICT/view?usp=sharing Não sei, literalmente, o que fazer
  5. server triggered clientside event notify, but event is not added clientside I need help with this error, I'm trying a command but when I run this error, someone help me!!! Client: local sound = nil function uiEfeito() exports["Blur"]:dxDrawBluredRectangle(x*0, y*0, x*1366, y*768, tocolor(255, 255, 255, 150)) dxDrawImage(x*0, y*0, x*1366, y*768, "files/gfx/others/efeito.png", 0, 0, 0, tocolor(0, 254, 6, 255), false) end addEvent("worth:fumar:maconha", true) addEventHandler("worth:fumar:maconha", getRootElement(), function() sound = playSound("files/sfx/efeito.mp3", true) setRainLevel(5) addEventHandler("onClientRender", getRootElement(), uiEfeito) setPedControlState(localPlayer, "walk", true) setWindVelocity(100, 100, 0) setCameraShakeLevel(255) setGameSpeed(0.5) setTimer(function() setRainLevel(0) stopSound(sound) resetWindVelocity() setCameraShakeLevel(1) setGameSpeed(1) removeEventHandler("onClientRender", getRootElement(), uiEfeito) end, 33000, 1) end) Server: local algemados = {} local fumando = {} local utilizando = {} local maconhado = {} -- Global mascaras = {} jbl = {} --=-=-=-=-=-=-=-=-=-=-=-=-=-=- [ EVENTO ] -=-=-=-=-=-=-=-=-=-=-=-=-=-=-- addEvent("use:item:worth:inventario", true) addEventHandler("use:item:worth:inventario", getRootElement(), function(player, item, quantidade) local itemInfos = getItemInfos(item) if (itemInfos) then if (itemInfos.outros.evento == "worth:beber") then local sede = (getElementData(player, config["Elements"].Sede) or 0) if (sede < 100) then if not (utilizando[player]) then utilizando[player] = true takeItem(player, item, 1) setElementData(player, config["Elements"].Sede, sede+itemInfos.outros.enche) setPedAnimation(player, "VENDING", "VEND_Drink_P", 4000, false, false, false, false) sendMessageServer(player, "Você bebeu 1x "..itemInfos.nome.."!", "success") triggerClientEvent(player, "worth:play:sound:client", player, "files/sfx/bebendo.mp3") setTimer(function() utilizando[player] = false end, 4000, 1, player) else sendMessageServer(player, "Aguarde para usar este item!", "info") end else sendMessageServer(player, "Você não está com sede!", "error") end elseif (itemInfos.outros.evento == "worth:comer") then local fome = (getElementData(player, config["Elements"].Fome) or 0) if (fome < 100) then if not (utilizando[player]) then utilizando[player] = true takeItem(player, item, 1) setElementData(player, config["Elements"].Fome, fome+itemInfos.outros.enche) setPedAnimation(player, "VENDING", "vend_eat1_P", 4000, false, false, false, false) sendMessageServer(player, "Você comeu 1x "..itemInfos.nome.."!", "success") triggerClientEvent(player, "worth:play:sound:client", player, "files/sfx/comendo.mp3") setTimer(function() utilizando[player] = false end, 4000, 1, player) else sendMessageServer(player, "Aguarde para usar este item!", "info") end else sendMessageServer(player, "Você não está com fome!", "error") end elseif (itemInfos.outros.evento == "worth:arma") then local arma_equip1 = getElementData(player, "llotus:arma:equip:1") or false local arma_equip2 = getElementData(player, "llotus:arma:equip:2") or false for i, v in ipairs(config["Outros"]["Weapons_Primary"]) do if (v[1] == item) then if (arma_equip1 == false) then takeItem(player, item, 1) setElementData(player, "llotus:arma:equip:1", {item, v[2]}) giveWeapon(player, v[2], 1) sendMessageServer(player, "Você equipou a sua arma primaria!", "success") triggerClientEvent(player, "worth:play:sound:client", player, "files/sfx/reload.mp3") else sendMessageServer(player, "Você já tem 1 arma primaria equipada!", "error") end end end for i, v in ipairs(config["Outros"]["Weapons_Secundary"]) do if (v[1] == item) then if (arma_equip2 == false) then takeItem(player, item, 1) setElementData(player, "llotus:arma:equip:2", {item, v[2]}) giveWeapon(player, v[2], 1) sendMessageServer(player, "Você equipou a sua arma secundaria!", "success") triggerClientEvent(player, "worth:play:sound:client", player, "files/sfx/reload.mp3") else sendMessageServer(player, "Você já tem 1 arma secundaria equipada!", "error") end end end elseif (itemInfos.outros.evento == "worth:munição") then local arma_equip1 = getElementData(player, "llotus:arma:equip:1") or false local arma_equip2 = getElementData(player, "llotus:arma:equip:2") or false for i, v in pairs(config["Outros"]["Ammo_Weapons"]) do if (i == item) then for index, arma in pairs(v) do if (arma_equip1) and (arma == arma_equip1[1]) then setElementData(player, "llotus:ammo:equip:1", item) takeItem(player, item, quantidade) giveWeapon(player, arma_equip1[2], quantidade) reloadPedWeapon(player) sendMessageServer(player, "Você recarregou sua arma!", "success") triggerClientEvent(player, "worth:play:sound:client", player, "files/sfx/reload.mp3") end if (arma_equip2) and (arma == arma_equip2[1]) then setElementData(player, "llotus:ammo:equip:2", item) takeItem(player, item, quantidade) giveWeapon(player, arma_equip2[2], quantidade) reloadPedWeapon(player) sendMessageServer(player, "Você recarregou sua arma!", "success") triggerClientEvent(player, "worth:play:sound:client", player, "files/sfx/reload.mp3") end end end end elseif (itemInfos.outros.evento == "worth:colete") then local colete = getPedArmor(player) if (colete <= 80) then takeItem(player, item, 1) setPedArmor(player, 100) sendMessageServer(player, "Você equipou o seu colete!", "success") else sendMessageServer(player, "Você já tem 1 colete bom equipado!", "error") end elseif (itemInfos.outros.evento == "worth:algemar") then local target = getNearestPlayer(player, 2) if (target) then if not (algemados[target]) then algemados[target] = true setElementFrozen(target, true) toggleAllControls(target, false) setPedAnimation(target, "GRAVEYARD", "mrnM_loop", -1, true, false, false, false) takeItem(player, item, 1) sendMessageServer(player, "Você algemou o cidadão!", "success") sendMessageServer(target, "Você foi algemado!", "info") else sendMessageServer(player, "Este cidadão já está algemado!", "error") end else sendMessageServer(player, "Chegue mais perto do cidadão para algema-lo!", "error") end elseif (itemInfos.outros.evento == "worth:desalgemar") then local target = getNearestPlayer(player, 2) if (target) then if (algemados[target]) then algemados[target] = false setElementFrozen(target, false) toggleAllControls(target, true) giveItem(player, "Algemas", 1) setPedAnimation(target, nil) sendMessageServer(player, "Você desalgemou o cidadão!", "success") sendMessageServer(target, "Você foi desalgemado!", "info") else sendMessageServer(player, "Este cidadão não está algemado!", "error") end else sendMessageServer(player, "Chegue mais perto do cidadão para algema-lo!", "error") end elseif (itemInfos.outros.evento == "worth:analgesico") then local vida = getElementHealth(player) if (vida < 100) then takeItem(player, item, 1) setElementHealth(player, vida+10) sendMessageServer(player, "Você usou 1x "..itemInfos.nome.."!", "success") else sendMessageServer(player, "Você já esta com sua saude boa!", "error") end elseif (itemInfos.outros.evento == "worth:bandagem") then local vida = getElementHealth(player) if (vida < 100) then takeItem(player, item, 1) setElementHealth(player, vida+20) sendMessageServer(player, "Você usou 1x "..itemInfos.nome.."!", "success") else sendMessageServer(player, "Você já esta com sua saude boa!", "error") end elseif (itemInfos.outros.evento == "worth:cigarro") then local isqueiro = getItem(player, "Isqueiro") if (isqueiro and isqueiro >= 1) then local vida = getElementHealth(player) if (vida-5 > 20) then if not (fumando[player]) then fumando[player] = true takeItem(player, item, 1) setElementHealth(player, vida-5) setPedAnimation(player, "GANGS", "smkcig_prtl_F", 8000, false, false, false, false) sendMessageServer(player, "Você fumou 1x "..itemInfos.nome.."!", "success") triggerClientEvent(player, "worth:play:sound:client", player, "files/sfx/fumando.mp3") setTimer(function() fumando[player] = false end, 8000, 1, player) else sendMessageServer(player, "Aguarde para fumar novamente!", "info") end else sendMessageServer(player, "Você está com a saúde baixa!", "error") end else sendMessageServer(player, "Você precisa ter um isqueiro para fumar!", "error") end elseif (itemInfos.outros.evento == "worth:kitreparo") then if not (isPedInVehicle(player)) then local vehicle = getNearestVehicle(player, 3) if (vehicle) then local health = getElementHealth(vehicle) if (health < 900) then takeItem(player, item, 1) fixVehicle(vehicle) sendMessageServer(player, "Você concertou o veiculo!", "success") else sendMessageServer(player, "Veiculo não está danificado!", "error") end else sendMessageServer(player, "Você está longe de mais de um veiculo!", "error") end else sendMessageServer(player, "Você não pode está dentro de um veiculo!", "error") end elseif (itemInfos.outros.evento == "worth:maço") then if (getSpaceItem(player, "Cigarro", 20)) then takeItem(player, item, 1) giveItem(player, "Cigarro", 20) sendMessageServer(player, "Você abriu 1x "..itemInfos.nome.."!", "success") else sendMessageServer(player, "Você não tem espaço para cigarros!", "error") end elseif (itemInfos.outros.evento == "worth:kitmedico") then local vida = getElementHealth(player) if (vida < 100) then takeItem(player, item, 1) setElementHealth(player, 100) sendMessageServer(player, "Você usou 1x "..itemInfos.nome.."!", "success") else sendMessageServer(player, "Você já esta com sua saude boa!", "error") end elseif (itemInfos.outros.evento == "worth:mochila") then local pesoAtual, pesoMaximo = getSpace(player) if not (pesoMaximo == itemInfos.outros.pesoSuportado) then if (pesoAtual <= itemInfos.outros.pesoSuportado) then inventarios[player]["Dados"].pesoMaximo = itemInfos.outros.pesoSuportado updateClientInventory(player) takeItem(player, item, 1) sendMessageServer(player, "Você colocou 1x "..itemInfos.nome.."!", "success") else sendMessageServer(player, "Você não pode por está mochila, ela é muito pequena para oque você esta carregando!", "error") end else sendMessageServer(player, "Você já está usando esta mochila!", "error") end elseif (itemInfos.outros.evento == "worth:nitro") then local parafusadeira = getItem(player, "Parafusadeira") if (parafusadeira and parafusadeira >= 1) then if not (isPedInVehicle(player)) then local vehicle = getNearestVehicle(player, 3) if (vehicle) then takeItem(player, item, 1) setElementFrozen(player, true) setPedAnimation(player, "BOMBER", "BOM_Plant", 3000, false, false, false, false) sendMessageServer(player, "Você começou a instalar o nitro!", "info") setTimer(function(player, vehicle) addVehicleUpgrade(vehicle, "1010") setPedAnimation(player, nil) setElementFrozen(player, false) sendMessageServer(player, "Você instalou o nitro no seu veiculo!", "success") end, 3000, 1, player, vehicle) else sendMessageServer(player, "Você está longe de mais de um veiculo!", "error") end else sendMessageServer(player, "Você não pode está dentro de um veiculo!", "error") end else sendMessageServer(player, "Você precisa ter uma parafusadeira!", "error") end elseif (itemInfos.outros.evento == "worth:bolar") then local dichavador = getItem(player, "Dichavador") if (dichavador and dichavador >= 1) then local seda = getItem(player, "Seda") if (seda and seda >= 1) then local maconha = getItem(player, "Maconha") if (maconha and maconha >= 1) then takeItem(player, "Seda", 1) takeItem(player, "Maconha", 1) giveItem(player, "CigarroMaconha", 1) sendMessageServer(player, "Você bolou um baseado!", "success") else sendMessageServer(player, "Você precisa ter uma maconha!", "error") end else sendMessageServer(player, "Você precisa ter uma seda!", "error") end else sendMessageServer(player, "Você precisa ter um dichavador!", "error") end elseif (itemInfos.outros.evento == "worth:moeda") then local random = math.random(1, 100) if (random > 50) then outputChatBox(getPlayerName(player).." jogou a moeda e deu cara!", root, 255, 255, 255, false) else outputChatBox(getPlayerName(player).." jogou a moeda e deu coroa!", root, 255, 255, 255, false) end elseif (itemInfos.outros.evento == "worth:caixaseda") then if (getSpaceItem(player, "Seda", 10)) then takeItem(player, item, 1) giveItem(player, "Seda", 10) sendMessageServer(player, "Você abriu 1x "..itemInfos.nome.."!", "success") else sendMessageServer(player, "Você não tem espaço para sedas!", "error") end elseif (itemInfos.outros.evento == "worth:dado") then local x, y, z = getElementPosition(player) local random = math.random(1, 6) for i, v in ipairs(getElementsByType("player")) do local x2, y2, z2 = getElementPosition(v) local distancia = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) if (distancia <= 5) then outputChatBox(getPlayerName(player).." jogou o dado e caiu "..random.." !", v, 255, 255, 255, false) end end elseif (itemInfos.outros.evento == "worth:pegar:jbl") then if (playerInAclTable(player, itemInfos.outros.acls)) then if not (jbl[player]) then local dim = getElementDimension(player) jbl[player] = createObject(2226,0,0,0) setElementDimension(jbl[player], dim) setObjectScale(jbl[player], 0.95) exports.bone_attach:attachElementToBone(jbl[player], player, 12, 0, 0, 0.4, 0, 180, 0) sendMessageServer(player, "Você pegou a JBL!", "success") else exports.bone_attach:detachElementFromBone(jbl[player], player) if (isElement(jbl[player])) then destroyElement(jbl[player]) end triggerClientEvent(root, "worth:parar:musica:jbl", root, player, jbl[player]) jbl[player] = nil sendMessageServer(player, "Você guardou a JBL!", "success") end else sendMessageServer(player, "Você não tem permissão para usar este item!", "error") end elseif (itemInfos.outros.evento == "worth:textura:jbl") then if (playerInAclTable(player, itemInfos.outros.acls)) then if (jbl[player]) then triggerEvent("worth:server:aplicar:textura", player, jbl[player], itemInfos.outros.textureID) sendMessageServer(player, "Você aplicou a textura na JBL!", "success") else sendMessageServer(player, "Você não tem uma JBL em mãos!", "error") end else sendMessageServer(player, "Você não tem permissão para usar este item!", "error") end elseif (itemInfos.outros.evento == "worth:cigarromaconha") then local isqueiro = getItem(player, "Isqueiro") if (isqueiro and isqueiro >= 1) then if not (maconhado[player]) then maconhado[player] = true triggerClientEvent(player, "worth:fumar:maconha", player) takeItem(player, item, 1) setTimer(function() maconhado[player] = false end, 33000, 1, player) else sendMessageServer(player, "Aguarde para fumar maconha novamente!", "info") end else sendMessageServer(player, "Você precisa de um isqueiro para fumar maconha!", "error") end elseif (itemInfos.outros.evento == "worth:mascaras") then if not (getElementData(player, "worth:mascara:equipada")) then setElementData(player, "worth:mascara:equipada", item) local mascara_vestida = getElementData(player, "worth:mascara:equipada") sendMessageServer(player, "Você vestiu a mascara "..itemInfos.nome.." !", "success") mascaras[player] = createObject(itemInfos.outros.idObject, 0, 0, 0, 0, 0, 0) takeItem(player, item, 1) if (mascara_vestida == "Cachorro") then exports["bone_attach"]:attachElementToBone(mascaras[player], player, 1, 0, 0.02, -0.55, 0, 0, 90) elseif (mascara_vestida == "Palhaco") then exports["bone_attach"]:attachElementToBone(mascaras[player], player, 1, 0, 0.02, -0.55, 0, 0, 90) elseif (mascara_vestida == "Samurai") then exports["bone_attach"]:attachElementToBone(mascaras[player], player, 1, 0, 0.02, -0.55, 0, 0, 90) elseif (mascara_vestida == "Bandana") then exports["bone_attach"]:attachElementToBone(mascaras[player], player, 1, 0, 0.02, -0.58, 0, 0, 90) elseif (mascara_vestida == "Dogao") then exports["bone_attach"]:attachElementToBone(mascaras[player], player, 1, 0, 0.02, -0.55, 0, 0, 90) elseif (mascara_vestida == "Macaco") then exports["bone_attach"]:attachElementToBone(mascaras[player], player, 1, 0, 0.01, -0.55, 0, 0, 90) elseif (mascara_vestida == "Bandido") then exports["bone_attach"]:attachElementToBone(mascaras[player], player, 1, 0, 0.02, -0.55, 0, 0, 90) end else sendMessageServer(player, "Você já tem uma mascara vestida!", "error") end end end end)
  6. When I randomly tap my voice button or just hold it for sec, I experience bug when event "onClientPlayerVoiceStop" is not being called. Anyone experience it yet? Image with UI representation of bug https://imgur.com/a/LfysaBA thanks for any replay ;)
  7. getJobMarker = createMarker(872.03754, -29.07278, 62.3000, "cylinder", 1.0, 0, 255, 255, 255, getRootElement()) ped = createPed(159, 872.92389, -27.08743, 63.94565, 160) setPedFrozen(ped, true) blip = createBlipAttachedTo(getJobMarker, 56) function hitMarkerWindow() window = guiCreateWindow(0.35, 0.35, 0.35, 0.30, "wood job", true) memo = guiCreateMemo(0.10, 0.20, 0.80, 0.4, "this is wood cutting job", true, window) accept = guiCreateButton(0.10, 0.75, 0.22, 0.14, "Accept Job", true, window) leave = guiCreateButton(0.35, 0.75, 0.22, 0.14, "Leave Job", true, window) close = guiCreateButton(0.60, 0.75, 0.22, 0.14, "Close", true, window) showCursor(true) guiMemoSetReadOnly(memo, true) end addEventHandler("onClientMarkerHit", getJobMarker, hitMarkerWindow) function clientClick() if source == close then guiSetVisible(window, false) showCursor(false) triggerServerEvent("cancelButton", resourceRoot, localPlayer) elseif source == accept then guiSetVisible(window, false) showCursor(false) triggerServerEvent("acceptWoodJob", resourceRoot, localPlayer) elseif source == leave then guiSetVisible(window, false) showCursor(false) triggerServerEvent("leaveJob", resourceRoot, localPlayer) end end addEventHandler("onClientGUIClick", root, clientClick)
  8. Hello, I recently returned to making a server after a year and I wanted to remind myself how the "source", "root", "this", "sourceResource", "sourceResourceRoot", "client" etc. Elements worked. Unfortunately, when I checked the MTA wiki, I didn't understand any of these elements. In general, the best help would be if someone explained to me how these elements work on examples for AddEventHandler because in mta wiki there is only one example for a "source" and I guess "root"? element
  9. Thisdp's DirectX Graphical User Interface System ( MTASA 2D+3D DxLIB ) This dxlib provide dx gui functions and events to make it easier to use and alternative to change the style more flexibly. Features: 1. Update Check(DGS will notice you if there is a higher version, and you can choose to ignore it or disable it in the config file) Update Command: "updatedgs" 2. Dx GUI Types: Basic: Window Edit Box Button Grid List Image Scroll Bar Scroll Pane Text Label Tab Panel Detect Area Radio Button Combo Box Check Box Memo 3D Interface 3D Text Browser Switch Button Selector Plugin: Media Browser Color Picker Mask Remote Image QRCode Blur Box Rounded Rectangle Nine Slice Scaling Object Preview Support Canvas Scroll Pane's 3D Effect 3. Edit/Memo rewrite ( You can no longer find the problems in dgs, the problems which exist in cegui) 4. Detect Area is efficient when checking whether your cursor is in a complicated shape. 5. Debug Mode , Command: "debugdgs" 6. You can apply shader to the dxgui ( Compatible with some resources like Objec tPreview ). 7. Include CMD, Command: "dgscmd" ( For more help, please input "help" in the CMD ) 8. Memo/Edit rewritten. 9. Object Oriented Programming Class. 10. Render Target Failure Check ( Warns when there's no enough video memory to create render target ). 11. DGS resembles cegui, you can find the similar feeling when scripting with dgs. 12. 48-hour-response service, your suggestions and bug report will be dealt with in 48 hours ( or less, like 12 hours ? ) 13. Custom Style system 14. Built-in shader plugin 15. More properties 16. Built in multi-language support 17. Simple GUI To DGS (G2D) Notice:Do not close your server or stop the script when it is updating. Wiki: https://wiki.multitheftauto.com/wiki/Dgs ( Still Working In Process ) Auto Completion For N++ (Thanks To Ahmed Ly): http://www.mediafire.com/file/m6dm7815d5dihax/Lua.zip Discord Server: https://discord.gg/QEs8q6W Download DGS : https://github.com/thisdp/dgs Notice: Need acl rights to call fetchRemote/getPlayerIP. If you want to sell your script which involves DGS, please exclude DGS from your price. HurtWorld Backpack Panel(Example) DGS Network Monitor(Built-in)
  10. It's about cambering the cars, but when I use the script and turn on ENBseries, the tires disappear due to a reflection that appears in the script for the tires. I want to remove that reflection from the resource. A video to watch : https://drive.google.com/file/d/1LmfHwTCUimI2Zb9B4CGD9KovExWfb4Cs/view?usp=sharing The resource: https://drive.google.com/file/d/1oUXeCGbVBb8uJbmUoesovndYl3rGumny/view?usp=sharing Help me please
  11. function fetchRemoteE() fetchRemote("site", function(responseData, errors) if errors == 0 then local finalResult = "Liberar" if responseData:match(finalResult) then -- ERRO ( Está comparando com todas as linhas do site juntas, ao invez de uma por uma.) print("FUNCIONANDO") else print(errors) print(responseData) print(finalResult) end end end) end COMO EU PODERIA FAZER PARA ELE COMPARAR LINHA POR LINHA COM O 'finalResult' ?
  12. Всем привет! Я решил сделать телефон. Как мы знаем, чтобы создать картинку на экране, нам нужен клиент. Но, так как основная часть на сервере, нужно вызвать клиентскую функцию на сервере. Вроде как сделал всё правильно (скриншоты можете видеть ниже), но не работает: картинка не появляется. В консоле никаких ошибок не выводится. Можете, пожалуйста, помочь с этой ошибкой? Сервер Клиент
  13. (Sorry if the text contains errors, I'm Russian). Hello! I decided to make a telephone. As we know, in order to create a picture on the screen, we need a client. But, since the main part is on the server, you need to call the client function on the server. It seems like I did everything right (you can see the screenshots below), but it does not work: the picture does not appear. No errors are displayed in the console. Can you please help with this error? Server Client
  14. Esta Dando Esse Erro 'end' expected (to close 'function' at line 5) near '<eof>' Server-Side function dxMsg(source, text, type) exports.dxmessages:outputDx(source, text, type) end function darDinheiro (source) if commandDelay[source] == nil and not istimer(commandDelay[source]) then local Dinheiro = getPlayerMoney(source) if Dinheiro >= 1200 then return dxMsg(source, "Você possui dinheiro de mais para receber o auxílio.", "error") end givePlayerMoney(source, 1200) dxMsg(source, "Você recebeu o auxílio.", "success") resetCommand(source, 1000) else dxMsg(source, "Você ja recebeu o auxílio.", "warning") end addCommandHandler('auxilio', darDinheiro)
  15. I would like to know about two things: 1. Are the server-side and client-side timers dangerous and why? 2. Is it possible to do the function GetTickCount () timer?
  16. moh2006

    help in code

    plz help in car trunk code client GUIEditor = { button = {}, window = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(1105, 265, 251, 282, "car remote", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetVisible(GUIEditor.window[1],false) GUIEditor.button[1] = guiCreateButton(23, 35, 88, 45, "unlock", false, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(144, 35, 88, 45, "lock", false, GUIEditor.window[1]) GUIEditor.button[3] = guiCreateButton(144, 127, 88, 45, "trunk", false, GUIEditor.window[1]) GUIEditor.button[4] = guiCreateButton(23, 127, 88, 45, "start", false, GUIEditor.window[1]) GUIEditor.button[5] = guiCreateButton(83, 211, 88, 45, "close", false, GUIEditor.window[1]) end ) local Key = "F7" bindKey(Key,"down", function() guiSetVisible(GUIEditor.window[1],not guiGetVisible(GUIEditor.window[1])) showCursor(guiGetVisible(GUIEditor.window[1])) end) addEventHandler("onClientGUIClick",root,function() if (source == GUIEditor.button[5]) then guiSetVisible(GUIEditor.window[1],false) showCursor(false) end end) addEventHandler("onClientGUIClick",root,function() if (source == GUIEditor.button[5]) then guiSetVisible(GUIEditor.window[1],false) showCursor(false) end end) addEventHandler("onClientGUIClick", getRootElement() , function (state) if state == "left" then if source == GUIEditor.button[2] then local spieler = getLocalPlayer() triggerServerEvent("doLockVehicle", spieler, spieler) end end end ) addEventHandler("onClientGUIClick", getRootElement() , function (state) if state == "left" then if source == GUIEditor.button[1] then local spieler = getLocalPlayer() triggerServerEvent("doUnlockVehicle", spieler, spieler) end end end ) addEventHandler("onClientGUIClick", getRootElement() , function (state) if state == "left" then if source == GUIEditor.button[4] then local spieler = getLocalPlayer() triggerServerEvent("motoranaus", spieler, spieler) end end end ) addEventHandler("onClientGUIClick", getRootElement() , function (state) if state == "left" then if source == GUIEditor.button[3] then local spieler = getLocalPlayer() triggerServerEvent("trunk", spieler, spieler) end end end ) -- Car Locks ( client ) -- local player localPlayer = getLocalPlayer ( ) -- playSoundNearElement addEvent ( "onPlaySoundNearElement", true ) function playSoundNearElement ( theElement, sound ) -- local sound = 5 local maxdist = 15.0 -- valid element if ( theElement ) then local x,y,z = getElementPosition ( theElement ) local x2,y2,z2 = getElementPosition ( localPlayer ) local dist = getDistanceBetweenPoints3D ( x, y, z, x2, y2, z2 ) -- distance is less than parameter maxdist if ( dist < maxdist ) then -- play parameter sound playSound("siren.mp3") -- outputChatBox ( "sound should play" ) else -- outputChatBox ( "not in range" ) end else -- outputChatBox ( "invalid element" ) end end addEventHandler ( "onPlaySoundNearElement", getRootElement(), playSoundNearElement ) function resourcestart () guiSetVisible(carbild, false) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), resourcestart) function fenster( ) guiSetVisible ( carbild, not guiGetVisible ( carbild ) ) showCursor ( guiGetVisible ( carbild ) ) end bindKey("z", "down", fenster) --[[ function oeffne_fenster() local IsWindowVisible = guiGetVisible(carbild) if (IsWindowVisible == true) then guiSetVisible(carbild, false) showCursor(false) end if (IsWindowVisible == false) then guiSetVisible(carbild, true) showCursor(true) end end bindKey("z", "down", oeffne_fenster) ]]-- addEventHandler("onClientGUIClick", getRootElement() , function (state) if state == "left" then if source == start_stop_b then local spieler = getLocalPlayer() triggerServerEvent("motoranaus", spieler, spieler) end end end ) server function motoran ( source ) local theVehicle if ( getElementType(source) == "vehicle" ) then theVehicle = source end if ( getElementType(source) == "player" ) then theVehicle = getElementData ( source, "cl_ownedvehicle" ) end if ( theVehicle ) then -- off or not set local lights = getVehicleOverrideLights ( theVehicle ) if ( getElementData( theVehicle, "cl_enginestate" ) == false ) then setElementData( theVehicle, "cl_enginestate", true) setVehicleEngineState( theVehicle, true ) else -- on -- set to off setElementData( theVehicle, "cl_enginestate", false ) setVehicleEngineState( theVehicle, false ) end setVehicleOverrideLights ( theVehicle, lights ) else Err_Msg("ليس لديك سيارة", source ) end end addEvent("motoranaus",true) addEventHandler("motoranaus", getRootElement() , motoran) -- ================= -- Car Locks ( server ) -- by moh2006 -- ================= -- player element data -- -- cl_ownedvehicle -- vehicle element data -- -- cl_vehicleowner -- cl_vehiclelocked -- cl_enginestate -- resource starts - ends function initCarLocks () -- Initilize Player Element Data local players = getElementsByType ( "player" ) for k,p in ipairs(players) do removeElementData ( p, "cl_ownedvehicle" ) bindKey ( p, "l", "down", doToggleLocked ) end -- Initilize Vehicle Element Data local vehicles = getElementsByType ( "vehicle" ) for k,v in ipairs(vehicles) do removeElementData ( v, "cl_vehicleowner" ) removeElementData ( v, "cl_vehiclelocked" ) removeElementData ( v, "cl_enginestate" ) setVehicleLocked ( v, false ) setVehicleOverrideLights ( v, 0 ) end end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), initCarLocks ) addEventHandler ( "onResourceStop", getResourceRootElement ( getThisResource () ), initCarLocks ) -- player joins function cl_PlayerJoin ( ) bindKey ( source, ";", "down", doToggleLocked ) end addEventHandler ( "onPlayerJoin", getRootElement(), cl_PlayerJoin ) -- player quits function cl_PlayerQuit ( ) -- check for owned car local ownedVehicle = getElementData ( source, "cl_ownedvehicle" ) if (ownedVehicle ~= false) then cl_RemoveVehicleOwner ( ownedVehicle ) end end addEventHandler ( "onPlayerQuit", getRootElement(), cl_PlayerQuit ) -- player dies function cl_PlayerWasted ( ) -- check for owned car local ownedVehicle = getElementData ( source, "cl_ownedvehicle" ) if (ownedVehicle ~= false) then cl_RemoveVehicleOwner ( ownedVehicle ) end end addEventHandler ( "onPlayerWasted", getRootElement(), cl_PlayerWasted ) -- player tries to enter vehicle function cl_VehicleStartEnter ( enteringPlayer, seat, jacked ) local theVehicle = source local theOwner -- locked and not owner entering if ( getElementData ( theVehicle, "cl_vehiclelocked" ) == true ) then theOwner = getElementData ( theVehicle, "cl_vehicleowner" ) if theOwner ~= false and theOwner ~= enteringPlayer then -- make sure they dont enter --cancelEvent(); end end end addEventHandler ( "onVehicleStartEnter", getRootElement(), cl_VehicleStartEnter ) -- player enters a vehicle function cl_PlayerDriveVehicle ( player, seat, jacked ) -- Driver Enter if ( seat == 0 ) then oldVehicle = getElementData ( player, "cl_ownedvehicle" ) -- not entering player's own owned vehicle if ( (cl_VehicleLocked(source) == true) and (cl_VehicleOwner(source) ~= player) ) then removePlayerFromVehicle( player ) Err_Msg("Este veículo está trancado.", player) return false end -- set element data for vehicle and owner cl_SetVehicleOwner ( source, player ) end return true end addEventHandler ( "onVehicleEnter", getRootElement(), cl_PlayerDriveVehicle ) -- vehicle respawns function cl_VehicleRespawn ( exploded ) cl_RemoveVehicleOwner ( source ) end addEventHandler ( "OnVehicleRespawn", getRootElement(), cl_VehicleRespawn ) -- vehicle explosion function cl_VehicleExplode ( ) local theOwner = getElementData ( source, "cl_vehicleowner" ) if ( theOwner ~= false ) then cl_RemoveVehicleOwner ( source ) end end addEventHandler ( "onVehicleExplode", getRootElement(), cl_VehicleExplode ) -- set vehicle owner function cl_SetVehicleOwner ( theVehicle, thePlayer ) local oldVehicle = getElementData ( thePlayer, "cl_ownedvehicle" ) if ( oldVehicle ~= false ) then -- unlock old car removeElementData ( oldVehicle, "cl_vehicleowner" ) removeElementData ( oldVehicle, "cl_vehiclelocked" ) removeElementData ( oldVehicle, "cl_enginestate" ) setVehicleLocked ( oldVehicle, false ) -- set vars for new car end setElementData ( theVehicle, "cl_vehicleowner", thePlayer ) setElementData ( theVehicle, "cl_vehiclelocked", false ) setElementData ( thePlayer, "cl_ownedvehicle", theVehicle ) setElementData( theVehicle, "cl_enginestate", true ) end function cl_RemoveVehicleOwner ( theVehicle ) local theOwner = getElementData ( theVehicle, "cl_vehicleowner" ) if ( theOwner ~= false ) then removeElementData ( theOwner, "cl_ownedvehicle" ) removeElementData ( theVehicle, "cl_vehicleowner" ) removeElementData ( theVehicle, "cl_vehiclelocked" ) removeElementData ( owned, "cl_enginestate" ) end setVehicleLocked ( theVehicle, false ) end -- flash the lights twice function cl_FlashLights ( thePlayer ) setTimer ( doToggleLights, 300, 4, thePlayer, true ) end -- flash once function cl_FlashOnce ( thePlayer ) setTimer ( doToggleLights, 300, 2, thePlayer, true ) end -- get vehicle owner ( according to vehicle's element data ) function cl_VehicleOwner ( theVehicle ) return getElementData( theVehicle, "cl_vehicleowner" ) end -- is vehicle locked ( according to vehicle's element data ) function cl_VehicleLocked ( theVehicle ) return getElementData( theVehicle, "cl_vehiclelocked" ) end -- messaging functions -- send red error message function Err_Msg ( strout, thePlayer ) outputChatBox ( strout, thePlayer, 200, 0, 10 ) end -- send message to all occupants of vehicle function Car_Msg ( strout, theVehicle ) numseats = getVehicleMaxPassengers ( theVehicle ) for s = 0, numseats do local targetPlayer = getVehicleOccupant ( theVehicle, s ) if targetPlayer ~= false then outputChatBox ( strout, targetPlayer, 30, 144, 255 ) end end end -- send aquamarine message to player function Info_Msg ( strout, thePlayer ) outputChatBox ( strout, thePlayer, 102, 205, 170 ) end -- commands function doToggleLockeds ( source ) local theVehicle , strout if ( getElementType(source) == "vehicle" ) then theVehicle = source end if ( getElementType(source) == "player" ) then theVehicle = getElementData ( source, "cl_ownedvehicle" ) end if ( theVehicle ) then local vehiclename = getVehicleName ( theVehicle ) -- already locked if ( getElementData ( theVehicle, "cl_vehiclelocked") == true ) then doUnlockVehicle ( source ) else doLockVehicle ( source ) end else Err_Msg("ليس لديك سيارة", source) end end addEvent("doUnlockVehicle",true) addEventHandler("doUnlockVehicle", getRootElement() , doToggleLockeds) function doToggleLocked ( source ) local theVehicle , strout if ( getElementType(source) == "vehicle" ) then theVehicle = source end if ( getElementType(source) == "player" ) then theVehicle = getElementData ( source, "cl_ownedvehicle" ) end if ( theVehicle ) then local vehiclename = getVehicleName ( theVehicle ) -- already locked if ( getElementData ( theVehicle, "cl_vehiclelocked") == true ) then strout = "Your " .. vehiclename .. " is already locked." Err_Msg(strout, source) else setElementData ( theVehicle, "cl_vehiclelocked", true) setVehicleLocked ( theVehicle, true ) Car_Msg( "Arac " .. vehiclename .. " قفل السيارة.", theVehicle) Info_Msg ( "تم فك قفل السيارة", source ) if ( getVehicleController ( theVehicle ) == false ) then cl_FlashLights ( source ) end end else Err_Msg("ليس لديك سيارة", source) end end addEvent("doLockVehicle",true) addEventHandler("doLockVehicle", getRootElement() , doToggleLocked) function doUnlockVehicle ( source ) local theVehicle, strout if ( getElementType(source) == "vehicle" ) then theVehicle = source end if ( getElementType(source) == "player" ) then theVehicle = getElementData ( source, "cl_ownedvehicle" ) end if ( theVehicle ) then local vehiclename = getVehicleName ( theVehicle ) if ( getElementData ( theVehicle, "cl_vehiclelocked") == false ) then strout = "السيارات " .. vehiclename .. " مقفلة بالفعل." Err_Msg(strout, source) else setElementData ( theVehicle, "cl_vehiclelocked", false) setVehicleLocked ( theVehicle, false ) Car_Msg( "السيارة " .. vehiclename .. " فتحت.", theVehicle ) Info_Msg ( "فتح القفل.", source ) if ( getVehicleController ( theVehicle ) == false ) then cl_FlashOnce ( source ) end end else Err_Msg("ليس لديك سيارة", source) end end function doToggleLights ( source, beep ) local theVehicle if ( getElementType(source) == "vehicle" ) then theVehicle = source end if ( getElementType(source) == "player" ) then theVehicle = getElementData ( source, "cl_ownedvehicle" ) end if ( theVehicle ) then -- if he was in one if ( getVehicleOverrideLights ( theVehicle ) ~= 2 ) then -- if the current state isn't 'force on' setVehicleOverrideLights ( theVehicle, 2 ) -- force the lights on -- play sound close to element if ( beep == true ) then local theElement = theVehicle triggerClientEvent ( getRootElement(), "onPlaySoundNearElement", getRootElement(), theElement, 5) end else setVehicleOverrideLights ( theVehicle, 1 ) -- otherwise, force the lights off end else Err_Msg("ليس لديك سيارة", source ) end end addEvent("doToggleLight",true) addEventHandler("doToggleLight", getRootElement() , doToggleLights) addCommandHandler ( "engine", motoran ) addCommandHandler ( "lights", doToggleLight, false) addCommandHandler ( "lock", doLockVehicle ) addCommandHandler ( "unlock", doUnlockVehicle ) addCommandHandler ("trunk", trunk) if you help thanks for help....
  17. I have one question about client objects, if I use the "TriggerClientEvent" function on the server side script, whether the object that was saved on the client side and will be set with the triggerClientEvent function on the server side, will every player see it and will work in the same way as normally I would call it in the server side script "createObject (object, x, y, z)"? For example, such -- client addEvent("createObject", true) addEventHandler("createObject", root, function(object, x, y, z) createObject(x, y, z) end ) -- server triggerClientEvent(root, "createObject", root, 1372, 0, 0, 5) -- Would that be the same as this? -- server createObject(1372, 0, 0, 5)
  18. Hello MTA team i've expected an error while trying to run mta on linux . this is the screenshot of the error : https://cdn.discordapp.com/attachments/623268793803603999/757220417923448862/unknown.png and thank you in advance :)
  19. Hello there. I'm looking for way to make markers of type 'arrow' to move up and down like enex markers in singleplayer, how can I do it?
  20. function StandardWep() local x, y, z = getElementPosition(getLocalPlayer()) wep = createWeapon("m4", x+5, y, z) setWeaponFlags(wep, "shoot_if_blocked", false) setWeaponFiringRate(wep, 35) setWeaponProperty(wep, "damage", 25) setWeaponClipAmmo(wep, 35) setWeaponAmmo(wep, 100) end addCommandHandler("OnStandardWep", function(command, state) local s = string.upper(state) if s=="ON" then setWeaponState(wepM16, "firing") elseif s=="false" then setWeaponState(wepM16, "ready") else outputChatBox("There is no such condition of the weapon, you can only use 'ON / OFF'", 255, 50, 0) end end ) The point is that it does not hurt other players, what's more, other players do not even see the line of fire (I mean the yellow line which means how fast the bullets are moving and in which direction) and the weapon itself (M4), I know that you need to use triggerClientEvent but no I know how to apply it, please help me with an example ; -;
  21. The question is the following needs to get an item from the server side to the client side, how can I do it? (Elements such as markers, vehicles etc.)
  22. I would like to know how I could get ElementData from server to client and vice versa -- server side marker = createMarker(0, 0, 1.5, "cylinder", 2, 255, 0, 0) setElementData(marker, "Item", 5) addEvent("GetItem", true) addEventHandler("GetItem", root, function() ClientMarker = marker ItemOfClientMarker = getElementData(marker, "Item") end) addEventHandler("onMarkerHit", marker, function(hp) triggerClientEvent("Element", resourceRoot) setElementData(hp, "ItemTwo", ElementVariable+getElementData(marker, "Item")) end) -- client side function dxDrawTextOnElement(TheElement,text,height,distance,R,G,B,alpha,size,font,...) local x, y, z = getElementPosition(TheElement) local x2, y2, z2 = getCameraMatrix() local distance = distance or 20 local height = height or 1 if (isLineOfSightClear(x, y, z+2, x2, y2, z2, ...)) then local sx, sy = getScreenFromWorldPosition(x, y, z+height) if(sx) and (sy) then local distanceBetweenPoints = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) if(distanceBetweenPoints < distance) then dxDrawText(text, sx+2, sy+2, sx, sy, tocolor(R or 255, G or 255, B or 255, alpha or 255), (size or 1)-(distanceBetweenPoints / distance), font or "arial", "center", "center") end end end end setElementData(getLocalPlayer(), "ItemTwo", 0) addEvent("Element", true) addEventHandler("Element", root, function() ElementVariable = getElementData(getLocalPlayer() , "ItemTwo") end) addEventHandler("onClientRender", root, function() triggerServerEvent("GetItem", root) dxDrawTextOnElement(ClientMarker, tostring(ItemOfClientMarker), 2, 50, 255, 255, 0, 3, "arial") end) Does it have a chance to work? because that's something I imagine...
  23. The case looks like this, I have a variable (Let's call it Ammo) that IS TO be in the giveWeapon function (source, 22, Ammo, true) but the problem is that this Ammo variable has the script type "client" and the function is the server script type, so how can I make this variable in this function? If someone has not understood what is going on, there is still a code to simplify... -- Client side local Ammo = 60 local AmmoMarker = createMarker(0, 0, 1, "cylinder", 2.0) local WeaponMarker = createMarker(0, 0, 1, "cylinder", 2.0) addEventHandler("onClientMarkerHit", AmmoMarker, function() Ammo = Ammo + 1 end) addEventHandler("onClientMarkerHit", WeaponMarker, function() -- Here I get a weapon, the variable "Ammo" is the number of bullets end) -- Server Side --??? Problem with importing variable "Ammo"
  24. Hey guys please help!!! I have been researching and researching for almost 8 hours now. And I am just stuck as to what I am fundamentally getting wrong here. Main goal: I would like when the person gets into a vehicle, read the license plates, send plates to the server, read a table in the DB, then send info from table back to the client to use in other functions. What works: I am OK server side, I am able to read from the database and pass that back to the client, but can only trigger server side with a RegisterCommand. Issue: Client side, when I start using triggers inside of an if statement it stops working, (yes I am sure conditions are met). I am currently only able to trigger the server function with a register command, when I try to send a trigger from the client to the server, it will not launch the server function. Working code: client.Lua RegisterNetEvent("servertest:output_status") --from server.Lua AddEventHandler("servertest:output_status", function(argument) TriggerEvent("chatMessage", "[Success]", {0,255,0}, argument) TriggerEvent("servertest:vehStatus", argument) end) Citizen.CreateThread(function() while true do Citizen.Wait(1000) local playerPed = GetPlayerPed(-1) if IsPedInAnyVehicle(playerPed, false) then AddEventHandler("servertest:vehStatus", function(vehstatus) TriggerEvent("chatMessage", "[LOOP]", {0,255,0}, vehstatus) end) end end end) server.Lua: RegisterCommand("get", function(source, args) --I dont want to trigger this way, I want to trigger from client side MySQL.Async.fetchAll('SELECT * FROM vehicle_data WHERE plate = @plate', { ['@plate'] = "TSTPLATE1" }, function(result) if result[1] then local vehstatus = result[1].status TriggerClientEvent("servertest:output_status", source, vehstatus) cb(true) else cb(false) end end) end) What I want to do: client.Lua: RegisterNetEvent("servertest:output_status") --from server.Lua AddEventHandler("servertest:output_status", function(argument) TriggerEvent("chatMessage", "[Success]", {0,255,0}, argument) --never receive message TriggerEvent("servertest:vehStatus", argument) --not used now, save for later use end) Citizen.CreateThread(function() while true do Citizen.Wait(1000) local playerPed = GetPlayerPed(-1) if IsPedInAnyVehicle(playerPed, false) then local playerVeh = GetVehiclePedIsIn(playerPed, false) local vehPlates = GetVehicleNumberPlateText(playerVeh) TriggerServerEvent("servertest:sendInfo", vehPlates) --this trigger never happens even though criteria is met end end end) server.Lua: RegisterNetEvent("servertest:sendInfo") AddEventHandler("servertest:sendInfo", function(plates) MySQL.Async.fetchAll('SELECT * FROM vehicle_data WHERE plate = @plate', { ['@plate'] = plates }, function(result) if result[1] then local vehstatus = result[1].status TriggerClientEvent("servertest:output_status", source, vehstatus) cb(true) else cb(false) end end) end) I guess maybe what I need to know is just how to trigger something server side from the client side without using a RegisterCommand. I don't know how to structure it in my code, do I need to do it outside the while loop? I've tried but haven't been successful.
  25. Hello, I have a doubt: Is possible enable individually Cbug? By example: Type /cbug and the player that typed the command can get the glitches activated, not the other players. It's possible?
×
×
  • Create New...