Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/04/23 in all areas

  1. Thats probably because server-side is running before client side, so, in this case, you should make a trigger from the client to the server and send the response back to the client again. Not sure if there is a better option for it cuz using a timer is not a good idea aswell ... So here goes my solution: -- ## CLIENT-SIDE local myCountry = "" addEvent("onPlayerCountryReceived", true) addEventHandler("onPlayerCountryReceived", root, function(country) outputChatBox(country) myCountry = country end) addEventHandler("onClientResourceStart", resourceRoot, function () triggerServerEvent("onRequestPlayerCountry", resourceRoot) end) -- ## SERVER-SIDE addEvent("onRequestPlayerCountry", true) addEventHandler("onRequestPlayerCountry", resourceRoot, function() local country = exports.admin:getPlayerCountry(client) triggerClientEvent(client, "onPlayerCountryReceived", resourceRoot, country) end)
    1 point
  2. --[[ █▀▀█ █▀▀▀█ █▀▄▀█ █▀▀▀█ █░▒█ █▀▀▀█ █▀▀█ █▀▀█ █░░░ █░░▒█ █▒█▒█ █░░▒█ █░▒█ ▀▀▀▄▄ █▄▄█ █▄▄▀ █▄▄█ █▄▄▄█ █░░▒█ █▄▄▄█ ▀▄▄▀ █▄▄▄█ █░▒█ █░▒█ ]] local Sucesso = prob(90) -- Retorna a função util que enviei antes, agora definido a porcentagem ( 90 ). if Sucesso then -- Se a chance for dentro dos 90%, então: -- Exibe 1 mensagem no chat. else -- Se não, então: -- Exibe outra mensagem no chat. end --[[ █▀▀▀ █░▒█ █▄░▒█ █▀▀█ █▀▀█ █▀▀▀█ █░▒█ ▀▀█▀▀ ▀█▀ █░░░ █▀▀▀ █░▒█ █▒█▒█ █░░░ █▄▄█ █░░▒█ █░▒█ ░▒█░░ ░█░ █░░░ █░░░ ▀▄▄▀ █░░▀█ █▄▄█ █░▒█ █▄▄▄█ ▀▄▄▀ ░▒█░░ ▄█▄ █▄▄█ ]]-- function prob(numberOfChance) local factor = numberOfChance / 100 -- Pega o fator da chance, ou seja, se for 40, então o fator será 0.4. return 10 + (factor * math.random(100)) < numberOfChance -- No começo, eu coloquei um '10', que seria a margem de erro da probabilidade, e também 10% de chance seria bem difícil. Depois, eu multipliquei o nosso fator (0.4, no exemplo citado acima) por um número aleatório de 1 a 100, pra gerar alguma aleatoriedade bem simples. Caso o resultado dessa multiplicação for menor que o número da chance, então ele é verdadeiro. Quanto menor o número, mais difícil fica. end
    1 point
  3. Getting country flags through admin is not recommended anymore. Use the 'ip2c' standalone resource that comes with the default resources.
    1 point
  4. The source element of the event onResourceStart is not a player, so, you are triying to get the country of a Resource, obyously this is not going to work. What you should do ? You need to loop the whole player list by using getElementsyType("player") and inside that loop ask for player country and do the trigger aswell. Best regards.
    1 point
×
×
  • Create New...