Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2020-04-10, 16:42


DamianekPL32006







Wiek: 26
Na forum: 2893 dni
Posty: 33
Nick w MP: DamianekPL32006



Respekt: 50

Chc? aby gracz po zakuciu nie chodzi? za policjantem.
Jak nazywa si? ta funkcja z tym chodzeniem. Chc? aby tylko chodzi? powoli i nie m?g? skaka? itp.

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['pystories-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 go zaku?.", player,255, 0, 0, true)
end
end
else
outputChatBox("Nie 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


Postaw piwo autorowi tego posta
 

 
Tagi: chodzenie :: graczem
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Chodzenie za graczem Odpowiedz do tematu

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku