Jump to content

lolman

Members
  • Posts

    70
  • Joined

  • Last visited

Details

  • Gang
    FG RPG

lolman's Achievements

Transformer

Transformer (11/54)

0

Reputation

  1. Thought about : removeCommandHandler ?
  2. Hello, I've been facing a problem with my code. It's ment to prevent weaponhit when a player has an elementData called : antiSpam. That works, I get an elementData but it doesn't prevent the damage... I know that the elementData works because I've tested on outputChatBox ... Here's the code : function getAntiSpam() local getAnti = getElementData(getLocalPlayer(), "antiSpam") if (getAnti == 1) then outputChatBox("works...", 255, 0, 0) cancelEvent() end end addEventHandler("onClientPlayerWeaponFire", root, getAntiSpam) function setAntiSpam() setElementData(getLocalPlayer(), "antiSpam", 1) end addEventHandler("onClientResourceStart", root, setAntiSpam) addEvent("SetANTI", true) addEventHandler("SetANTI", root, setAntiSpam) function setAntiSpamOnExplosive(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement) if weapon == 16 then triggerEvent("SetANTI", getLocalPlayer()) end end addEventHandler("onClientPlayerWeaponFire", root, setAntiSpamOnExplosive)
  3. Hmm, I had changed that line where it says : setElementData(getLocalPlayer(), "Fuel", (getFuel-1.000)) to setElementData(getPedOccupiedVehicle(getLocalPlayer()), "Fuel", (getFuel-1.000)) but the text (fuel) doesnt even gets lower... sorry for what I've said above but I don't see any errors and it doesn't work...
  4. doesnt work... if i get in a vehicle and the fuel is empty and then get in an another one there comes a lot of bug in the debugmessages...
  5. Hello, I've been working on the fuel system but the problem is that I don't know what to do... I mean, the fuel system works perfect but because I did getLocalPlayer() the player which one's fuel is 0% and gets in an another vehicle it also says 0%... I tried looping but that doesn't work also.. If someone could explain me a bit... Here's the code: local x, y = guiGetScreenSize() function drawFuel() local theVehicle = getPedOccupiedVehicle(getLocalPlayer()) local getFuel = getElementData(getLocalPlayer(), "Fuel") if isPedInVehicle (localPlayer) == false then return end sx, sy, sz = getElementVelocity (theVehicle) kmhs = math.floor(((sx^2 + sy^2 + sz^2)^(0.5))*180) dxDrawText ( ""..math.round(getFuel, 2).." %", 44, y - 41, x, y, tocolor ( 0, 0, 0, 255 ), 1.02, "bankgothic" ) if getKeyState("W") or getKeyState("S") then setElementData(getLocalPlayer(), "Fuel", (getFuel-1.000)) end end function HandleTheRendering ( ) addEventHandler ( "onClientRender", root, drawFuel ) end addEventHandler ( "onClientResourceStart", resourceRoot, HandleTheRendering ) function outOfFuel() local getFuel = getElementData(getLocalPlayer(), "Fuel") local theVehicle = getPedOccupiedVehicle(getLocalPlayer()) if isPedInVehicle(localPlayer) == false then return end if (getFuel < 0) then dxDrawText ( "0 %", 44, y - 41, x, y, tocolor ( 0, 0, 0, 255 ), 1.02, "bankgothic" ) setVehicleEngineState(theVehicle, false) removeEventHandler("onClientRender", root, drawFuel) end end function setFuel() setElementData(getLocalPlayer(), "Fuel", 100) end addEventHandler("onClientResourceStart", root, setFuel) function HandleTheRendering2 ( ) addEventHandler ( "onClientRender", root, outOfFuel ) end addEventHandler ( "onClientResourceStart", resourceRoot, HandleTheRendering2 )
  6. Still doesn't work... see the debugs ...
  7. Hello, Since I'm using this function : getTimerDetails() I see messages on debugconsole everytime the timer is false... at the function it says that I can prevent it by using the function isTimer() but I've used all methods (almost) but nothing ... This is my code : theTimer = setTimer(function() end, 2000, 1) function timerDetails() remaining = ( getTimerDetails(theTimer) /1000 ) if (remaining) then if isTimer(theTimer) then dxDrawText("Time : "..remaining, 574, 543, 790, 590, tocolor(255, 187, 23, 255), 1.50, "bankgothic", "left", "top", false, false, false, false, false) else return end end end addEventHandler("onClientRender", root, timerDetails) If someone could help me to prevent this debug message I'd be glad!
  8. Youre welcome. About the signals, maybe you could attach small markers on every side of a vehicle and when you press a button the markers on a purposed side show up (have seen this idea on an another server) but the choice is up to you...
  9. This function : createMarker Has already an argument which contains the alpha of the marker with the letter : a. About signals, you can take a look at community.multitheftauto.com and search there and take a look into the code how it's done
  10. I fixed it by my self (so quickly) but thanks for the fast reply
  11. Hello, I want to setTimers on dxDrawText because I want to make a conversation script (animation with just some text shown). I tried to do it but I can only see the text but it doesnt get removed... local x, y = guiGetScreenSize() function togglePanel() dxDrawRectangle(x*0, y*0, x*1, y*0.17, tocolor(0, 0, 0, 255), true) dxDrawRectangle(x*0, y*0.83, x*1, y*0.17, tocolor(0, 0, 0, 255), false) setTimer(tekst1, 1500, 1) end function drawPanel() addEventHandler("onClientPreRender", root, togglePanel) end addEvent("drawPanel", true) addEventHandler("drawPanel", getRootElement(), drawPanel) function hidepanel() removeEventHandler("onClientPreRender", root, togglePanel) end addEvent("hidepanel", true) addEventHandler("hidepanel", getRootElement(), hidepanel) function tekst1() dxDrawText("Test", x*0.67, y*0.8, x*0.38, y*0.05, tocolor(255, 255, 255, 255), 2, "default", "center", "center", false, false, true, false, false) end As you can see in this script, there is a setTimer function but it only shows the text after that time but I want it also to remove it with timer...
  12. Doesn't matter, it still works (tested it more then 100000 times and still works by using > instead of >=)
  13. find the line where it says : bindKey(blablabla) then just paste it and add a new line. But the "N" should be replaced by "," or "." what you want
  14. dxDrawText(""..cash, sX*0.87, sY*0.11, sX*0.2, sY*0.2, tocolor(195, 195, 195, 255), sY/768,1, "pricedown", "left", "top", false, false, false, false, false) This must be this (if im right...): dxDrawText(..cash, sX*0.87, sY*0.11, sX*0.2, sY*0.2, tocolor(195, 195, 195, 255), sY/768,1, "pricedown", "left", "top", false, false, false, false, false) But have you defined cash? if not then ofc it will not work...
×
×
  • Create New...