DREFTHUN

Members
  • Content Count

    26
  • Joined

  • Last visited

Everything posted by DREFTHUN

  1. function MakePlayerHeadshot( attacker, weapon, bodypart, loss ) if getElementType ( attacker ) == "ped" then if bodypart == 9 then if getPedArmor(source) > 0 then triggerEvent( "onPlayerHeadshotArmor", source) else triggerEvent( "onPlayerHeadshot", source, attacker, weapon, loss ) setPedHeadless ( source, true ) killPed( source, attacker, weapon, bodypart ) setTimer( BackUp, 900, 1, source ) end end end end function onPlayerHeadshotArmor() setPedArmor(source, 0) end addEvent("onPlayerHeadshotArmor", true) addEventHandler("onPlayerHeadshotArmor", root, onPlayerHeadshotArmor) Try this (Not tested)
  2. DREFTHUN

    Fuel System

    --Server fuelConsumption = 0.004 fuelTable = {} function vehMove() for i,v in ipairs(getElementsByType("vehicle")) do x,y,z = getElementPosition(v) if fuelTable[v] then distance = getDistanceBetweenPoints3D(x,y,z,fuelTable[v][2],fuelTable[v][3],fuelTable[v][4]) enginePlus = 0 if getVehicleEngineState(v) then enginePlus = 0.08 end newFuel = fuelTable[v][1] - (fuelConsumption*(distance+enginePlus)) fuelTable[v] = {newFuel,x,y,z} setElementData(v, "fuel", fuelTable[v][1]) else if getElementData(v, "fuel") then fuelTable[v] = {getElementData(v, "fuel"), x, y, z} else fuelTable[v] = {100, x, y, z} end end end end setTimer(vehMove, 1000, 0) --Client sx,sy = guiGetScreenSize() function testShowFuel() if isPedInVehicle(localPlayer) then dxDrawRectangle(sx-210,sy-30,200,20,tocolor(0,0,0,120)) if getElementData(getPedOccupiedVehicle(localPlayer), "fuel") then fuel = getElementData(getPedOccupiedVehicle(localPlayer), "fuel") else fuel = 100 end dxDrawRectangle(sx-210,sy-30,fuel/100*200,20,tocolor(127,198,118,255)) end end addEventHandler("onClientRender", root, testShowFuel)
  3. Hello! I have a problem. I wrote a custom damage system with the event onClientPlayerDamage. But whenever the player is doing a driveby. The event doesn’t seem to get called, even tho the player is taking damage. Is there a fix to it? Thanks, in advance.
  4. DREFTHUN

    Fuel System

    PM me your discord name and I’ll help you in about 3 hrs.
  5. It happens with the chainsaw, and with simple punching too. Should I just change the fighting style and it should be good to go?
  6. My friend bought a new laptop. It has an integrated vga eith the processor, and a dedicated vga, but MTA uses the integrated vga and we don’t know how to change it.
  7. Thank you IIYAMA! Your reply was helpful! ShayF Yeah, it's good, but when I want to type like /mute DREFTHUN 34 that script won't seperate the arguments. Anyway, thanks! I'm all good now.
  8. I made a custom chat, and I made it to recognize commands by using if string.sub(guiGetText(chatGUI),1,1) == "/" then It's all good, but then I can't get the arguments server side. Like when I type /mute Player12 30, I don't know how to seperate them, in 2 arguments. I just need a little help to get started with.
  9. I can script almost anything you want. You just need to go here: https://selly.gg/@DREFT (All information about the scripts are here) Here, you can select which service you want, you are going to get a file called TS3.txt, and you just have to join my TS3 server with the IP you can find in the file, and we can discuss your order. (I'm not always online. If I'm not online, you can use selly.gg to contact me!) You can use coupon 'MTAFORUM' for a 15% discount on every product (Limited to 50 people)
  10. I can script almost anything you want. You just need to go here: https://selly.gg/@DREFT (All information about the scripts are here) Here, you can select which service you want, you are going to get a file called TS3.txt, and you just have to join my TS3 server with the IP you can find in the file, and we can discuss your order. (I'm not always online. If I'm not online, you can use selly.gg to contact me!) You can use coupon 'MTAFORUM' for a 15% discount on every product (Limited to 50 people)
  11. It won't do the trick better. The method I wrote down is easier then almost anything else. And check out the edited script too.
  12. MaxPlayers = 48 allowedSerials = { [""]=true, } function playerJoinKick() serial = getPlayerSerial(source) if not allowedSerials[serial] and getPlayerCount() >= MaxPlayers then kickPlayer(source, "Console", "You tried joining in a reserved slot!") end end addEventHandler("onPlayerJoin", root, playerJoinKick) setTimer(function() if getPlayerCount() >= MaxPlayers then setMaxPlayers(getPlayerCount() + 1) else setMaxPlayers(MaxPlayers) end end,50,0) Try this.
  13. I want to do a Taxi Job on my server, but I can't get it to work. Is there any way to use the enter_passenger control on Peds? --Server taxiNPCk = {} function warpTaxiNPCInTaxi(player, skin, name, vehicle) taxiNPCk[player] = createPed(skin, 0, 0, 0) setElementData(taxiNPCk[player], "pedname", name) warpPedIntoVehicle(taxiNPCk[player], vehicle, math.random(2,3)) end addEvent("warpTaxiNPCInTaxi", true) addEventHandler("warpTaxiNPCInTaxi", root, warpTaxiNPCInTaxi) --Client NPCnevek = { {"Tom"}, {"Patrik"}, } NPCskinek = { {21}, {22}, {23}, } taxiNPCkLS = { {1173.0035400391, -1274.3172607422, 13.546875, 180}, {1313.7718505859, -1389.6131591797, 13.518327713013, 180}, } function taxiRender() if not isPedInVehicle(localPlayer) then return end x, y, z = getElementPosition(localPlayer) x1, y1, z1 = getElementPosition(taxiNPC) distance = getDistanceBetweenPoints3D(x, y, z, x1, y1, z1) outputChatBox(distance) if distance < 7 then ottVan = true end if ottVan then setPedRotation(taxiNPC, findRotation(x1, y1, x, y)) setControlState("handbrake", true) setPedControlState(taxiNPC, "forwards", true) setPedControlState(taxiNPC, "walk", true) if distance < 2.3 then triggerServerEvent("warpTaxiNPCInTaxi", localPlayer, localPlayer, getElementModel(taxiNPC), getElementData(taxiNPC, "pedname"), getPedOccupiedVehicle(localPlayer)) destroyElement(taxiNPC) setControlState("handbrake", false) toggleAllControls(true, true, true) removeEventHandler("onClientRender", root, taxiRender) ottVan = false setPedControlState(taxiNPC, "forwards", false) setPedControlState(taxiNPC, "walk", false) end end end function taxiSpawnNPC() if isElement(taxiNPC) then destroyElement(taxiNPC) end random1 = math.random(1, #taxiNPCkLS) random2 = math.random(1, #NPCnevek) random3 = math.random(1, #NPCskinek) taxiNPC = createPed(NPCskinek[random3][1], taxiNPCkLS[random1][1], taxiNPCkLS[random1][2], taxiNPCkLS[random1][3]) outputChatBox("-- Taxi NPC Spawned --") outputChatBox(" -Skin: "..NPCskinek[random3][1]) outputChatBox(" -Position (X, Y, Z): "..taxiNPCkLS[random1][1]..", ".. taxiNPCkLS[random1][2]..", ".. taxiNPCkLS[random1][3]) setPedRotation(taxiNPC, taxiNPCkLS[random1][4]) outputChatBox(" -Rotation: "..taxiNPCkLS[random1][4]) setElementData(taxiNPC, "pedname", NPCnevek[random2][1].." #7cc576(Pedestrian)") outputChatBox(" -Name: "..NPCnevek[random2][1].." #7cc576(Pedestrian)",255,255,255,true) addEventHandler("onClientRender", root, taxiRenderTeszt) end taxiSpawnNPC() function findRotation(x1,y1,x2,y2) local t = -math.deg(math.atan2(x2-x1,y2-y1)) if t < 0 then t = t + 360 end; return t; end This is good enough too, but if possible, I would like to use the enter_passenger.
  14. Love you mate Tho you messed it up a little. dxDrawText("Test text please work already", 0, sy/2-15, startXTest, sy/2+15,tocolor(0,0,0,255),1,"arial","left","center",true,false,false) Thanks anyway Liked :DD
  15. Hey guys! I need help with dxDrawText cropping, cause I just can't get it to work. I used these lines of code startXTest = 0 function renderTest() sx, sy = guiGetScreenSize() startXTest = startXTest + sx/1000 if startXTest > sx then startXTest = 0 end dxDrawRectangle(startXTest, sy/2-15,3,30) dxDrawText("Test text please work already", 0, sy/2, startXTest+30, sy/2,tocolor(255,255,255,255),1,"arial","left","center",true,false,false) end addEventHandler("onClientRender", root, renderTest) but the only thing I get is... It should display the text within the line, shouldn't it? What should I do? Please help!
  16. DREFTHUN

    Dimension bug

    I use this: function getPos() x, y, z = getElementPosition(localPlayer) rot = getPedRotation(localPlayer) int = getElementInterior(localPlayer) dim = getElementDimension(localPlayer) position = x .. ", ".. y .. ", ".. z outputChatBox(position) outputChatBox("Rot: "..rot) outputChatBox("Int: "..int) outputChatBox("Dim: "..dim) setClipboard(position) end addCommandHandler("getpos", getPos) It is client-sided, and it still returns the dimension I gave... And no debug errors... Not even warnings... I tried even reinstalling the server, and everything... Just in case, I added that code to my script, to see what happens. http://kephost.com/image/wlEg Got the source of the problem! Gonna change hostings now! Thank you for your help anyways!
  17. Than I'm sorry, I don't know what to do
  18. --Clientside: if getElementData(getPedTarget(localPlayer), "antigravitygun") then return end --It has to look like this: if isElement(ggun_obj) and isTimer(buildupTimer) then --(Row: 30) if not isElement(ggun_obj) then ggun_obj = getPedTarget(localPlayer) end --(Row: 31) if getElementData(getPedTarget(localPlayer), "antigravitygun") then return end --(Row: 32) Though, others can still lift the vehicle you are sitting in.
  19. That just disables it for you.
  20. DREFTHUN

    Dimension bug

    Here is a video demostrating my problem: My friend doesn't disappear, he just gets desynced... function setdim(thePlayer, cmd, targetPlayer, num) num = tonumber(num) targetPlayer = getPlayerFromName(targetPlayer) setElementDimension(targetPlayer, num) outputChatBox("Succesfully set dimension to "..num,root, 255, 255, 255, true) end addCommandHandler("setdim", setdim, false, false)
  21. You should use this: --Add this to the serverfile: function antigravitygun(player) if not getElementData(player, "antigravitygun") then setElementData(player, "antigravitygun", true) outputChatBox("You have succesfully turned off 'Gravity Gun'!",player,255,0,0) else setElementData(player, "antigravitygun", false) outputChatBox("You have succesfully turned on 'Gravity Gun'!",player,0,255,0) end end addCommandHandler("antigg", antigravitygun) --And this to the client: if getElementData(localPlayer, "antigravitygun") then return end --This one has to be between these two: if not getControlState("aim_weapon") or isElementInWater(localPlayer) then return end --(Row: 23) local ggun_obj = getElementData(localPlayer,"ggun_taken") --(Row: 24) --So it should look like this: if not getControlState("aim_weapon") or isElementInWater(localPlayer) then return end --(Row: 23) if getElementData(localPlayer, "antigravitygun") then return end --(Row: 24) local ggun_obj = getElementData(localPlayer,"ggun_taken") --(Row: 25)
  22. DREFTHUN

    Dimension bug

    I used this, but even the simple setElementDimension is bugged out somehow... function setdim(thePlayer, cmd, targetPlayer, szam) if getElementData(thePlayer, "acc:admin") > 0 then if not targetPlayer or not szam then outputChatBox("#ff9000[Usage]: #FFFFFF/"..cmd.." [ID / Name] [Dimension]", thePlayer, 0, 0, 0, true) return end szam = tonumber(szam) targetPlayer = findPlayer(thePlayer, targetPlayer) if not getElementData(targetPlayer, "loggedin") then outputChatBox("#D64541[Error]: #FFFFFFThe player you are trying to use the command on isn't logged in yet!", thePlayer, 0, 0, 0, true) return end setElementDimension(targetPlayer, szam) outputChatBox("Succesfully set "..getPlayerName(targetPlayer).."'s dimension to "..szam,thePlayer, 0, 0, 0, true) else outputChatBox("#D64541[Error]: #FFFFFFAcces denied!", thePlayer,0,0,0,true) end end addCommandHandler("setdim", setdim, false, false) --Before that, the spawning is used with spawnPlayer, and even this way it is bugged out. I will provide video later on...
  23. DREFTHUN

    Dimension bug

    Hello! My problem is, that if I set my dimension to, let's say 2, and I set my friend's dimension to 1, I can still see him, but it is very much desynced... His position only gets updated every one second, etc. I really need to get this bug fixed, cause at the moment, I can't use interiors, etc. I made a modification to the mtaserver.conf file: <!-- Player sync interval. Default: 100 --> <player_sync_interval>50</player_sync_interval> But this is all.