dewu
Members-
Posts
171 -
Joined
-
Last visited
Everything posted by dewu
-
Client: function bproof ( attacker, weapon, bodypart ) if weapon then cancelEvent() end end addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), bproof ) Server: function onehit ( attacker, weapon, bodypart, loss ) if not weapon then killPed ( source, attacker, weapon, bodypart ) end end addEventHandler ( "onPlayerDamage", getRootElement (), onehit )
-
Client: function reloadtazerclient ( weapon ) if (weapon == 35 or weapon == 36) then triggerServerEvent ( "ontazershoot", localPlayer ) end end addEventHandler ( "onClientPlayerWeaponFire", localPlayer, reloadtazerclient ) Server: function tazershootserverside ( ) setTimer(toggleControl, 5000, 1, source, "fire", false) toggleControl (source, "fire", true) end addEvent ( "ontazershoot", true ) addEventHandler ( "ontazershoot", root, tazershootserverside )
-
He wants to destroy objects from id 600 to 800. Try now: function AntiLag() for _, v in ipairs ( getElementsByType ( "object", root, true ) ) do local id = getElementModel ( v ) if ( id => 600 and id <= 800) then destroyElement(v) end end end
-
function AntiLag() for _, v in ipairs ( getElementsByType ( "object", root, true ) ) do local id = getElementModel ( v ) if ( id => 600 and <= 800) then destroyElement(v) end end end
-
To mute radio: function makeRadioStayOff() setRadioChannel(0) cancelEvent() end addEventHandler("onClientPlayerVehicleEnter", getRootElement(), makeRadioStayOff) addEventHandler("onClientPlayerRadioSwitch", getRootElement(), makeRadioStayOff)
-
Żywe-Trupy Serwer MTA DayZ [POLAND/EUROPE]
dewu replied to dewu's topic in Poszukiwania i oferty graczy, reklamy serwerów
Update 0.2 Beta Poprawki: • Poprawiony inwentaż pod klawiszem 'J' (wyłączony pod 'H' ze względu na problemy techniczne) Gamemod: • Dodane 3 nowe rodzaje karabinów maszynowych • Dodanych 9 nowych rodzajów karabinów szturmowych • Dodane 2 nowe rodzaje strzelb • Dodanych 6 nowych rodzajów karabinów snajperskich • Dodanych 11 rodzajów uniwersalnej amunicji • Dodane nowe odgłosy wystrzału Każda z ww. broni charakteryzuje się innym wyglądem, zadawanymi obrażeniami, ilością naboi w magazynku, zasięgiem, szybkością i odgłosem wystrzału. Respawn został starannie zbalansowany. W zależności od zadawanych obrażeń broń będzie występować rzadziej lub częściej. Otwierając inwentaż pod klawiszem 'J' w opisie broni/magazynku znajdziemy informację dot. kompatybilności broni z amunicją, tzn. czy amunicja będzie pasować do broni. Respawn starej amunicji typu M4 Mag, AK Mag itd. został wyłączony. Od teraz będziecie mogli znaleźć tylko amunicję tego nowego rodzaju. Osoby, które w namiotach, ekwipunku czy pojazdach miały amunicję starego typu nie muszą się o nic martwić. Amunicję te można swobodnie wykorzystywać z kompatybilnym rodzajem broni (np. AK Mag do AK-47). Biorąc pod uwagę, iż jest to wersja Beta proszę o wyrozumiałość i zgłaszanie ew. błędów. Wkrótce na naszej Wikii pojawi się więcej szczegółów dotyczących nowych broni. -
Hello guys. In what location I can find files who loads when i joined to server? Mean map file, because on my server day after day these files are bigger, and bigger. From 6MB now is 20 MB ;o Or maybe it's save in database?
-
Problem resolved. I just use setPedAnimation(source, "TEC", "TEC_reload", -1, false, false, false, false) instead of reloadPedWeapon ( source )
-
Hi guys. Is any way to make full sniper reload (i mean anim of reloading) after 1 shot? I've tried this code, but that is no working in Sniper Rifle: function reloadtazerclient ( ) if (weapon == 34) then triggerServerEvent ( "ontazershoot", localPlayer ) end end addEventHandler ( "onClientPlayerWeaponFire", localPlayer, reloadtazerclient ) Server: function tazershootserverside ( ) reloadPedWeapon ( source ) end addEvent ( "ontazershoot", true ) addEventHandler ( "ontazershoot", root, tazershootserverside ) Also i tried with SetWeaponProperty with 1 clip, but's still no working.
-
Guys, i need your help. This should work but don't know why it's not: function gluev() local outString outputDebugString("glue vehicle") local thePlayer = getLocalPlayer() local myVehicle = getPedOccupiedVehicle(thePlayer) if myVehicle then local attachMe, attachedTo outputDebugString("my vehicle") local vehicles = getElementsByType("vehicle") local closest, cdist = nil, 100 local mx,my,mz = getElementPosition(myVehicle) for k,v in ipairs(vehicles) do local model = getElementModel(v) if isElementStreamedIn(v) and model == 578 and v ~= myVehicle then local x,y,z = getElementPosition(v) local tmpdist = getDistanceBetweenPoints3D(x,y,z,mx,my,mz) if tmpdist < cdist then cdist = tmpdist closest = v end end end outputDebugString("Auto = " .. getVehicleName(closest) .. ", distancia: " .. tonumber(cdist) .. "") if cdist > 5 or cdist == nil then return false end local count = getElementData(thePlayer, "CountGlueVeh") if count > 2 then -- CHECK IF COUNT OF GLUE VEHICLES IS HIGHER THAN 2 return false -- IF IT IS RETURN FALSE end local vtype = getElementModel(myVehicle) if vtype == (487 or 548 or 425 or 417 or 488 or 497 or 563 or 447 or 469) then attachMe = closest attachedTo = myVehicle else attachMe = myVehicle attachedTo = closest end local px, py, pz = getElementPosition(attachedTo) local vx, vy, vz = getElementPosition(attachMe) local sx = px - vx local sy = py - vy local sz = pz - vz local rotpX, rotpY, rotpZ = getElementRotation(attachedTo) local rotvX, rotvY, rotvZ = getElementRotation(attachMe) local t = math.rad(rotvX) local p = math.rad(rotvY) local f = math.rad(rotvZ) local ct = math.cos(t) local st = math.sin(t) local cp = math.cos(p) local sp = math.sin(p) local cf = math.cos(f) local sf = math.sin(f) local z = ct*cp*sz + (sf*st*cp + cf*sp)*sx + (-cf*st*cp + sf*sp)*sy local x = -ct*sp*sz + (-sf*st*sp + cf*cp)*sx + (cf*st*sp + sf*cp)*sy local y = st*sz - sf*ct*sx + cf*ct*sy local rotX = rotpX - rotvX local rotY = rotpY - rotvY local rotZ = rotpZ - rotvZ setElementData(thePlayer, "CountGlueVeh", count+1) -- ADD +1 TO ELEMENT DATA WHEN GLUE triggerServerEvent("glueVehicle", attachMe, attachedTo, x*-1, y*-1, z*-1, rotX, rotY, rotZ) unbindKey("k","down",gluev) bindKey("k","down",ungluev) end else end end addCommandHandler("gluev",gluev) function ungluev () local player = getLocalPlayer() local myVehicle = getPedOccupiedVehicle(player) local vtype = getElementModel(myVehicle) if vtype == (487 or 548 or 425 or 417 or 488 or 497 or 563 or 447 or 469) then local attached = getAttachedElements(myVehicle) for k,v in ipairs(attached) do if getElementType(v) == "vehicle" then myVehicle = v end end end setElementData(player, "CountGlueVeh", 0) -- SET 0 TO ELEMENT DATA WHEN UNGLUE triggerServerEvent("unglueVehicle", myVehicle) unbindKey("jump","down",ungluev) unbindKey("k","down",ungluev) bindKey("k","down",gluev) end addCommandHandler("unglue",ungluev) bindKey("k","down",gluev) function setnull() -- I'VE MADED COMMAND TO BE SURE THAT COUNT IS NULL local player = getLocalPlayer() setElementData(player, "CountGlueVeh", 0) end addCommandHandler("setnull",setnull) i've pointed that what i've added.
-
Sure, I'm too thinked about it, but in this situation really don't know how to use it, it's really complicated. That's the script: function gluev() local outString outputDebugString("glue vehicle") local thePlayer = getLocalPlayer() local myVehicle = getPedOccupiedVehicle(thePlayer) if myVehicle then local attachMe, attachedTo outputDebugString("my vehicle") local vehicles = getElementsByType("vehicle") local closest, cdist = nil, 100 local mx,my,mz = getElementPosition(myVehicle) for k,v in ipairs(vehicles) do local model = getElementModel(v) if isElementStreamedIn(v) and model == 578 and v ~= myVehicle then local x,y,z = getElementPosition(v) local tmpdist = getDistanceBetweenPoints3D(x,y,z,mx,my,mz) if tmpdist < cdist then cdist = tmpdist closest = v end end end outputDebugString("Auto = " .. getVehicleName(closest) .. ", distancia: " .. tonumber(cdist) .. "") if cdist > 4.1 or cdist == nil then return false end local vtype = getElementModel(myVehicle) if vtype == (487 or 548 or 425 or 417 or 488 or 497 or 563 or 447 or 469) then attachMe = closest attachedTo = myVehicle else attachMe = myVehicle attachedTo = closest end local px, py, pz = getElementPosition(attachedTo) local vx, vy, vz = getElementPosition(attachMe) local sx = px - vx local sy = py - vy local sz = pz - vz local rotpX, rotpY, rotpZ = getElementRotation(attachedTo) local rotvX, rotvY, rotvZ = getElementRotation(attachMe) local t = math.rad(rotvX) local p = math.rad(rotvY) local f = math.rad(rotvZ) local ct = math.cos(t) local st = math.sin(t) local cp = math.cos(p) local sp = math.sin(p) local cf = math.cos(f) local sf = math.sin(f) local z = ct*cp*sz + (sf*st*cp + cf*sp)*sx + (-cf*st*cp + sf*sp)*sy local x = -ct*sp*sz + (-sf*st*sp + cf*cp)*sx + (cf*st*sp + sf*cp)*sy local y = st*sz - sf*ct*sx + cf*ct*sy local rotX = rotpX - rotvX local rotY = rotpY - rotvY local rotZ = rotpZ - rotvZ triggerServerEvent("glueVehicle", attachMe, attachedTo, x*-1, y*-1, z*-1, rotX, rotY, rotZ) unbindKey("k","down",gluev) bindKey("k","down",ungluev) else end end addCommandHandler("gluev",gluev) function ungluev () local player = getLocalPlayer() local myVehicle = getPedOccupiedVehicle(player) local vtype = getElementModel(myVehicle) if vtype == (487 or 548 or 425 or 417 or 488 or 497 or 563 or 447 or 469) then local attached = getAttachedElements(myVehicle) for k,v in ipairs(attached) do if getElementType(v) == "vehicle" then myVehicle = v end end end triggerServerEvent("unglueVehicle", myVehicle) unbindKey("jump","down",ungluev) unbindKey("k","down",ungluev) bindKey("k","down",gluev) end addCommandHandler("unglue",ungluev) bindKey("k","down",gluev)
-
Hi guys. Is any way to glue max. 1 vehicle? I'm using glue2: https://community.multitheftauto.com/?p=resources ... ils&id=360
-
Hi guys. I have strange warning with latest version of abseil: Warning: abseil\main_client.lua:101: Bad Argument @ 'getPedOccupiedVehicle' [Expected ped at argument 1, got boolean] Function: function render() tick = tick or getTickCount() local nowtick = getTickCount() for i,v in ipairs(getElementsByType("player")) do local data = getElementData(v,"abseiling") if data ~= "" then local ped = getElementData(v,"abseilped") local veh = getPedOccupiedVehicle(ped) if tonumber(data) == 0 or tonumber(data) == 2 then setPedRotation(v,getPedRotation(ped)+90) elseif tonumber(data) == 1 or tonumber(data) == 3 then setPedRotation(v,getPedRotation(ped)-90) elseif data == "true" then local x,y,z = getElementPosition(v) local b1x,b1y,b1z = getPedBonePosition(v,36) local b2x,b2y,b2z = getPedBonePosition(v,25) local z3 = getGroundPosition(b2x,b2y,b2z) local px4,py4,pz4 = getElementPosition(ped) dxDrawLine3D(b1x,b1y,b1z,px4,py4,pz4,tocolor(0,0,0,255),2,false,0) dxDrawLine3D(b1x,b1y,b1z,b2x,b2y,b2z,tocolor(0,0,0,255),2,false,0) dxDrawLine3D(b2x,b2y,b2z,b2x,b2y,z3,tocolor(0,0,0,255),2,false,0) if not isPedOnGround(v) and not (isElementInWater(v) or testLineAgainstWater(x,y,z+1,x,y,z-1)) then if v == localplayer then local _,_,vvelz = getElementVelocity(veh) local vx,vy,_ = getElementPosition(getElementData(v,"abseilped")) local px,py,_ = getElementPosition(v) local sx,sy = 0.1*(vx-px),0.1*(vy-py) local speed = tonumber(getElementData(v,"abseilspeed")) if getControlState("forwards") and not getControlState("backwards") then speed = speed - (getTickCount()-tick)*0.0005 if speed < -0.4 then speed = -0.4 end elseif getControlState("backwards") and not getControlState("forwards") then speed = speed + (getTickCount()-tick)*0.0005 if speed > -0.1 then speed = -0.1 end end setElementData(v,"abseilspeed",speed) setElementVelocity(v,sx,sy,speed+vvelz) end else setElementData(v,"abseiling","") setElementData(v,"abseilped","") setElementData(v,"abseilspeed",-0.25) setPedAnimation(v) removeEventHandler("onClientPlayerWasted",v,deathAnim) if v == localplayer then triggerServerEvent("doForceStopAbseiling",v,ped) else setElementCollidableWith(v,veh,true) setElementCollidableWith(v,ped,true) removeEventHandler("onClientPlayerDamage",v,cancelDamage) end end end end end for i,v in ipairs(vehiclesToWatch) do if isElement(v) then local x,y,z = getElementPosition(v) local gz = getGroundPosition(x,y,z) if gz then if z - gz <= 2 then triggerServerEvent("doRemovePilotDummy",v) table.remove(vehiclesToWatch,i) end end else table.remove(vehiclesToWatch,i) end end tick = nowtick end addEventHandler("onClientRender",getRootElement(),render) Line 101: getPedOccupiedVehicle(ped) That make my server little laggy, so i really want to know the reason. Abseil link: https://community.multitheftauto.com/in ... ls&id=1873
-
Try this to save: function SaveWantedLevel() local players = getElementsByType ( "player" ) for theKey,thePlayer in ipairs(players) do local level = getPlayerWantedLevel ( thePlayer ) setAccountData ( thePlayer, "wantedlevel", level) end end addEventHandler( "OnPlayerQuit", getRootElement(),SaveWantedLevel ) and this for load: function LoadWantedLevel() local players = getElementsByType ( "player" ) for theKey,thePlayer in ipairs(players) do local level = getAccountData ( thePlayer, "wantedlevel" ) setPlayerWantedLevel ( thePlayer, level ) end end addEventHandler( "onPlayerLogin", getRootElement(), LoadWantedLevel )
-
Hi guys. I want to delete some vehicles from different positions. So i make that script: skasuj = { ["usun"] = { {-1185.9775390625,26.4111328125,14.1484375}, {-1724.5830078125,2559.3544921875,104.09127807617}, {615.744140625,850.1572265625,-43.009014129639}, }, } function zaznacz () for i,veh in ipairs(skasuj) do local x,y,z = veh[1],veh[2],veh[3] destroyElement(veh) end end addCommandHandler("zaznacz",zaznacz) but it's not working. What's wrong with it?
-
Guys, i know why disable toggle control of sprinting and jumping doesn't work. I try to disable these togglecontrols to nearby player sign as thePlayer on server-side: function dupa2 (thePlayer) toggleControl ( thePlayer, "walk", false) -- working toggleControl ( thePlayer, "jump", false) -- not working toggleControl ( thePlayer, "crouch", false ) -- working toggleControl ( thePlayer, "sprint", false ) -- not working toggleControl ( thePlayer, "fire", false ) -- working toggleControl ( thePlayer, "next_weapon", false ) -- working toggleControl ( thePlayer, "previous_weapon", false ) -- working toggleControl ( thePlayer, "aim_weapon", false ) -- working setControlState(thePlayer, "crouch",true) setTimer(setControlState,100,1,thePlayer,"crouch",false) triggerClientEvent(source, "refreshInventoryManual", source) end addEvent("handcuffs", true) addEventHandler("handcuffs", getRootElement(), dupa2) how you can see spring and jump does not works, because in client-side is already defined same toggle control: function checkBrokenbone() if getElementData(getLocalPlayer(), "logedin") then if getElementData(getLocalPlayer(), "brokenbone") then if not isPedDucked(getLocalPlayer()) then end toggleControl("jump", false) -- there toggleControl("sprint", false) -- there else toggleControl("jump", true) -- and there toggleControl("sprint", true) -- and there end end end setTimer(checkBrokenbone, 1400, 0) and there's a conflict, or something, because when i remove this: else toggleControl("jump", true) -- and there toggleControl("sprint", true) -- and there crouching script fully works. How to fix that?
-
Okay, i decide to do something other: setControlState( thePlayer, "walk", true ) -- working toggleControl ( thePlayer, "jump", false) -- not working toggleControl ( thePlayer, "crouch", false ) -- working toggleControl ( thePlayer, "sprint", false ) -- not working WHY?! I still can jump and sprint.
-
There is: function dupa2 (thePlayer) bool = isPedDucked(thePlayer) toggleControl(thePlayer, "crouch", not bool) toggleControl(thePlayer, "jump", not bool) end addEvent("crouchOn", true) addEventHandler("crouchOn", getRootElement(), dupa2) and it too not works.
-
I tried that: function dupa2 (thePlayer) bool = isPedDucked(thePlayer) toggleControl(thePlayer, "crouch", not bool) toggleControl(thePlayer, "jump", not bool) end no working, without errors ;c
-
My false, i don't clearly say all. I want to set it for player nearby using server-side, that's why i used thePlayer. Now i see, that thePlayer near is crouching at the second then stand up and he can't crouch again use control.
-
I don't want it for all players. Also i tried stg like this: setControlState ( thePlayer, "crouch", true ) -- set player to crouch toggleControl ( thePlayer, "crouch", false ) -- disable crouch control to stand up but don't know why it's not working. Jump? I don't undestand.
-
There's nothing about stand up ;/ just crouch, so how to disable stand up possibility in other way?
-
Hi guys. What is the controlstate of stand up from crouching position? Because i want to disable stand up possibility. Or maybe other, simply way? I'm newbie ;P
