Jump to content

MADD NØG

Members
  • Posts

    33
  • Joined

  • Last visited

Everything posted by MADD NØG

  1. I'm managing to query values normally, but I can't change values, I'm trying something like this, I know it's possible, but I don't understand how to send information with fetchRemote local apiKey = "..." local forumAddress = "..." function testing(orderID, content) local sendOptions = { connectionAttempts = 5, connectTimeout = 7000, method = post headers = { ["Content-Type"] = "application/json", -- i try this { "status": "completed" } -- }, } fetchRemote( forumAddress.."/wp-json/wc/v3/"..postID.."?key="..apiKey, sendOptions, function()end) end Here how Woo API updates data with postman for example curl -X PUT https://example.com/wp-json/wc/v3/orders/727 \ -u consumer_key:consumer_secret \ -H "Content-Type: application/json" \ -d '{ "status": "completed" }' I'm managing to query data from my database, but I don't understand how I can send this update in json to change the order data, I currently use change via MySQL, but I'm trying to migrate 100% to the API
  2. and if I want to get for example what is inside ["name"] "table": { "id": 123, "items": [ { "id": 105, "name": "Hellow Word", "meta_data": [ { "id": 695, "key": "stock", } ] } ] } local results = result[items][name][1]
  3. I don't know how I can explain this bug, I'll try Currently the only way I know of to make a customizable character is via Shader, but I'm having a little problem and was wondering if there's a solution. When I activate any ENB that has Light effects and add a texture with ApplyShader the part that has Alpha looks like the image below This is the big problem, I need the textures to have Alpha so that when I add, for example, a shirt that crosses the character's torso, this texture becomes invisible, which does not happen, if I remove the alpha from the texture it will turn white . I'll leave some examples of how the script works in case anyone is interested in helping me. More basically, the character customization system works like this, you build the entire 3D character by placing several objects on the same ped, then in the .txd you define all the .png textures and 100% transparent and with a resource you define the textures, the same way car paintjobs are done. Links for examples: (enbeffect.fx, enbeffect.fx.ini, example.txd) https://mega.nz/folder/p1hGRQrB#RId7IdhNMl-9HzWsvnTHgg Character Customization topic: https://forum.multitheftauto.com/topic/132795-helpcharacter-customization/?do=findComment&comment=1002219
  4. Com Element data você vai conseguir fazer isso de uma forma mais básica, se você estiver desenvolvendo um inventário com vários itens, ai é interessante e mais otimizado você utilizar uma tabelas com todos os itens, mais como é algo básico você pode usar SetElementData para criar seu Kit Médico por exemplo: setElementData(player, "kit", 1) -- Você está adicionando ao player 1 kit médico -- Agora você pode desenvolver seu código usando getElementData para consultar os dados getElementData(player, "kit") -- Aqui eu consultei quantos kits esse player tem function showKits(source, commandName, playerName) local thePlayer = getPlayerFromName(playerName) if (thePlayer) then local kitnumber = getElementData(thePlayer, "kit") -- Aqui eu consultei quantos kits esse player tem if kitnumber > 0 then outputChatBox(getPlayerName(thePlayer).." você tem "..kitnumber.." kits médicos", source ) -- mostra no chat quantos kits você tem else outputChatBox ( "Você não tem Kits", source ) -- display an error end end end -- Add a console command joinTime, that takes an optional parameter of a player's name addCommandHandler ( "kit", showKits) Acho que vai dar certo isso ai, mais como eu disse não é o método mais efetivo para construir um sistema mais complexo, com tabelas da para fazer algo mais otimizado.
  5. É possível importar o mapa todo mais vai tornar o gameplay e o desempenho do server inviável, o que você iria precisar fazer é exportar todo o mapa do GTA:V (Code Walker) e abrir ele no 3DS Max, exportar as coordenadas com o Kams Script com seus IPL, IDE, TXD e DFF você iria usar o MTA-Map-Convertor e o MTA-Stream para converter e carregar o mapa automaticamente. Como são muitos objetos com toda certeza o GTA:SA não teria IDS suficientes para carregar todos (se não me engano esses dois resources que eu linkei acima talvez resolvam esse problema, ou estou confundindo com o Limit Adjuster que o pessoal usa no GTA:SA), muito provável dar vários bugs e se não desse bugs, é um mapa muito grande com muitos detalhes (Vértices e texturas em alta resolução), que demandaria bastante processamento e espaço de disco, na minha visão é perda de tempo, com 50 players já seria um caos, o que você pode fazer é exportar os locais mais icônicos do GTA:V e adaptar ao mapa do GTA:SA pensando em um servidor jogável para vários players
  6. Marcha no corola, pode dropar a vontade!
  7. Você pode criar seu site com Wordpress e usar o plugin Woocommerce para realizar as vendas, e utilizar a api do plugin para aprovar as solicitações enviando sinais com fetchremote, você também pode conectar manualmente ao banco de dados do Wordpress e fazer as verificações manualmente, funciona, porem não recomendo por métodos de segurança, usar uma API é sempre mais seguro.
  8. ObjectInACLGroup só pode ser usado no lado do servidor, se você usar no clientside vai dar erro
  9. Se está mostrando a segunda opção é porque você não está na staff, você não está setando o elementdata Staff em você, logo a segunda opção vai ser mostrada, faça o teste troque true por false e vai mostrar a primeira opção, para setar esse elementdata você usa setElementData(source, "Staff", true), para fazer isso automático muitos devs implementam isso no painel de contas, assim que você faz o login ele seta esse elemento no player (Se você não setar, automaticamente vai retornar false, só é preciso setar nos staffs)
  10. If e else são basicamente maneiras de executar ações, pense que if seria algo como se e else algo como senão se(if) player estiver na Staff execute(then) chat com Nick e ID senão(else) mostre o chat sem nick e id for _, player in ipairs(getElementsByType("player")) do local ID = getElementData(player, "ID") local PlayerName = getPlayerName(player) if (getElementData(player, "Staff") == true) then -- Há duas opções true se ele está na Staff ou false se não estiver -- Se ele esta na staff o valor será true e irá executar esse outputChatBox outputChatBox(...) else -- else é para quando o if não foi acionado, no caso se o palyer estiver como false o if não é acionado e o else é chamado -- Assim o segundo outputChatBox é acionado outputChatBox(...) end end adminchat ( source, MessagemANS15 ) end end addCommandHandler ( "u", MensagemAnon )
  11. Tente algo assim, getElementData(player, "ID") é como você vai pegar o ID do player assim como o nick, eu usei exemplos genéricos você precisa pegar os do seu servidor, no código se o player estiver com o getElementData(player, "Staff") ele vai receber o outputChatBox com as infos ID e PlayerName. local ID = getElementData(player, "ID") local PlayerName = getPlayerName(player) if (getElementData(player, "Staff") == true) then outputChatBox("#0388fc["..ID.."|"..PlayerName.."]#00FFFFB#FFFFFFV#00FFFFZ - #000000[Deep-Web] - #ffffff: "..MessagemANS105, player, 255, 255, 255, true) else outputChatBox(" #00FFFFB#FFFFFFV#00FFFFZ - #000000[Deep-Web] - #ffffff"..MessagemANS105, player, 255, 255, 255, true) end
  12. Em getRandomID você não especificando para ele converter o resultado em dígitos numéricos com tonumber, em getnick você esta comparando o valor em número com uma string logo os valores não vão ser iguais, você pode ou pegar o getRandomID e converter para tonumber ou só ir em getnick e ao invés de converter para tonumber só converte para tostring -- local playerID = tonumber(id) -- Remove isso local playerID = tostring(id) -- e subistitui por isso
  13. Com isso aqui você consegue um número aleatório, porem ao deslogar do servidor, quando ele voltar vai ser outro ID, o que você pode fazer para manter o ID é usar um banco de dados SQL para armazenar as informações do player, e quando ele logar você pega essas informações. function genRandomID() local rnumber = "" local chars = "1234567890" for i = 1, 5 do -- Aqui você define a quantidade de digitos, aqui vai ser gerado um numero com 5 digitos local rand = math.random(#chars) rnumber = rnumber .. chars:sub(rand, rand) end return rnumber end Antes você definia o número do ID pegando o getAccountACC, agora você vai trocar pela variável randomID que vai gerar um ID de 5 dígitos aleatórios local randomID = genRandomID() setElementData(source, "ID", randomID or "N/A" ) Problemas que você pode enfrentar se não salvar esse valor em algum lugar é que ao usar sistemas, por exemplo, uma loja de carros que carrega seus carros comprados pelo seu ID, quando você deslogar vai ser gerado um novo ID e a loja de carros não vai setar os carros no ID novo. Procure e estude por save-systems e por banco de dados SQLite e MySQL você vai conseguir salvar esses dados e muitos outros de uma forma profissional e efetiva
  14. I'm trying to add an animation to a ped that is being created on the server side, but this animation is customized and it doesn't work, I've tested numerous ways and it works only on the client side, but I necessarily need this ped to be created on the side from the server local customIfp = nil local customBlockName = "mp_character" local animationNames = { "nameplate" } ped = createPed(...) --[[ on the client side it is working ]] setTimer(setPedAnimation, 100, 1, ped, "mp_character", "nameplate", -1, false, false, false) addEventHandler("onClientResourceStart", resourceRoot, function ( startedRes ) customIfp = engineLoadIFP("ped.ifp", customBlockName) if customIfp then bindKeys () outputChatBox ("ped.ifp Loaded successfully") else outputChatBox ("Failed to load ped.ifp") end end ) I wanted to find a solution or for this problem of only working on the client side or a way for me to be able to trigger this animation with a trigger from the client to the server, but I haven't been successful yet, I couldn't get the information from the ped on the side of client
  15. Com essa função você consegue resolver esse problema guiGetScreenSize mais vai precisar reescrever sua HUD novamente. Tem vários guias explicando como usar aqui no fórum. guiGetScreenSize retorna a resolução do player e a partir dai você desenvolve cálculos para posicionar sua HUD em todas as resoluções
  16. Não há limite em peso e sim de vértices que o GTA San Andreas consegue carregar, 65k de vértices é o limite acima disso sua skin não vai ser carregada, já sobre texturas não há limite em quantidades, a resolução ideal para texturas que a Rockstar usa por padrão em seus jogos é de 256x256 a 512x512 são as que foram usadas no GTA SA já no GTA V são entre 512x512 a 2042x2042 (acima de 1024 você já vai sofrer com bugs de renderização e não há necessidade de exceder esses limites) 512x512 e 1024x1024 são o padrão que eu uso e funciona muito bem
  17. I want to get the Hello information but I only get the nill information, I'm sure I'm doing it wrong can anyone help me? "table": { "code_one": 113, "code_descriptions": [ "hello world" ], "code_two": 0 } } Server-side fetchRemote("[...]", function(data) local result = fromJSON(data) local code = tonumber(result["table"]["code_one"]) local descriptions = tonumber(result["table"]["code_descriptions"]) print(code) -- its work, show 113 print(descriptions) -- not working, show nill value end, nil, true)
  18. I'm having problems trying to use getServerIp() and it returns the default 127.0.0.1, because the function it's requesting is apparently starting before fetchRemote gets the IP, I tested it in a separate resource and it works fine, but I wanted to use everything in just one resource. Example like this return the default SERVER_IP = "127.0.0.1" function getServerIp() return SERVER_IP end fetchRemote("http://checkip.dyndns.com/", function (response) if response ~= "ERROR" then SERVER_IP = response:match("<body>Current IP Address: (.-)</body>") or "127.0.0.1" end end) function ipTesting() if connection then --local serverIp = getServerConfigSetting("serverip") // I don't understand why it doesn't return the real IP when the ip in mtaserver is set to auto (it would be less stressful getServerConfigSetting("serverip") to return the IP of the server even though it is set to auto) local serverIp = getServerIp() if serverIp then print(serverIp) --[[ Result 127.0.0.1 ]]-- end end When I add a SetTimer to wait for fetchRemote to return the value I get the server IP without any problems Does anyone know of a way to resolve this? I specifically need to receive the IP when starting the resource and I was only able to do it through an external resource, I wanted to do everything in just one file, help me
  19. I'm trying to load another way in a resource I put the following code to receive a confirmation code Clientside local hashCodeString = false; addEventHandler('onClientResourceStart',resourceRoot,function() triggerServerEvent("onPlayerReady", resourceRoot); end) addEvent("onClientReceivePermissions", true); addEventHandler("onClientReceivePermissions", resourceRoot, function(_hashCodeString) hashCodeString = _hashCodeString; end, false); function getResourceStatus() return hashCodeString end Serverside addEvent("onPlayerReady", true); addEventHandler("onPlayerReady", resourceRoot, function() local hashCodeString = "hashcode" triggerClientEvent(client, "onClientReceivePermissions", resourceRoot, hashCodeString); end, false); Meta <export function="getResourceStatus" type="client" /> <download_priority_group>2</download_priority_group> Then in another resource that I only have access to clientside I receive this code and confirm if everything is ok I start the models local hashCodeNumberTwo = false local hashCodeNumberOne = false local function loadModel(path, model) engineImportTXD(engineLoadTXD(...) engineReplaceModel(engineLoadDFF(...) collectgarbage() end addEventHandler('onClientResourceStart',resourceRoot,function() loadModel(...) setTimer(function() hashCheck() end, 5000, 1) end) function hashCheck() local hashCodeNumberOne = "hashcode" local hashCodeNumberTwo = "hashcode" local getHashCodeOne = exports["resourceOne"]:getResourceStatus() local getHashCodeTwo = exports["resourceTwo"]:getResourceStatus() if not getHashCodeOne then if hashCodeNumber ~= getHashCodeOne then engineRestoreModel(...) engineRestoreModel(...) end end if not getHashCodeTwo then if getHashCodeTwo ~= hashCodeNumberTwo then engineRestoreModel(...) end end end The problem is that for some people the models don't load or what I think it could be is that getHashCodeTwo is returning false and the models are being restored after being loaded, do you have any idea what I could be doing wrong?
  20. very good, I will try here, years ago I tried to do the same and I was not successful, thanks for sharing
  21. I tested it as you indicated, but I still have some questions! Client-Side local yMMX83dl33KHiPKetn = false local firstConnection = true local function decodeSource(path, key) local file = fileOpen(path) local size = fileGetSize(file) local FirstPart = fileRead(file, 65536 + 4) fileSetPos(file, 65536 + 4) local SecondPart = fileRead(file, size - (65536 + 4)) fileClose(file) return decodeString('tea', FirstPart, { key = key })..SecondPart end local function loadMod(path, model, passwordHash) engineImportTXD(engineLoadTXD(decodeSource('models/' .. path .. '.txd', passwordHash)), model) engineReplaceModel(engineLoadDFF(decodeSource('models/' .. path .. '.dff', passwordHash)), model) end addEvent("loadingModels",true) addEventHandler("loadingModels", resourceRoot, function() loadMod(...) loadMod(...) yMMX83dl33KHiPKetn = true privateKey() end) function privateKey() if yMMX83dl33KHiPKetn == true then outputDebugString("True", 4, 2, 137, 218) if not firstConnection then firstConnection = true end else triggerServerEvent("resourceCheck", resourceRoot) engineRestoreModel(1) engineRestoreModel(2) outputDebugString("false", 4, 255, 0, 0) setTimer(privateKey, 1000, 0) firstConnection = false yMMX83dl33KHiPKetn = false end end addEventHandler("onClientResourceStart",getRootElement(),function(res) if getResourceName(res) == "chars" or getThisResource() == res then triggerServerEvent("resourceCheck", resourceRoot) end end); Server Side addEvent("resourceCheck",true) addEventHandler("resourceCheck", getRootElement(), function() if isObjectInACLGroup("resource."..resourcename, aclGetGroup(acl)) then local file = fileOpen(":"..resourcename.."/engine/"..ServerConf..".lua") if not file then return false end local count = fileGetSize(file) local data = fileRead(file, count) local fileSize = count -- tonumber(16678) fileClose(file) if count == fileSize then file1, file2, file3 = getResourceFiles(getThisResource()) if #file3 == defaultfolders then triggerClientEvent(client, "loadingModels", resourceRoot) else stopResource(getThisResource()) end else stopResource(getThisResource()) return end else stopResource(getThisResource()) end end) More as you warned that I was triggering this event for all players, this causes a memory error when there are many players on the server, and it continues to cause this currently with this code, I'm sure it's referring to the part of me using a triggerServerEvent next to the onClientResourceStart, but I don't know how I can start this check other than this way.
  22. Da uma olhada nesse tópico aqui Basicamente ele pega a informação pelo lado do server e envia para o client, assim você vai conseguir fazer o que está tentando. No server você aciona um evento para checar se o player tem autorização para acessar o marker. addEvent("onPlayerReady", true); addEventHandler("onPlayerReady", resourceRoot, function() local has_policia = isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(client)), aclGetGroup ("Policia")); triggerClientEvent(client, "onClientReceivePermissions", resourceRoot, has_policia); end, false );
  23. I have a script to load character skins, but I need to have some way to check if there are files on the serveside (I check on my website the credentials of the client that is starting the resource, to see if he is authorized to start, but if he removes the server file, it can start the models without too many problems) thinking about this problem this was the only solution I found, if anyone has any suggestions on how I can force the resource owner to use a server file: Client (As I need to force the resource owner to start at least 1 file on the server I add an onClientResourceStart to a server side event, if everything goes well it returns a true variable) local keyAcess = false addEvent("accessGranted", true) addEventHandler("accessGranted", resourceRoot, function() keyAcess = true end) local function privateKey() setTimer(function() if keyAcess == true then outputDebugString("true", 4, 2, 137, 218) if not firstConnection then firstConnection = true end else triggerServerEvent("checkCredentials", resourceRoot) engineRestoreModel(1) engineRestoreModel(2) outputDebugString("false", 4, 255, 0, 0) setTimer(privateKey, 1000, 0) firstConnection = false keyAcess = false end end, 5000, 1) end addEventHandler("onClientResourceStart", resourceRoot, privateKey) addEventHandler("onClientResourceStart",getRootElement(),function(res) if getResourceName(res) == "chars" or getThisResource() == res then triggerServerEvent("checkCredentials", resourceRoot) loadMod('mp_male', 1, 'passwordToDecompileTheModel ') loadMod('mp_female', 2, 'passwordToDecompileTheModel') end end); The problem is that sometimes, for a reason I haven't figured out yet, it doesn't return the keyAccess as true and the engineRestoreModel function fires because it's in false It could be a player with a high ms or even a server hardware problem or some error in my code, I couldn't identify it yet Server addEvent("checkCredentials",true) addEventHandler("checkCredentials", getRootElement(), function() if isObjectInACLGroup("resource."..nomeResource, aclGetGroup(acl)) then triggerClientEvent("accessGranted", resourceRoot) else stopResource(getThisResource()) end end)
  24. Com isso você consegue fazer, isObjectInACLGroup if isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then
×
×
  • Create New...