Jump to content

DNL291

Retired Staff
  • Posts

    3,875
  • Joined

  • Days Won

    67

Everything posted by DNL291

  1. I think it's a good idea, however, i'm sure the server IP can still be discovered.
  2. Você vai precisar fornecer alguma informação sobre o tipo de erro que está ocorrendo no servidor, seria bom se existisse um 'Anti-crash' para evitar qualquer problema no jogo.
  3. DNL291

    EXP script

    You must use the resource and you can use the exported functions too...
  4. Só para informar, o problema já foi resolvido. @PM:
  5. DNL291

    pickup Timer

    Is this what do you mean? local timer = {} local pickup1 = createPickup( 2511.323, -1688.844, 13.549, 1, 15, 0 ) addEventHandler( "onPickupHit", pickup1, function (player) local playerTeam = getPlayerTeam(player) if (playerTeam) then if isTimer(timer[player]) then return end local r, g, b = getTeamColor(playerTeam) local aR, aG, aB = getRadarAreaColor(GROVE) if (r == aR) and (g == aG) and (b == aB) then outputChatBox("", player, 0, 0, 0, true) else outputChatBox("#F4A460[AVISO]#F08080 Você não faz parte desta gang.", player, 0, 0, 0, true) cancelEvent() end timer[player] = setTimer(function() end, 30000, 1) else outputChatBox("#F4A460[AVISO]#F08080 Você não faz parte desta gang.", player, 0, 0, 0, true) cancelEvent() end end) addEventHandler( "onPlayerQuit", root, function() if timer[source] then timer[source] = nil end end ) I really can't understand his english.
  6. DNL291

    pickup Timer

    Do you mean the respawn time of the pickup? If so, use 30000 at the sixth argument (or just remove the 0 since default argument is 30 seconds).
  7. It's missing ')' after end in the event: "onClientClick". Also, 'server' must be a table in the function server.register, since you're using a dot which will index a key from a table.
  8. Use estas funções e evento: createMarker getPlayerMoney takePlayerMoney giveWeapon "onMarkerHit" math.random Para os IDs das armas, você pode usar math.random(2, 34) (de Golf Club até Sniper Rifle) ou escolher outro ID inicial e final. Ou você pode também definir os IDs numa tabela.
  9. "onPlayerWeaponSwitch" will not return the next weapon. You can use these functions: Client function getPreviousWeapon() local tempSlot = {} local curSlot = getPedWeaponSlot(localPlayer) if (curSlot == 0) and (getPedWeapon(localPlayer) == 0 or getPedWeapon(localPlayer) == 1) then curSlot = 13 end tempSlot["ID"] = 12 + 1 repeat tempSlot["ID"] = tempSlot["ID"]-1 until (tempSlot["ID"] < curSlot) and not (tempSlot["ID"] ~= 0 and getPedWeapon(localPlayer, tempSlot["ID"]) == 0) return getPedWeapon(localPlayer, tempSlot["ID"]) end function getNextWeapon() local tempSlot = {} local curSlot = getPedWeaponSlot(localPlayer) if (curSlot == 12) then curSlot = - 1 end tempSlot["ID"] = - 1 repeat tempSlot["ID"] = tempSlot["ID"] + 1 if tempSlot["ID"] == 13 then tempSlot["ID"] = -1 curSlot = -1 end until (tempSlot["ID"] > curSlot) and not (tempSlot["ID"] ~= 0 and getPedWeapon(localPlayer, tempSlot["ID"]) == 0) return getPedWeapon(localPlayer, tempSlot["ID"]) end I don't know if it's the best way to do that, but it should work without problems.
  10. You can pass the player element as the source of the event instead of an argument.
  11. That function will be called for all players except the local player. If that is what you want then it's right. By the way, lp = localPlayer or getLocalPlayer() is useless. Change it to: lp = localPlayer
  12. Yes, of course. But like I said, if you call startRendering without calling it for a specific player, the function will be called for all clients.
  13. Actually, your server-side code above is correct, but the another one is wrong. Use this one: function startRendering() addEventHandler("onClientRender", root, render) end addEvent("createGUI", true) addEventHandler("createGUI", root, startRendering) It should work.
  14. A sua acl.xml deve estar bugada. Está faltando no grupo Console.
  15. Depends on who you'll trigger the event. If you call the function startRendering(), it will execute the function for each client.
  16. Width é o largura máxima do retângulo, só abaixar o valor e deixar do tamanho que você deseja. Para ajustar essa largura para todas resoluções, só fazer o seguinte: Use o valor definido em Width e a resolução em que você definiu o valor, em seguida, use-os em um método de porcentagem. Assim: (valor_de_Width * 100) /sWidth Isso vai retornar quantos por cento Width é de sWidth (sWidth: largura total da tela) Um exemplo: sWidth sendo de 1280, e Width sendo um valor de 280: 280 * 100) /1280 --> 21.87% Você vai usar esta porcentagem retornada para converter a porcentagem do retângulo para o valor, desta forma: (porcentagem * sWidth) /100 --> Este é o valor de Width Se quiser, pode usar math.ceil para arredondar o valor para cima. Obs: porcentagem é o valor retornado acima, no exemplo que usei, seria 21.87 (Você pode ignorar o 7 após o 8 na porcentagem, já que pode não fazer diferença).
  17. Editei e adaptei o código, para posicionar corretamente caso o jogador tenha a saúde maior que 100. Tente isto: local sWidth,sHeight = guiGetScreenSize() local Width = sWidth-400 local maxHealth = getPedMaxHealth(localPlayer) local health = getElementHealth(localPlayer) local armor = getPedArmor(localPlayer) local hpX, hpY = sWidth*0.79, sHeight*0.072 local hpW = (health / maxHealth) * Width local armorX, armorY = sWidth*0.79, sHeight*0.104 local armorW = (armor / 100) * Width dxDrawRectangle(hpX - hpW, hpY, hpW, 22, tocolor(255,0,0,250)) -- HP bar dxDrawRectangle(armorX - armorW, armorY, armorW, sHeight*0.03, tocolor(0,223,220,250)) -- Armor bar function getPedMaxHealth(ped) -- Output an error and stop executing the function if the argument is not valid assert(isElement(ped) and (getElementType(ped) == "ped" or getElementType(ped) == "player"), "Bad argument @ 'getPedMaxHealth' [Expected ped/player at argument 1, got " .. tostring(ped) .. "]") -- Grab his player health stat. local stat = getPedStat(ped, 24) -- Do a linear interpolation to get how many health a ped can have. -- Assumes: 100 health = 569 stat, 200 health = 1000 stat. local maxhealth = 100 + (stat - 569) / 4.31 -- Return the max health. Make sure it can't be below 1 return math.max(1, maxhealth) end Obs: Width vai retornar um valor muito alto, a barra vai ficar muito comprida. Além disso, você está ajustando a altura para todas as resoluções, você vai precisar ajustar também a largura, de modo que ambas fiquem com a mesma diferença para todas resoluções.
  18. DNL291

    Team Vehicles

    'onVehicleStartEnter' getPlayerTeam getTeamName cancelEvent()
  19. Try this (i haven't tested): Client addEventHandler( "onClientResourceStart", resourceRoot, function() playerList = guiCreateGridList ( 0.80, 0.10, 0.15, 0.60, true ) column = guiGridListAddColumn( playerList, "Player", 0.85 ) triggerServerEvent("onClientRequestAccounts", localPlayer) end ) addEvent("doAddAccountsToGridList", true) addEventHandler( "doAddAccountsToGridList", root, function (accountsTable) for i=1, #accountsTable do guiGridListSetItemText(playerList, guiGridListAddRow(playerList), column, accountsTable[i], false, false) end end ) addEvent("onAccountsSend", true) addEventHandler( "onAccountsSend", root, function (accountName) guiGridListSetItemText(playerList, guiGridListAddRow(playerList), column, accountName, false, false) end ) addEvent("refreshGridListItems", true) addEventHandler( "refreshGridListItems", root, function (accountName) gridListRemoveAccName(tostring(accountName), column) end ) function gridListRemoveAccName(itemName, column) for i=0, #guiGridListGetRowCount(playerList) do accName = guiGridListGetItemText(playerList, i, column) if accName == itemName then guiGridListRemoveRow(playerList, 2) break end end end Server addEventHandler( "onPlayerLogin", root, function (prevAcc, currAcc) for _, player in pairs(getElementsByType("player")) do triggerClientEvent(player, "onAccountsSend", player, getAccountName(currAcc)) end end ) addEventHandler( "onPlayerLogout", root, function (previousAcc) for _, player in pairs(getElementsByType("player")) do triggerClientEvent(player, "refreshGridListItems", player, getAccountName(previousAcc)) end end ) addEventHandler( "onPlayerQuit", root, function() local account = getPlayerAccount(source) if account and (isGuestAccount(account) ~= false) then for _, player in pairs(getElementsByType("player")) do triggerClientEvent(player, "refreshGridListItems", player, getAccountName(account)) end end ) addEvent("onClientRequestAccounts", true) addEventHandler( "onClientRequestAccounts", root, function() local tAccounts = {} for _, player in pairs(getElementsByType("player")) do local account = getPlayerAccount(player) if account and (isGuestAccount(account) ~= false) then table.insert(tAccounts, getAccountName(account)) end end triggerClientEvent(client, "doAddAccountsToGridList", client, tAccounts) end )
  20. You can use elementData to store the the player's account name when he log in. And update it on the events: onPlayerQuit/onPlayerLogout. And then only use getElementData function to get the account name of the player.
  21. It's missing ')' after 'soco' in getElementData function, you've used parentheses after comparing it with true. Also, source is not defined in addCommandHandler function. XeoN-, Try this: Client addEventHandler("onClientPlayerWeaponFire",root, function ( weapon ) if ( weapon == 0 ) and (getElementData(localPlayer, 'soco') == true) then cancelEvent ( ) end end) Server addCommandHandler("tirarsoco", function (sourcePlayer) local list9 = 0 for _ , v in ipairs ( getElementsByType ('player' )) do if not (isAllownedPlayer(v)) then return end local isPlayerInEvento = getElementData( v, "Evento" ) if (isPlayerInEvento) then setElementData(v, "soco", true) outputChatBox("#FFF000[EVENTO]#FFFFFF "..getPlayerName(sourcePlayer).." Deleted your hands",root, 255, 255, 255, true) list9 = list9 + 1 outputChatBox("#FFF000[EVENTO]#FFFFFF You deleted soco of "..list9.." players", sourcePlayer, 255, 255, 255, true) end end end)
  22. I don't understand why are you using: isPlayerHudComponentVisible and setPlayerHudComponentVisible. Oh yeah, it's because I got this code from a script 'custom zone name' i made. By the way, i edited it.
  23. You can do it on the clientside with the event "onClientRender", like this: local areaName = "" local currentZone = nil addEventHandler( "onClientRender", root, function() local x,y,z = getElementPosition(element) currentZone = getZoneName(x,y,z) if (areaName ~= currentZone) then areaName = currentZone triggerEvent(...) end end ) And store the current area of the element with setElementData.
  24. manawydan, addEventHandler na linha 36 vai dar erro porquê Marker1 vai retornar nil. A marca só está sendo criada quando digita o comando pular. Essa parte eu acredito que não será tão fácil. As formas que me vem a mente são: Verificar com o evento "onClientRender" se o jogador continua com o paraquedas ou não (se não estiver, significa que ele já usou o paraquedas e está no chão) e chamar a função de quando ele cair fora da marca. Ou, usar a função isPedOnGround novamente no evento "onClientRender", e o evento só deverá ser chamado quando ele sair do chão com o paraquedas. Pode ter outras maneiras melhores de fazer isso, no entanto. Talvez o recurso padrão do MTA chamado parachute possa te ajudar nisso, não tenho certeza já que nunca usei ele.
×
×
  • Create New...