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

Wysłany: 2019-01-19, 13:34


kerfyn

Hyp3R






Wiek: 25
Na forum: 2739 dni
Posty: 121
Nick w MP: Hyp3R

Piwa: 2

Respekt: 50

Witam,chcia?bym zrobi? funkcj? kt?ra polega na tepanie w kajdankach do radiowozu gdy policjant wsi?dzie to zatrzymany razem z nim,ale nie mam poj?cia jak to zrobi?,m?g?by kto? mi pom?c da? wskaz?wki lub da? kod. Za pomoc Piwo

Komentarz DsJ3 dodany 2019-01-19, 20:21Proszę wstawiać kod bbcode "LUA" [lua]KOD LUA[/.lua] bez kropki
Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Kurczak12
Wysłany: 2019-01-19, 13:48


Avenged

Młodszy Szkrypter






Wiek: 23
Na forum: 3510 dni
Posty: 654
Nick w MP: Avenged

Piwa: 1570

Respekt: 326,3
Respekt: 326,3Respekt: 326,3Respekt: 326,3


Więcej informacji znajdziesz w Wikipedii MTA:

onVehicleEnter


sprawdzasz czy ma zakutego, jesli tak to tepasz go do auta


Więcej informacji znajdziesz w Wikipedii MTA:

warpPedIntoVehicle


Podpis
LUA, JS, PHP



Zapraszam do skorzystania z moich usług: Klik

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-01-19, 14:22


kerfyn

Hyp3R






Wiek: 25
Na forum: 2739 dni
Posty: 121
Nick w MP: Hyp3R

Piwa: 2

Respekt: 50

a mam to dopisa? do kodu z kajdankami tak? i jeszcze jedno a jak zrobi? ?eby skuty go?? by? zamro?ony ?eby nie bieg? za nami. M?glby? mi napisa? kod bo nwm gdzie to zrobi?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-01-19, 14:28


Wilq







Wiek: 24
Na forum: 4429 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Poka? sw?j kod z kajdankami, postaram(y) si??co? zrobi?.

Aby 'przyklei?' zakutego go?cia do policjanta u?yj funkcji:

Więcej informacji znajdziesz w Wikipedii MTA:

attachElements


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-01-19, 14:50


kerfyn

Hyp3R






Wiek: 25
Na forum: 2739 dni
Posty: 121
Nick w MP: Hyp3R

Piwa: 2

Respekt: 50

[b][/b] --[[
@author Lukasz Biegaj <[email protected]>
@author Karer <[email protected]>
@author WUBE <[email protected]>
@copyright 2011-2013 Lukasz Biegaj <[email protected]>
@license Dual GPLv2/MIT
@package MTA-XyzzyRP
@link https://github.com/lpiob/MTA-XyzzyRP GitHub
]]--

local function follow()
    local dokogo=getElementData(localPlayer,"kajdanki")
    if (not dokogo or not isElement(dokogo)) then
      setElementData(localPlayer,"kajdanki"nil)
      removeEventHandler("onClientPreRender"rootfollow)
      triggerServerEvent("setPedAnimation"localPlayer)
      return
    end

--    setElementInterior(localPlayergetElementInterior(dokogo))
--    setElementDimension(localPlayergetElementDimension(dokogo))

    if (getPedOccupiedVehicle(dokogo) or getElementInterior(dokogo)~=getElementInterior(localPlayer) or getElementDimension(dokogo)~=getElementDimension(localPlayer)) then
      setElementData(localPlayer,"kajdanki"nil)
      removeEventHandler("onClientPreRender"rootfollow)
      triggerServerEvent("setPedAnimation"localPlayer)
      return
    end


    local x,y,z=getElementPosition(dokogo)
    local x2,y2,z2=getElementPosition(localPlayer)
    local kat=0
    kat=math.deg(math.atan(-1*(x2-x)/(y2-y)))
    if (y2-y)<0 then
        kat=kat+180.0
    end
    kat=(kat+180)%360

