BH|LeFeS
DayZ is EPIC!
Wiek: 21 Na forum: 3508 dni Posty: 82
Nick w MP: LeFeS
Piwa : 7
Gdy nak?adam kajdanki, to potem jak jeszcze raz napisze kajdanki to nie zdejmuje tylko ponownie zak?ada kajdanki, jak si? RC zrobi to nie ma si? ju? wiecie jak to naprawi?, Prosze o pomoc bo nie wiem co robi?.
KOD: Kod:
policeVehicles = { [598]=true,[596]=true,[597]=true,[432]=true,[433]=true,[528]=true,[490]=true,[599]=true }
function blokada ( player, seat, jacked )
local kategoria = getElementData(player, "kajdanki")
if kategoria ~= false then
if ( not policeVehicles[getElementModel(source)] ) then
cancelEvent()
outputChatBox("#FF0000Masz kajdanki i nie mo?esz wsi??? do tego pojazdu.",player,255, 0, 0, true)
end
end
end
addEventHandler ("onVehicleStartEnter", getRootElement(), blokada)
function kajdankii ( player, cmd, gracz )
if getElementData(player,'player:duty') and getElementData(player,'player:duty')=='SAPD' then
if not (gracz) then
outputChatBox("B??d! U?yj: /kajdanki <nick/ID> ",player)
return
end
local targetElement=exports['ogrpg-core']:findPlayer(player, gracz)
if targetElement then
local x, y, z = getElementPosition(player)
local tx, ty, tz = getElementPosition(targetElement)
local distance = getDistanceBetweenPoints3D(x, y, z, tx, ty, tz)
if (distance<=10) then
local dokogo=getElementData(targetElement,"kajdanki")
if (not dokogo or not isElement(dokogo)) then
toggleControl(targetElement, "sprint", false )
toggleControl(targetElement, "jump", false )
toggleControl(targetElement, "aim_weapon", false )
toggleControl(targetElement, "fire", false )
toggleControl(targetElement, "crouch", false )
triggerEvent("onKajdankiZakuj", root, player, targetElement)
outputChatBox("#0078FFZa?o?y?e? kajdanki.",player,255, 0, 0, true)
-- outputChatBox("#0078FFPolicjant za?o?y? ci kajdanki. Nie mo?esz szybko biega?, skaka? ani prowadzi? pojazd?w.",targetElement,255, 0, 0, true)
else
toggleControl(targetElement, "sprint", true )
toggleControl(targetElement, "jump", true )
toggleControl(targetElement, "crouch", true )
triggerEvent("onKajdankiZakuj", root, player, targetElement)
outputChatBox("* #0078FF?ci?gn??e? graczowi kajdanki.", player,255, 0, 0, true)
-- outputChatBox("* #0078FFPolicjant ?ci?gna? Ci kajdanki.",targetElement,255, 0, 0, true)
end
else
outputChatBox("* #0078FFJeste? za daleko gracza, ?eby m?c wystawi? mandat.", player,255, 0, 0, true)
end
end
else
outputChatBox("#FF0000Nie Jeste? Policjantem.",player)
end
end
addCommandHandler("kajdanki", kajdankii)
addEvent("setPedAnimation", true)
addEventHandler("setPedAnimation", root, function(block,anim,time,loop,updatePosition,interruptable, freezeLastFrame)
-- triggerServerEvent("setPedAnimation", localPlayer, "SWORD", "sword_block", -1, false, false, true,true)
if (time==nil) then time=-1 end
if (loop==nil) then loop=true end
if (updatePosition==nil) then updatePosition=true end
if (interruptable==nil) then interruptable=true end
if (freezeLastFrame==nil) then freezeLastFrame=true end
-- bool setPedAnimation ( ped thePed [, string block=nil, string anim=nil, int time=-1, bool loop=true, bool updatePosition=true, bool interruptable=true, bool freezeLastFrame = true] )
if getElementData(source, "blockSettingAnimation") then return false end
if getElementData(source, "menu_usiadz") then detachElements(source, getElementData(source, "menu_usiadz")) end
setPedAnimation(source, block, anim, time, loop, updatePosition, interruptable, freezeLastFrame)
end)
for k,v in ipairs(getElementsByType("player")) do
setElementData(v, "animStartPos", false)
setElementCollisionsEnabled(v,true)
end