Jump to content

HassoN

Members
  • Posts

    636
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by HassoN

  1. local Marker1 = createMarker (119.86518859863, -1832.1979980469, 5, "cylinder", 1.25, 0, 250, 0, 50) local Marker2 = createMarker (127.06451416016, -1848.4306640625, 5, "cylinder", 3, 0, 250, 0, 50) veh = {} function Vehicle1 (hitPlayer) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(hitPlayer)), aclGetGroup("Mecanico")) then if isElement(veh[hitPlayer]) then destroyElement(veh[hitPlayer]) veh[hitPlayer] = nil end veh[hitPlayer] = createVehicle(525, 132.57461547852, -1815.671875, 5.795524597168, 0, 0, 270) warpPedIntoVehicle ( hitPlayer, veh[hitPlayer] ) else outputChatBox ("Você não é um Mecanico", hitPlayer, 0, 0, 0) end end addEventHandler( "onMarkerHit", Marker1, Vehicle1) function Vehicle2(player) if isElementWithinMarker(player, Marker2) then if isPedInVehicle(player) == true then destroyElement(veh[player]) veh[player] = nil else outputChatBox("Você não esta em um veículo", hitPlayer, 0, 0, 0) end end end addEventHandler("onMarkerHit", Marker2, Vehicle2)
  2. It changes automatically. If the txd/dff file on your server doesn't match client's txd/dff then it will change.
  3. HassoN

    Help

    What do you mean?
  4. That topic is about event handlers how could that help to calculate the right screen position in this case?
  5. I am not complaining either about using onClientRender, I am just saying that it should get used wisely and in this case you are recommending him to use it in such a way that would require using a loop, then checking for each one's information and then insert in another table if that passes the check. Now Imagine having 100+ players in his server, imagine doing the same calculations 100 times on every frame that means 6000 times in a second, do you call that efficient way to use onClientRender? I guess not. Please stop getting examples of nametags usages because those things NEED onClientRender otherwise they won't even work. And no. Timers are not like onClientRender. @majqq It won't really affect the server itself, but the client will get loaded to all players so basically all players will lag (if something is wrong with the code) But don't worry your server shouldn't go down if you are not using a trigger. Now let's please stick to the original topic and see if @slapz0r still needs help.
  6. You forgot to add the folder's name to your code. local id = 356 local txd = engineLoadTXD('models/m4.txd', id) engineImportTXD(txd, id) local dff = engineLoadDFF('models/m4.dff', id) engineReplaceModel(dff, id)
  7. HassoN

    Help

    Try this: local alpha = 100 function refreshColor() for _, blip in ipairs(getElementsByType("blip")) do if (getBlipIcon(blip) == 0) then alpha = alpha + 10 if (alpha >= 254) then alpha = 100 end local r, g, b = getBlipColor(blip) setBlipColor(blip, r, g, b, alpha) end end end setTimer(refreshColor, 50, 0)
  8. HassoN

    Help

    Your code has many undefined variables, forgotten arguments, etc... it basically doesn't make any sense. What are you trying to achieve?
  9. A little example on how you make anything compatible with any resolution. local x, y = guiGetScreenSize() local xs, ys = 1920, 1080 -- this represents the designer's screen resolution. --> for example we have something like: dxDrawText(100, 200, 300, 400, ...) -- this should look fine on your screen, but not fine at all for everyone's else screen. dxDrawText(x * (100/xs), y * (200/ys), x * (300/xs), y * (400/ys), ...) -- this should look fine both on your screen and others' screens.
  10. Race name tags? do you mean dx functions? Then onClientRender is obviously a must. I am trying to advise the topic's owner to the least inefficient method. So I still believe using onClientRender to get someone's position is totally unnecessary and could be simply replaced by a timer. About your suggestion, that could be a good idea but in my tables, players get added to the table only if they are close to the local player so you can't actually use them to check because in this case, players don't get added to the table in the first place because they keep holding the button. Maybe adding another table which includes all players who are using mics (even if they are far away) then using a timer to check if someone from that table gets close enough to the local player so we add him to the 2nd table (which is used to show close players) should work.
  11. Getting player's position with onClientRender is totally inefficient for the server's performance, you could've suggested something a little bit better like setting a timer. But either ways, you can't use either of them because there's no function which checks if X player is using his mic.
  12. addCommandHandler -- to make your command getElementPosition -- get your position createPed -- create your NPC next to you.
  13. Show us the code when the vehicle explodes and you respawn it.
  14. This issue occurs because both vehicles use a shared variable "veh" in your case. Use a table instead. Something like vehicles[player] = createVehicle... So each vehicle has its own variable.
  15. With some calculations you may achieve your goal: addEventHandler -- onClientClick getPlayerMapBoundingBox -- calculations to get X,Y of the map getGroundPosition -- to get the Z position. setElementPosition -- send your player.
  16. Then add addEventHandler("onVehicleEnter", root, stopEngine)
  17. If you have used setElementPosition before then it won't work. Check your spawning system code.
  18. function stopEngine() local health = getElementHealth(source) if health <= 300 then setVehicleEngineState(source, false) end end addEventHandler("onClientVehicleDamage", root, stopEngine)
  19. I've checked the available functions/events but I couldn't find anything useful for your case.
  20. Explain more, I don't get it.
  21. Try this local playersUsingMic = {} local x, y = guiGetScreenSize ( ) local sx, sy = 1600, 900 function onStartVoiceChat() local x, y, z = getElementPosition(source) local x2, y2, z2 = getElementPosition(localPlayer) local distance = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) if (distance <= 15) then local myIndex = getMyValue(source) if (not myIndex or not playersUsingMic[myIndex]) then local p_id = getElementData (source, "ID") or "0" table.insert(playersUsingMic, {source, p_id}) end end end addEventHandler("onClientPlayerVoiceStart", root, onStartVoiceChat) function onStopVoiceChat() for i, v in ipairs(playersUsingMic) do if (v[1] == source) then table.remove(playersUsingMic, i) end end end addEventHandler("onClientPlayerVoiceStop", root, onStopVoiceChat) function drawText() if (#playersUsingMic > 0) then for i, v in ipairs(playersUsingMic) do dxDrawText("Talk: "..getPlayerName(v[1]).." ["..v[2].."]", x * (27/sx), i*30 + y * (341/sy), x * (294/sx), i*30 + y * (376/sy), tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) end end end addEventHandler("onClientRender", root, drawText) function getMyValue(player) for i, v in ipairs(playersUsingMic) do if v[1] == player then return i end end end
  22. admin > client > gui > admin_report.Lua > line 42
  23. After line 8 add guiSetVisible(JoinPanel, false)
×
×
  • Create New...