function attachElementToBone(element,ped,bone,x,y,z,rx,ry,rz)
if not (isElement(element) and isElement(ped)) then return false end
if getElementType(ped) ~= "ped" and getElementType(ped) ~= "player" then return false end
bone = tonumber(bone)
if not bone or bone < 1 or bone > 20 then return false end
x,y,z,rx,ry,rz = tonumber(x) or 0,tonumber(y) or 0,tonumber(z) or 0,tonumber(rx) or 0,tonumber(ry) or 0,tonumber(rz) or 0
attached_ped[element] = ped
attached_bone[element] = bone
attached_x[element] = x
attached_y[element] = y
attached_z[element] = z
attached_rx[element] = rx
attached_ry[element] = ry
attached_rz[element] = rz
if setElementCollisionsEnabled then
setElementCollisionsEnabled(element,false)
end
if script_serverside then
triggerClientEvent("boneAttach_attach",root,element,ped,bone,x,y,z,rx,ry,rz)
end
return true
end
function detachElementFromBone(element)
if not element then return false end
if not attached_ped[element] then return false end
clearAttachmentData(element)
if setElementCollisionsEnabled then
setElementCollisionsEnabled(element,true)
end
if script_serverside then
triggerClientEvent("boneAttach_detach",root,element)
end
retu...
Witam co tutaj jest nie tak? Chcia?bym by moje zombie na serwerze potrafi?y skaka?. Odwdzi?cz? si? za pomoc!
[code]
checkZombies = function()
for i,ped in ipairs(getElementsByType("ped",root,true)) do
if getElementData(ped, "zombie") then
local x,y,z = getElementPosition ( localPlayer )
local zx,zy,zz = getElementPosition (ped)
local zfrontx, zfronty, zfrontz = getPositionInfrontOfElement(ped, 3)
local vect1X, vect1Y = zx-x, zy-z
local vect2X, vect2Y = zfrontx-zx, zfronty - zy
local scal = vect2X*vect1X+vect2Y*vect1Y
local distance = getDistanceBetweenPoints3D ( x,y,z, zx,zy,zz )
local sound = getElementData(getLocalPlayer(), "volume") / 5
local visibly = getElementData(getLocalPlayer(), "visibly") / 5
local ready = true
if ( distance > sound*1.2 + visibly*1.2 and scal <= 0 ) or ( distance > sound*1.4 + visibly*1.4 ) then -- Расстояние за которую он вас увидит и услышит (средне)
ready = false
end
if ready then
triggerServerEvent ( "chasedStartAttackC", getLocalPlayer(), ped )
end
end
end
end
setTimer(checkZombies, 2000, 0)
setElementData ( localPlayer, "spawnedzombies", 0 )
Mam problem z zamkni?ciem drugiego GUI.
Stworzy?em 2 GUI, pierwsze GUI dzia?a dobrze, jest guzik zamkni?cia oraz guzik przejscia do drugiego GUI. W drugim GUI mam guzik zamknij, kt?ry nie dzia?a.
[lua]local screenW, screenH = guiGetScreenSize()
function isCursorOnElement(x,y,w,h)
local mx,my = getCursorPosition ()
local fullx,fully = guiGetScreenSize()
cursorx,cursory = mx*fullx,my*fully
if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then
return true
else
return false
end
end
Witam, mam kod, ?e pojawia mi si? okienko po klikni?ciu F4, jednak po ponownym klikni?ciu pojawia si? ono znowu (skoro nie ma zaprogramowane inaczej to logiczne) i si? buguje. Zamykam je aktualnie przyciskiem, kt?ry sobie zaprogramowa?em na klikni?cie go i zamkni?cie.
Tutaj jest kod, prosze o pomoc aby zrobi? tak, ?e po ponownym klikni?ciu F4 by si? to zamyka?o. D?uba?em ostatnio przy tym z 3-4 miesi?ce temu a zawsze by?em laikiem w LUA.