--    rx,ry,rz=getElementRotation(localPlayer)
--    setElementRotation(localPlayerrx,ry,kat)
    setPedRotation(localPlayerkat)
    local dist=getDistanceBetweenPoints3D(x,y,z,x2,y2,z2)
    if (dist<1then
        setControlState("forwards"false)
    else
        setControlState("forwards"true)
    end
    if (dist>30then
      setElementPosition(localPlayerx+math.random(-1,1), y+math.random(-1,1), z+math.random(0,10)/10)
      return
    end
    if (dist>2then
        setControlState("sprint"true)
        setControlState("walk"false)
    else
        setControlState("walk"true)
        setControlState("sprint"false)
    end
--    setPedAnimation(localPlayer"ped" ,"WALK_csaw",  0truetruetrue )
--    triggerServerEvent("spac"localPlayer)
end






----

function menu_zakuj(args)
  local x,y,z=getElementPosition(localPlayer)
  local x2,y2,z2=getElementPosition(args.with)
  if (getDistanceBetweenPoints3D(x,y,z,x2,y2,z2)>5then
    outputChatBox("Podejd? bli?ej."255,0,0,true)
    return
  end
  triggerServerEvent("onKajdankiZakuj"resourceRootlocalPlayerargs.with)
end

addEvent("onKajdankiZakuj"true)
addEventHandler("onKajdankiZakuj"resourceRoot, function(kto)
  local obecnie=getElementData(localPlayer"kajdanki")
  if (obecnie and obecnie==ktothen
      setElementData(localPlayer,"kajdanki"false)
      removeEventHandler("onClientPreRender"rootfollow)
      triggerServerEvent("setPedAnimation"localPlayer)
      outputChatBox(getPlayerName(kto):gsub("#%x%x%x%x%x%x","") .. " zdejmuje z Ciebie kajdanki.",0,0,255)
    return
  end
  outputChatBox(getPlayerName(kto):gsub("#%x%x%x%x%x%x","") .. " zakuwa Ci? w kajdanki.",0,0,255)
  setElementData(localPlayer,"kajdanki"kto)
  addEventHandler("onClientPreRender"rootfollow)
end)

-------------------------------

local obecnie=getElementData(localPlayer"kajdanki")
if (obecnie and isElement(obecnie)) then
  addEventHandler("onClientPreRender"rootfollow)

end


Ostatnio zmieniony przez DsJ3 2019-01-19, 20:17, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-01-19, 17:08


Wilq







Wiek: 24
Na forum: 4429 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

--[[ 
@author Lukasz Biegaj <wielebny@bestplay.pl> 
@author Karer <karer.programmer@gmail.com> 
@author WUBE <wube@lss-rp.pl> 
@copyright 2011-2013 Lukasz Biegaj <wielebny@bestplay.pl> 
@license Dual GPLv2/MIT 
@package MTA-XyzzyRP 
@link https://github.com/lpiob/MTA-XyzzyRP GitHub 
]]-- 

local function follow() 
    local dokogo=getElementData(localPlayer,"kajdanki") 
    if (not dokogo or not isElement(dokogo)) then 
    setElementData(localPlayer,"kajdanki"nil) 
    removeEventHandler("onClientPreRender"rootfollow) 
    triggerServerEvent("setPedAnimation"localPlayer) 
    return 
    end 
    
    --    setElementInterior(localPlayergetElementInterior(dokogo)) 
    --    setElementDimension(localPlayergetElementDimension(dokogo)) 
    
    if (getElementInterior(dokogo)~=getElementInterior(localPlayer) or getElementDimension(dokogo)~=getElementDimension(localPlayer)) then 
    setElementData(localPlayer,"kajdanki"nil) 
    removeEventHandler("onClientPreRender"rootfollow) 
    triggerServerEvent("setPedAnimation"localPlayer) 
    return 
    end 
    if getPedOccupiedVehicle(dokogothen
        warpPedIntoVehicle(localPlayergetPedOccupiedVehicle(dokogo))
    end
    
    
    local x,y,z=getElementPosition(dokogo) 
    local x2,y2,z2=getElementPosition(localPlayer) 
    local kat=0 
    kat=math.deg(math.atan(-1*(x2-x)/(y2-y))) 
    if (y2-y)<0 then 
    kat=kat+180.0 
    end 
    kat=(kat+180)%360 
    
    --    rx,ry,rz=getElementRotation(localPlayer) 
    --    setElementRotation(localPlayerrx,ry,kat) 
    setPedRotation(localPlayerkat) 
    local dist=getDistanceBetweenPoints3D(x,y,z,x2,y2,z2) 
    if (dist<1then 
    setControlState("forwards"false) 
    else 
    setControlState("forwards"true) 
    end 
    if (dist>30then 
    setElementPosition(localPlayerx+math.random(-1,1), y+math.random(-1,1), z+math.random(0,10)/10) 
    return 
    end 
    if (dist>2then 
    setControlState("sprint"true) 
    setControlState("walk"false) 
    else 
    setControlState("walk"true) 
    setControlState("sprint"false) 
    end 
    --    setPedAnimation(localPlayer"ped" ,"WALK_csaw"0truetruetrue ) 
    --    triggerServerEvent("spac"localPlayer) 
    end 
    
    
    
    
    
    
    ---- 
    
    function menu_zakuj(args) 
    local x,y,z=getElementPosition(localPlayer) 
    local x2,y2,z2=getElementPosition(args.with) 
    if (getDistanceBetweenPoints3D(x,y,z,x2,y2,z2)>5then 
    outputChatBox("Podejd? bli?ej."255,0,0,true) 
    return 
    end 
    triggerServerEvent("onKajdankiZakuj"resourceRootlocalPlayerargs.with) 
    end 
    
    addEvent("onKajdankiZakuj"true) 
    addEventHandler("onKajdankiZakuj"resourceRoot, function(kto) 
    local obecnie=getElementData(localPlayer"kajdanki") 
    if (obecnie and obecnie==ktothen 
    setElementData(localPlayer,"kajdanki"false) 
    removeEventHandler("onClientPreRender"rootfollow) 
    triggerServerEvent("setPedAnimation"localPlayer) 
    outputChatBox(getPlayerName(kto):gsub("#%x%x%x%x%x%x","") .. " zdejmuje z Ciebie kajdanki.",0,0,255) 
    return 
    end 
    outputChatBox(getPlayerName(kto):gsub("#%x%x%x%x%x%x","") .. " zakuwa Ci? w kajdanki.",0,0,255) 
    setElementData(localPlayer,"kajdanki"kto) 
    addEventHandler("onClientPreRender"rootfollow) 
    end) 
    
    ------------------------------- 
    
    local obecnie=getElementData(localPlayer"kajdanki") 
    if (obecnie and isElement(obecnie)) then 
    addEventHandler("onClientPreRender"rootfollow) 
    
    end


PS. dziwny masz ten skrypt, na samym dole jakis end jest bez funkcji, no ale co wys?a?e? to wys?a?e?.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-01-19, 17:22


kerfyn

Hyp3R






Wiek: 25
Na forum: 2739 dni
Posty: 121
Nick w MP: Hyp3R

Piwa: 2

Respekt: 50

no taki jest i nic nie poradz? ale da?o rad? zrobi??

Dodano: 2019-01-19, 17:25
policeVehicles = { [598]=true,[596]=true,[597]=true,[432]=true,[433]=true,[528]=true,[490]=true,[599]=true }

 function blokada playerseatjacked )
  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,25500true)
   end
  end
 end
 addEventHandler ("onVehicleStartEnter"getRootElement(), blokada)

 function kajdankii playercmdgracz )
    if getElementData(player,'player:duty') and getElementData(player,'player:duty')=='SAPD' then
        if not (graczthen
        outputChatBox("B??d! U?yj: /kajdanki <nick/ID> ",player)
        return
        end
        local targetElement=exports['ogrpg-core']:findPlayer(playergracz)
        if targetElement then
            local xygetElementPosition(player)
            local txtytz getElementPosition(targetElement)
                
            local distance getDistanceBetweenPoints3D(xyztxtytz)
                
          if (distance<=10then
            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"rootplayertargetElement)
                outputChatBox("#0078FFZa?o?y?e? kajdanki.",player,25500true)
            --    outputChatBox("#0078FFPolicjant za?o?y? ci kajdanki. Nie mo?esz szybko biega?, skaka? ani prowadzi? pojazd?w.",targetElement,25500true)
            else
                toggleControl(targetElement"sprint"true )
                toggleControl(targetElement"jump"true )
                toggleControl(targetElement"crouch"true )
                triggerEvent("onKajdankiZakuj"rootplayertargetElement)
                outputChatBox("* #0078FF?ci?gn??e? graczowi kajdanki."player,25500true)
            --    outputChatBox("* #0078FFPolicjant ?ci?gna? Ci kajdanki.",targetElement,25500true)
            end
          else
              outputChatBox("* #0078FFJeste? za daleko gracza, ?eby m?c wystawi? mandat."player,25500true)
           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,interruptablefreezeLastFrame)
-- triggerServerEvent("setPedAnimation"localPlayer"SWORD""sword_block", -1falsefalsetrue,true)
    if (time==nilthen time=-1 end
    if (loop==nilthen loop=true end
    if (updatePosition==nilthen updatePosition=true end
    if (interruptable==nilthen interruptable=true end
    if (freezeLastFrame==nilthen freezeLastFrame=true end
--    bool setPedAnimation ped thePed [, string block=nilstring anim=nilint time=-1bool loop=truebool updatePosition=truebool interruptable=truebool freezeLastFrame true] )
    if getElementData(source"blockSettingAnimation"then return false end
    if getElementData(source"menu_usiadz"then detachElements(sourcegetElementData(source"menu_usiadz"))  end
    setPedAnimation(sourceblockanimtimeloopupdatePositioninterruptablefreezeLastFrame)

end)

for k,v in ipairs(getElementsByType("player")) do
    setElementData(v"animStartPos"false)
    setElementCollisionsEnabled(v,true)
end

taki jeszcze kod mam

Ostatnio zmieniony przez DsJ3 2019-01-19, 20:18, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-01-19, 17:38


XnoryzPL

Skrypter LUA






Wiek: 25
Na forum: 3248 dni
Posty: 44
Nick w MP: XnoryzPL

Piwa: 771

Respekt: 50

[code:1][/code:1policeVehicles = { [598]=true,[596]=true,[597]=true,[432]=true,[433]=true,[528]=true,[490]=true,[599]=true } 

function blokada playerseatjacked 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,25500trueend 
end 
end 
addEventHandler ("onVehicleStartEnter"getRootElement(), blokada) 

function kajdankii playercmdgracz ) 
if getElementData(player,'player:duty') and getElementData(player,'player:duty')=='SAPD' then 
if not (graczthen 
outputChatBox("B??d! U?yj: /kajdanki <nick/ID> ",player) 
return 
end 
local targetElement=exports['ogrpg-core']:findPlayer(playergracz) 
if targetElement then 
local xygetElementPosition(playerlocal txtytz getElementPosition(targetElementlocal distance getDistanceBetweenPoints3D(xyztxtytz) 

if (distance<=10then 
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"rootplayertargetElementoutputChatBox("#0078FFZa?o?y?e? kajdanki.",player,25500true) 
-- outputChatBox("#0078FFPolicjant za?o?y? ci kajdanki. Nie mo?esz szybko biega?, skaka? ani prowadzi? pojazd?w.",targetElement,25500true) 
else 
toggleControl(targetElement"sprint"true toggleControl(targetElement"jump"true toggleControl(targetElement"crouch"true triggerEvent("onKajdankiZakuj"rootplayertargetElementoutputChatBox("* #0078FF?ci?gn??e? graczowi kajdanki."player,25500true) 
-- outputChatBox("* #0078FFPolicjant ?ci?gna? Ci kajdanki.",targetElement,25500trueend 
else 
outputChatBox("* #0078FFJeste? za daleko gracza, ?eby m?c wystawi? mandat."player,25500trueend 
end 
else 
outputChatBox("#FF0000Nie Jeste? Policjantem.",playerend 
end 
addCommandHandler("kajdanki"kajdankiiaddEvent("setPedAnimation"trueaddEventHandler("setPedAnimation"root, function(block,anim,time,loop,updatePosition,interruptablefreezeLastFrame) 
-- triggerServerEvent("setPedAnimation"localPlayer"SWORD""sword_block", -1falsefalsetrue,true) 
if (time==nilthen time=-1 end 
if (loop==nilthen loop=true end 
if (updatePosition==nilthen updatePosition=true end 
if (interruptable==nilthen interruptable=true end 
if (freezeLastFrame==nilthen freezeLastFrame=true end 
-- bool setPedAnimation ped thePed [, string block=nilstring anim=nilint time=-1bool loop=truebool updatePosition=truebool interruptable=truebool freezeLastFrame true] ) 
if getElementData(source"blockSettingAnimation"then return false end 
if getElementData(source"menu_usiadz"then detachElements(sourcegetElementData(source"menu_usiadz")) end 
setPedAnimation(sourceblockanimtimeloopupdatePositioninterruptablefreezeLastFrameend) 

for k,v in ipairs(getElementsByType("player")) do 
setElementData(v"animStartPos"falsesetElementCollisionsEnabled(v,trueend 


Co to za kod ?? ! Dziwny troch?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-01-19, 18:06


kerfyn

Hyp3R






Wiek: 25
Na forum: 2739 dni
Posty: 121
Nick w MP: Hyp3R

Piwa: 2

Respekt: 50

no kajdanki takie mam skrypt ca?y,m?g?by kto? mi przerobi? aby posta? skuta mia?a freeze oraz wsiada?a z nami do pojazdu?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-01-19, 18:19


Wilq







Wiek: 24
Na forum: 4429 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Wys?a?em wy?ej kod, sprawd? czy dobrze wysz?o.

PS. Stosuj znaczniki [.lua] i [./lua]

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-01-19, 18:28


kerfyn

Hyp3R






Wiek: 25
Na forum: 2739 dni
Posty: 121
Nick w MP: Hyp3R

Piwa: 2

Respekt: 50

Nie dzia?a dalej jest jak by?o

Dodano: 2019-01-21, 18:20
M?g?bym kto? mi pom?c ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-01-27, 00:52


serigorro







Wiek: 28
Na forum: 2847 dni
Posty: 41
Nick w MP: Igorro

Piwa: 3

Respekt: 40

We? skrypt na kajdanki z NewPlace, wystarczy zmieni? tylko elementdaty pod swoje i ?miga :)

Postaw piwo autorowi tego posta
 

 
Tagi: tepanie :: radiwozu :: kajdankach
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » tepanie do radiwozu w kajdankach Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

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