Jump to content

HassoN

Members
  • Posts

    636
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by HassoN

  1. function leaveserver() if veh1[source] and isElement(veh1[source]) then destroyElement(veh1[source]) end end addEventHandler("onPlayerQuit", root, leaveserver)
  2. HassoN

    KillTimer

    --Client local Timer = setTimer(function() if isTransferBoxActive() then else triggerServerEvent("PlayerKick", getLocalPlayer()) end end, 300000, 0) function onSpawn() killTimer(Timer) end addEventHandler("onClientPlayerSpawn", localPlayer, onSpawn) --Server addEvent("PlayerKick", true) function PlayerKick() kickPlayer(source, "Server", "AFK!") end addEventHandler("PlayerKick", root, PlayerKick)
  3. HassoN

    KillTimer

    Black screen? The code is supposed to kill the timer not to spawn you. EDIT: use /debugscript 3 and tell me if your resource is even working.
  4. والله حتى انا ما انتبهت على الفنكشن ?? حياك الله
  5. ما اشوف خلل بالكود ، في اي سطر الخلل؟
  6. HassoN

    KillTimer

    Excuse me I thought your server side code was spawnPlayer not kickPlayer. Ignore what I said before. Add this to your client side: function onSpawn() killTimer(Timer) end addEventHandler("onClientPlayerSpawn", localPlayer, onSpawn)
  7. local myTimers = {} function leaveVehicle(player) if veh1[player] and isElement(veh1[player]) then myTimers[player] = setTimer(destroyElement, 5000, 1, veh1[player]) end end addEventHandler("onVehicleExit", getRootElement(), leavevehicle) function entervehicle(player) if (isTimer(myTimers[player])) then killTimer(myTimers[player]) end end addEventHandler("onVehicleEnter", getRootElement(),entervehicle)
  8. HassoN

    KillTimer

    You may add killTimer(Timer) after your line 5.
  9. function draw () dxDrawLoading(196*sx/800, 482*sy/600,422*sx/800, 58*sy/600, 196*sx/800 , 450*sy/600 ,1.00*sx/800,tocolor(0,0,0,170),tocolor(0,255,0,170),5000) if (not isTimer(myTimer)) then myTimer = setTimer(stopDraw, 5000, 1) end end addEventHandler("onClientRender",root,draw) stopDraw() removeEventHandler("onClientRender", root, draw) end local start = getTickCount() function dxDrawLoading (x, y, width, height, x2, y2, size, color, color2, second) local now = getTickCount() local seconds = second or 5000 local color = color or tocolor(0,0,0,170) local color2 = color2 or tocolor(255,255,0,170) local size = size or 1.00 local with = interpolateBetween(0,0,0,width,0,0, (now - start) / ((start + seconds) - start), "Linear") local text = interpolateBetween(0,0,0,100,0,0,(now - start) / ((start + seconds) - start),"Linear") --dxDrawText ( "Loading ... "..math.floor(text).."%", x2, y2 , width, height, tocolor ( 0, 255, 0, 255 ), size, "pricedown" ) dxDrawRectangle(x, y ,width ,height -10, color) dxDrawRectangle(x, y, with ,height -10, color2) end
  10. HassoN

    Countdown234

    ايش المشكلة؟
  11. In that case: addEventHandler -- onMarkerHit createVehicle -- use a table to create the vehicle so each player has his own vehicle. warpPedIntoVehicle -- warp the player into your newly created vehicle. addEventHandler -- onVehicleExit setTimer -- set it to 5 mins destroyElement -- destroy the vehicle -- also you need: addEventHandler -- onVehicleEnter killTimer -- to kill your timer in case the player return to his vehicle.
  12. If I understood you, you want that when a player enters a marker he gets a vehicle and after 5 mins of him leaving the marker the vehicle disappear? If so, you may use: onMarkerHit -- when player enters your marker createVehicle -- create your vehicle onMarkerLeave -- when player leaves the marker setTimer -- set a timer of 5 mins destroyElement -- destroy the vehicle.
  13. Sorry for late response, I was sleeping. ? local playersUsingMic = {} local x, y = guiGetScreenSize ( ) local sx, sy = 1600, 900 function onStartVoiceChat() 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 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
  14. Try this: local playersUsingMic = {} local x, y = guiGetScreenSize ( ) local sx, sy = 1600, 900 function onStartVoiceChat() local p_id = getElementData (source, "ID") or "0" table.insert(playersUsingMic, {source, p_id}) 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)
  15. setWorldSoundEnabled -- 19 هذا القسم الاجنبي ، المرة الجاية حط موضوعك بالقسم العربي @VlageZ
  16. We don't know what kind of problem it is. Ask the person who created that resource or post your code with the issue.
  17. HassoN

    ChangeNick

    Then use 'setElementData' and change his nick once he changes it again using onPlayerChangeNick
  18. What's the issue? Nobody can see it? another error? Please use /debugscript 3
  19. Hey, Send a trigger from server side to client side and it will move for everyone.
  20. I said delete the end of the line. Not the whole line. Try to search for the invisible character somewhere at the line 80.
  21. Invisible character *thanks to the forum*. Try to go to line 80 and try to delete the end of the line.
  22. -- client side addEventHandler( "onClientGUIClick", resourceRoot, function() if (source == GUIEditor.button[1]) then -- The button to buy guiSetVisible(GUIEditor.window[1], true) -- The window to buy showCursor(true) elseif (source == buyButton) then -- add your button to buy buyFish() end end) function buyFish() local money = getPlayerMoney(localPlayer) if (money >= 300) then outputChatBox("You have bought a fish food.") triggerServerEvent("buyFish", resourceRoot) else outputChatBox("You don't have enough money.") end end -- server side function buyFish() takePlayerMoney(client, 300) end addEvent("buyFish", true) addEventHandler("buyFish", root, buyFish) The reason behind using server side to take the money is because money in client side is not synced with the server.
  23. Ugh, it wasn't actually my bad, I copied your code without making attention. You forgot to add an 'end' to your 2nd function. The money doesn't subtract because you obviously didn't add: takePlayerMoney
  24. You need to name your function and call it when 'buy' button is clicked. addEventHandler( "onClientGUIClick", resourceRoot, function() if (source == GUIEditor.button[1]) then -- The button to buy guiSetVisible(GUIEditor.window[1], true) -- The window to buy showCursor(true) elseif (source == buyButton) then -- add your button to buy buyFish() end end) function buyFish() local money = getPlayerMoney(getLocalPlayer( )) if (money >= 300) then outputChatBox("You have bought a fish food.") else outputChatBox("You don't have enough money.") end
×
×
  • Create New...