Jump to content

TAPL

Retired Staff
  • Posts

    7,337
  • Joined

  • Days Won

    11

Everything posted by TAPL

  1. getElementPosition getDistanceBetweenPoints2D setPedControlState setPedRotation https://wiki.multitheftauto.com/wiki/FindRotation
  2. TAPL

    route

    It's just you didn't notice it when the marker get destroyed and recreated because the position in the table are same. You may want to create the marker client side so each sweepers see only his own marker.
  3. TAPL

    route

    The reason for the error is because the index reached its limit, you have to reset it to 1 again. Also there was some other problems i fixed, and there is event not added at client side (check line 43). local jobMarker = createMarker(10, 10, 3, 'cylinder', 1, 0, 255, 0, 255) local jobBlip = createBlipAttachedTo(jobMarker, 41) local sweeperTeam = createTeam("Sweeper", 255, 0, 0) local joblessTeam = createTeam("Unemployed", 123, 123, 123) function GetSweeperJob(hitElement) if getElementType(hitElement) == "player" then if getElementData(hitElement, "Occupation") ~= "Sweeper" then triggerClientEvent(hitElement, "SweepWindow", hitElement) else outputChatBox("You already are a sweeper!", hitElement, 255, 0, 0) end end end addEventHandler("onMarkerHit", jobMarker, GetSweeperJob) function GiveSweeperJob() setElementModel(source, 264) setPlayerTeam(source, getTeamFromName("Sweeper")) setElementData(source, "Occupation", "Sweeper") setElementData(source, "hasSweepMarker", "no") outputChatBox("You are now a sweeper!", source, 255, 0, 0) end addEvent("GiveSweeperJob", true) addEventHandler("GiveSweeperJob", root, GiveSweeperJob) function resignSweeperJob(thePlayer) if (getElementData(thePlayer, "Occupation") == "Sweeper") then setElementModel(thePlayer, math.random(1,287)) setPlayerTeam(thePlayer, getTeamFromName("Unemployed")) setElementData(thePlayer, "Occupation", "Unemployed") outputChatBox("You resigned as sweeper!", thePlayer, 255, 0, 0) elseif getElementData(thePlayer, "Occupation") == "Unemployed" then outputChatBox("You are already Unemployed!", thePlayer, 255, 0, 0) end end addCommandHandler("resign", resignSweeperJob) function SweepEnter(theVehicle, seat, jacked) local id = getElementModel(theVehicle) if id == 574 then outputChatBox("You are now sweeping!", source, 255, 0, 0) --triggerClientEvent(source, "SweepRoute", source) end end addEventHandler("onPlayerVehicleEnter", root, SweepEnter) local currentIndex = 1 local route = { { 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 2 }, { 0, 0, 3 }, { 0, 0, 4 } } marker = createMarker(unpack(route[currentIndex])) addEventHandler("onMarkerHit", root, function() if (source == marker) then destroyElement(marker) currentIndex = (currentIndex < #route) and (currentIndex + 1) or 1 marker = createMarker(unpack(route[currentIndex])) end end) function centerWindow(center_window) local screenW,screenH=guiGetScreenSize() local windowW,windowH=guiGetSize(center_window,false) local x,y = (screenW-windowW)/2,(screenH-windowH)/2 guiSetPosition(center_window,x,y,false) end jobWdw = guiCreateWindow(638, 266, 597, 655, "SANGSweeper", false) guiWindowSetSizable(jobWdw, false) takejobBtn = guiCreateButton(378, 131, 190, 78, "Take Job", false, jobWdw) closeBtn = guiCreateButton(378, 524, 190, 78, "Close", false, jobWdw) guiSetVisible(jobWdw, false) function showJobWindow() if (jobWdw ~= nil) then guiSetVisible(jobWdw, true) guiSetInputEnabled(true) showCursor(true) centerWindow(jobWdw) end end addEvent("SweepWindow", true) addEventHandler("SweepWindow", root, showJobWindow) function clickJobWindow(button,state) if (source == takejobBtn) then triggerServerEvent("GiveSweeperJob", localPlayer) guiSetVisible(jobWdw, false) guiSetInputEnabled(false) showCursor(false) elseif (source == closeBtn) then guiSetVisible(jobWdw, false) guiSetInputEnabled(false) showCursor(false) end end addEventHandler("onClientGUIClick", guiRoot, clickJobWindow)
  4. TAPL

    route

    Yes?
  5. bindKey مطروح الموضوع 544554574547654556241556244892378497239874893759832445562446524365 مره ابحث و تلقاه
  6. TAPL

    route

    Post the current code you use and have the error.
  7. TAPL

    route

    The table not exist or not defined.
  8. You have this in client side, but it serveer side function. triggerClientEvent ( thePlayer, "savehp", getRootElement(),playerHealth) Use triggerServerEvent. triggerServerEvent("savehp", localPlayer, playerHealth) Oh and i don't get the hell point of trigger from server side to client side and then trigger from client side to server side again! This also weird you talking about SQL and you don't even know how to use trigger?
  9. وش المميزات الي مو موجوده في موقع ام تي اي و بتكون موجوده في موقعك المقترح؟
  10. TAPL

    Need Help

    local x,y = guiGetScreenSize() local textPosition = 0 -- Main counter. You can do the same with anything you want to move or change per frame. local text = "MOTD: Welcome to the server have fun!" local animate = true function renderText() if animate == true then -- If we want to animate stuff textPosition = textPosition + 1 if textPosition > x then textPosition = 0 end dxDrawText(text,textPosition,0.2/2,x,y, tocolor ( 255, 255, 255, 1000 ), 1.5, "default-bold" ) dxDrawRectangle ( x/2.2, y/2000, x/0, y/25, tocolor ( 0, 0, 0, 255 ) ) -- Create our black transparent MOTD background Rectangle. -- Create our black transparent MOTD background Rectangle. -- Create our black transparent MOTD background Rectangle. -- draw the text -- Add this into the "if" check if you don't want to draw it anymore dxDrawText(text,textPosition,0/2,x,y, tocolor ( 255, 255, 255, 1000 ), 1.5, "default-bold" ) end end addEventHandler("onClientRender",getRootElement(),renderText) addEventHandler ( "onClientGUIClick",loginButton,function() animate = false -- Stop animating. end)
  11. رائع رائع كل الكود كوبي بست ولا انت مو داري وش الهرجه
  12. غير اسم التريقر
  13. TAPL

    route

    The code is server side.
  14. Try this: addEvent("onLogin", true) addEventHandler("onLogin", root, function() outputChatBox("Trigger!") stopSound(JoinMusic) end) Edit: did you change the variable JoinMusic? because i test it and it worked.
  15. وين تحطه؟ هذا تستخدمه تبرمج فيه إذا ما تعرف تبرمج لا تتعب نفسك و تفتح سيرفر
  16. createMarker createObject moveObject createPickup onMarkerHit
  17. Set looped argument to true. JoinMusic = playSound("song.mp3", true) Try this for debug and see if it output or not. addEventHandler("onPlayerLogin", root, function() outputChatBox("Login!") triggerClientEvent(source, "onLogin", source) end) addEvent("onLogin", true) addEventHandler("onLogin", root, function() outputChatBox("Trigger!") if isElement(JoinMusic) then outputChatBox("Destroy!") destroyElement(JoinMusic) end end)
  18. TAPL

    Help SQL plis

    You're welcome.
  19. oh also you don't need the element data, you can use the table. something like: if not isElement(helmet[thePlayer]) then -- create it else -- destroy it end
  20. TAPL

    Help SQL plis

    function getAccountZkill(account) local result = exports["server"]:dbQueryZA( "SELECT * FROM zkills WHERE account = '"..account.."'") if (type(result) == "table" and #result == 0 or not result) then return false else return tostring(result[1]["Zkill"]) end end You can change it to: function getAccountZkill(account) local result = exports["server"]:dbQueryZA( "SELECT * FROM zkills WHERE account = '"..account.."'") if (result) then return tostring(result[1]["Zkill"]) end end
  21. Move this outside the function: helmet = {}
  22. Anything in the debug? Are you sure the server side set correctly?
  23. Could you post the trigger code? I think it should be source not thePlayer.
  24. You're welcome.
×
×
  • Create New...