Wysłany: 2019-01-19, 13:34
kerfyn
Hyp3R
Wiek: 25 Na forum: 2739 dni Posty: 121
Nick w MP: Hyp3R
Piwa : 2
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
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
sprawdzasz czy ma zakutego, jesli tak to tepasz go do auta
Podpis
LUA, JS, PHP
Zapraszam do skorzystania z moich usług: Klik
Wysłany: 2019-01-19, 14:22
kerfyn
Hyp3R
Wiek: 25 Na forum: 2739 dni Posty: 121
Nick w MP: Hyp3R
Piwa : 2
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?
Wysłany: 2019-01-19, 14:28
Wilq
Wiek: 24 Na forum: 4428 dni Posty: 3410
Piwa : 739
Poka? sw?j kod z kajdankami, postaram(y) si??co? zrobi?.
Aby 'przyklei?' zakutego go?cia do policjanta u?yj funkcji:
Wysłany: 2019-01-19, 14:50
kerfyn
Hyp3R
Wiek: 25 Na forum: 2739 dni Posty: 121
Nick w MP: Hyp3R
Piwa : 2
[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" , root , follow )
triggerServerEvent ( "setPedAnimation" , localPlayer )
return
end
-- setElementInterior ( localPlayer , getElementInterior ( dokogo ))
-- setElementDimension ( localPlayer , getElementDimension ( dokogo ))
if ( getPedOccupiedVehicle ( dokogo ) or getElementInterior ( dokogo )~= getElementInterior ( localPlayer ) or getElementDimension ( dokogo )~= getElementDimension ( localPlayer )) then
setElementData ( localPlayer , "kajdanki" , nil )
removeEventHandler ( "onClientPreRender" , root , follow )
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 ( localPlayer , rx , ry , kat )
setPedRotation ( localPlayer , kat )
local dist = getDistanceBetweenPoints3D ( x , y , z , x2 , y2 , z2 )
if ( dist < 1 ) then
setControlState ( "forwards" , false )
else
setControlState ( "forwards" , true )
end
if ( dist > 30 ) then
setElementPosition ( localPlayer , x + math . random (- 1 , 1 ), y + math . random (- 1 , 1 ), z + math . random ( 0 , 10 )/ 10 )
return
end
if ( dist > 2 ) then
setControlState ( "sprint" , true )
setControlState ( "walk" , false )
else
setControlState ( "walk" , true )
setControlState ( "sprint" , false )
end
-- setPedAnimation ( localPlayer , "ped" , "WALK_csaw" , 0 , true , true , true )
-- 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 )> 5 ) then
outputChatBox ( "Podejd? bli?ej." , 255 , 0 , 0 , true )
return
end
triggerServerEvent ( "onKajdankiZakuj" , resourceRoot , localPlayer , args . with )
end
addEvent ( "onKajdankiZakuj" , true )
addEventHandler ( "onKajdankiZakuj" , resourceRoot , function( kto )
local obecnie = getElementData ( localPlayer , "kajdanki" )
if ( obecnie and obecnie == kto ) then
setElementData ( localPlayer , "kajdanki" , false )
removeEventHandler ( "onClientPreRender" , root , follow )
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" , root , follow )
end )
-------------------------------
local obecnie = getElementData ( localPlayer , "kajdanki" )
if ( obecnie and isElement ( obecnie )) then
addEventHandler ( "onClientPreRender" , root , follow )
end
Ostatnio zmieniony przez DsJ3 2019-01-19, 20:17, w całości zmieniany 1 raz
Wysłany: 2019-01-19, 17:08
Wilq
Wiek: 24 Na forum: 4428 dni Posty: 3410
Piwa : 739
--[[
@ 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" , root , follow )
triggerServerEvent ( "setPedAnimation" , localPlayer )
return
end
-- setElementInterior ( localPlayer , getElementInterior ( dokogo ))
-- setElementDimension ( localPlayer , getElementDimension ( dokogo ))
if ( getElementInterior ( dokogo )~= getElementInterior ( localPlayer ) or getElementDimension ( dokogo )~= getElementDimension ( localPlayer )) then
setElementData ( localPlayer , "kajdanki" , nil )
removeEventHandler ( "onClientPreRender" , root , follow )
triggerServerEvent ( "setPedAnimation" , localPlayer )
return
end
if getPedOccupiedVehicle ( dokogo ) then
warpPedIntoVehicle ( localPlayer , getPedOccupiedVehicle ( 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 ( localPlayer , rx , ry , kat )
setPedRotation ( localPlayer , kat )
local dist = getDistanceBetweenPoints3D ( x , y , z , x2 , y2 , z2 )
if ( dist < 1 ) then
setControlState ( "forwards" , false )
else
setControlState ( "forwards" , true )
end
if ( dist > 30 ) then
setElementPosition ( localPlayer , x + math . random (- 1 , 1 ), y + math . random (- 1 , 1 ), z + math . random ( 0 , 10 )/ 10 )
return
end
if ( dist > 2 ) then
setControlState ( "sprint" , true )
setControlState ( "walk" , false )
else
setControlState ( "walk" , true )
setControlState ( "sprint" , false )
end
-- setPedAnimation ( localPlayer , "ped" , "WALK_csaw" , 0 , true , true , true )
-- 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 )> 5 ) then
outputChatBox ( "Podejd? bli?ej." , 255 , 0 , 0 , true )
return
end
triggerServerEvent ( "onKajdankiZakuj" , resourceRoot , localPlayer , args . with )
end
addEvent ( "onKajdankiZakuj" , true )
addEventHandler ( "onKajdankiZakuj" , resourceRoot , function( kto )
local obecnie = getElementData ( localPlayer , "kajdanki" )
if ( obecnie and obecnie == kto ) then
setElementData ( localPlayer , "kajdanki" , false )
removeEventHandler ( "onClientPreRender" , root , follow )
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" , root , follow )
end )
-------------------------------
local obecnie = getElementData ( localPlayer , "kajdanki" )
if ( obecnie and isElement ( obecnie )) then
addEventHandler ( "onClientPreRender" , root , follow )
end
PS. dziwny masz ten skrypt, na samym dole jakis end jest bez funkcji, no ale co wys?a?e? to wys?a?e?.
Wysłany: 2019-01-19, 17:22
kerfyn
Hyp3R
Wiek: 25 Na forum: 2739 dni Posty: 121
Nick w MP: Hyp3R
Piwa : 2
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 ( 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
taki jeszcze kod mam
Ostatnio zmieniony przez DsJ3 2019-01-19, 20:18, w całości zmieniany 1 raz
Wysłany: 2019-01-19, 17:38
XnoryzPL
Skrypter LUA
Wiek: 25 Na forum: 3247 dni Posty: 44
Nick w MP: XnoryzPL
Piwa : 771
[ code : 1 ][/ code : 1 ]
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
Co to za kod ! Dziwny troch?
Wysłany: 2019-01-19, 18:06
kerfyn
Hyp3R
Wiek: 25 Na forum: 2739 dni Posty: 121
Nick w MP: Hyp3R
Piwa : 2
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?
Wysłany: 2019-01-19, 18:19
Wilq
Wiek: 24 Na forum: 4428 dni Posty: 3410
Piwa : 739
Wys?a?em wy?ej kod, sprawd? czy dobrze wysz?o.
PS. Stosuj znaczniki [.lua] i [./lua]
Wysłany: 2019-01-19, 18:28
kerfyn
Hyp3R
Wiek: 25 Na forum: 2739 dni Posty: 121
Nick w MP: Hyp3R
Piwa : 2
Nie dzia?a dalej jest jak by?o
Dodano: 2019-01-21, 18:20
M?g?bym kto? mi pom?c ?
Wysłany: 2019-01-27, 00:52
serigorro
Wiek: 28 Na forum: 2847 dni Posty: 41
Nick w MP: Igorro
Piwa : 3
We? skrypt na kajdanki z NewPlace, wystarczy zmieni? tylko elementdaty pod swoje i ?miga
Tagi: tepanie :: radiwozu :: kajdankach
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: