Wysłany: 2019-01-18, 22:01
karat1
Wiek: 24 Na forum: 3758 dni Posty: 95
Nick w MP: Karatos
Piwa : 4
Witam u?y?em skryptu Marcina z gtao ta?my policyjnej tutaj macie link http://gtao.pl/<font-c...ie-vt112885.htm
Prawie wszystko dzia?a bo ta?ma si? stawia tylko np jestem na duty SAPD to nie mog? przez ni? przejsc ani pojazdem nie mog? przez z ni? przejecha?.
Wysłany: 2019-01-18, 22:24
Wilq
Wiek: 24 Na forum: 4428 dni Posty: 3410
Piwa : 739
Czy w evencie "onClientColShapeHit" po stronie klienta zgadza si? elementData z Twoj? elementDat? frakcji SAPD?
Wysłany: 2019-01-18, 23:56
karat1
Wiek: 24 Na forum: 3758 dni Posty: 95
Nick w MP: Karatos
Piwa : 4
A o to kod Kod: --[[
Ta?ma Policyjna
Skrypt pisany dla GTAO.pl
Autor: marcin778
Zakaz zmiany autora.
--]]
function getElementMatrix(element)
local rx, ry, rz = getElementRotation(element, "ZXY")
rx, ry, rz = math.rad(rx), math.rad(ry), math.rad(rz)
local matrix = {}
matrix[1] = {}
matrix[1][1] = math.cos(rz)*math.cos(ry) - math.sin(rz)*math.sin(rx)*math.sin(ry)
matrix[1][2] = math.cos(ry)*math.sin(rz) + math.cos(rz)*math.sin(rx)*math.sin(ry)
matrix[1][3] = -math.cos(rx)*math.sin(ry)
matrix[1][4] = 1
matrix[2] = {}
matrix[2][1] = -math.cos(rx)*math.sin(rz)
matrix[2][2] = math.cos(rz)*math.cos(rx)
matrix[2][3] = math.sin(rx)
matrix[2][4] = 1
matrix[3] = {}
matrix[3][1] = math.cos(rz)*math.sin(ry) + math.cos(ry)*math.sin(rz)*math.sin(rx)
matrix[3][2] = math.sin(rz)*math.sin(ry) - math.cos(rz)*math.cos(ry)*math.sin(rx)
matrix[3][3] = math.cos(rx)*math.cos(ry)
matrix[3][4] = 1
matrix[4] = {}
matrix[4][1], matrix[4][2], matrix[4][3] = getElementPosition(element)
matrix[4][4] = 1
return matrix
end
function getPositionFromElementOffset(element,offX,offY,offZ)
local m = getElementMatrix ( element ) -- Get the matrix
local x = offX * m[1][1] + offY * m[2][1] + offZ * m[3][1] + m[4][1] -- Apply transform
local y = offX * m[1][2] + offY * m[2][2] + offZ * m[3][2] + m[4][2]
local z = offX * m[1][3] + offY * m[2][3] + offZ * m[3][3] + m[4][3]
return x, y, z -- Return the transformed point
end
-----------------------------
local cfg = {
stojakID = 1228,
material = "line.png"
};
local ID = 0;
local stojaki = {}
local polygon = {}
function createLine(plr,value)
if not value then
ID = ID + 1
local ps = plr.position
local rot = plr.rotation
stojaki[ID] = {}
stojaki[ID].start = Object(cfg.stojakID, ps.x,ps.y,ps.z-0.6, rot.x,rot.y,rot.z+90)
stojaki[ID].endL = Object(cfg.stojakID,ps.x,ps.y+1,ps.z,rot.x, rot.y,rot.z+90)
stojaki[ID].start:setCollisionsEnabled(false)
stojaki[ID].endL:setCollisionsEnabled(false)
stojaki[ID].endL:setAlpha(0)
stojaki[ID].endL:attach(plr)
stojaki[ID].start:setData("owner",plr.name)
stojaki[ID].endL:setData("owner",plr.name)
else
stojaki[ID].endL:setAlpha(255)
stojaki[ID].endL:detach()
local ps = plr.position
local rot = plr.rotation
stojaki[ID].endL:setPosition(ps.x,ps.y,ps.z-0.6)
stojaki[ID].endL:setRotation(rot.x,rot.y,rot.z+90)
local posO = stojaki[ID].start.position
local rotO = stojaki[ID].start.rotation
local posO1 = stojaki[ID].endL.position
local rotO1 = stojaki[ID].endL.rotation
fx = posO.x + math.cos(rotO.x+90) * 1
fy = posO.y + math.sin(rotO.y+90) * 1
fx1 = posO.x + math.sin(rotO.x-90) * 1
fy1 = posO.y + math.cos(rotO.y-90) * 1
fx2 = posO1.x + math.cos(rotO1.x+90) * 1
fy2 = posO1.y + math.sin(rotO1.y+90) * 1
fx3 = posO1.x + math.sin(rotO1.x-90) * 1
fy3 = posO1.y + math.cos(rotO1.y-90) * 1
polygon[ID] = ColShape.Polygon(fx,fy,fx,fy,fx1,fy1,fx3,fy3,fx2,fy2)
polygon[ID]:setData("line:col",true)
polygon[ID]:setData("owner",plr.name)
end
end
addEvent("createLine",true)
addEventHandler("createLine",localPlayer,createLine)
addEventHandler("onClientColShapeHit",root,function(plr,md)
if source:getData("line:col") then
if plr:getType() == "player" or plr:getType() == "vehicle" then
if not plr:getData("duty") then
local x,y,z = getPositionFromElementOffset(plr,0,-2,0)
plr:setPosition(x,y,z)
plr:setFrozen(true)
Timer(function(plr)
plr:setFrozen(false)
end,2*1000,1,plr)
end
end
end
end)
addEventHandler("onClientRender",root,function()
for i =1, ID do
if isElement(stojaki[i].start) then
local ps = stojaki[i].start.position
local pse = stojaki[i].endL.position
local tex = DxTexture(cfg.material)
dxDrawMaterialLine3D(ps.x,ps.y,ps.z+0.2, pse.x,pse.y,pse.z+0.2, tex, 0.1)
end
end
end)
function destroy_line(plr)
number = 0;
for i=1,ID do
if isElement(stojaki[i].start) then
if stojaki[i].start:getData("owner") == getPlayerName(plr) then
stojaki[i].start:destroy()
stojaki[i].endL:destroy()
polygon[i]:destroy()
number = number + 1
end
end
end
outputChatBox("Usuni?to " ..number.." ta?m(y).",255,255,255)
end
addEvent("destroyLine",true)
addEventHandler("destroyLine",getRootElement(),destroy_line)
Wysłany: 2019-01-19, 00:22
Wilq
Wiek: 24 Na forum: 4428 dni Posty: 3410
Piwa : 739
Posiadasz elementDat? "duty"?
Wysłany: 2019-01-19, 00:27
karat1
Wiek: 24 Na forum: 3758 dni Posty: 95
Nick w MP: Karatos
Piwa : 4
tak if getElementData(plr,"player:duty") == "SAPD" then
Wysłany: 2019-01-19, 01:08
Wilq
Wiek: 24 Na forum: 4428 dni Posty: 3410
Piwa : 739
"player:duty" a "duty" to dwie r?zne elementDaty.
Podmie? sobie kod:
--[[
Ta ? ma Policyjna
Skrypt pisany dla GTAO . pl
Autor : marcin778
Zakaz zmiany autora .
--]]
function getElementMatrix ( element )
local rx , ry , rz = getElementRotation ( element , "ZXY" )
rx , ry , rz = math . rad ( rx ), math . rad ( ry ), math . rad ( rz )
local matrix = {}
matrix [ 1 ] = {}
matrix [ 1 ][ 1 ] = math . cos ( rz )* math . cos ( ry ) - math . sin ( rz )* math . sin ( rx )* math . sin ( ry )
matrix [ 1 ][ 2 ] = math . cos ( ry )* math . sin ( rz ) + math . cos ( rz )* math . sin ( rx )* math . sin ( ry )
matrix [ 1 ][ 3 ] = - math . cos ( rx )* math . sin ( ry )
matrix [ 1 ][ 4 ] = 1
matrix [ 2 ] = {}
matrix [ 2 ][ 1 ] = - math . cos ( rx )* math . sin ( rz )
matrix [ 2 ][ 2 ] = math . cos ( rz )* math . cos ( rx )
matrix [ 2 ][ 3 ] = math . sin ( rx )
matrix [ 2 ][ 4 ] = 1
matrix [ 3 ] = {}
matrix [ 3 ][ 1 ] = math . cos ( rz )* math . sin ( ry ) + math . cos ( ry )* math . sin ( rz )* math . sin ( rx )
matrix [ 3 ][ 2 ] = math . sin ( rz )* math . sin ( ry ) - math . cos ( rz )* math . cos ( ry )* math . sin ( rx )
matrix [ 3 ][ 3 ] = math . cos ( rx )* math . cos ( ry )
matrix [ 3 ][ 4 ] = 1
matrix [ 4 ] = {}
matrix [ 4 ][ 1 ], matrix [ 4 ][ 2 ], matrix [ 4 ][ 3 ] = getElementPosition ( element )
matrix [ 4 ][ 4 ] = 1
return matrix
end
function getPositionFromElementOffset ( element , offX , offY , offZ )
local m = getElementMatrix ( element ) -- Get the matrix
local x = offX * m [ 1 ][ 1 ] + offY * m [ 2 ][ 1 ] + offZ * m [ 3 ][ 1 ] + m [ 4 ][ 1 ] -- Apply transform
local y = offX * m [ 1 ][ 2 ] + offY * m [ 2 ][ 2 ] + offZ * m [ 3 ][ 2 ] + m [ 4 ][ 2 ]
local z = offX * m [ 1 ][ 3 ] + offY * m [ 2 ][ 3 ] + offZ * m [ 3 ][ 3 ] + m [ 4 ][ 3 ]
return x , y , z -- Return the transformed point
end
-----------------------------
local cfg = {
stojakID = 1228 ,
material = "line.png"
};
local ID = 0 ;
local stojaki = {}
local polygon = {}
function createLine ( plr , value )
if not value then
ID = ID + 1
local ps = plr . position
local rot = plr . rotation
stojaki [ ID ] = {}
stojaki [ ID ]. start = Object ( cfg . stojakID , ps . x , ps . y , ps . z - 0.6 , rot . x , rot . y , rot . z + 90 )
stojaki [ ID ]. endL = Object ( cfg . stojakID , ps . x , ps . y + 1 , ps . z , rot . x , rot . y , rot . z + 90 )
stojaki [ ID ]. start : setCollisionsEnabled ( false )
stojaki [ ID ]. endL : setCollisionsEnabled ( false )
stojaki [ ID ]. endL : setAlpha ( 0 )
stojaki [ ID ]. endL : attach ( plr )
stojaki [ ID ]. start : setData ( "owner" , plr . name )
stojaki [ ID ]. endL : setData ( "owner" , plr . name )
else
stojaki [ ID ]. endL : setAlpha ( 255 )
stojaki [ ID ]. endL : detach ()
local ps = plr . position
local rot = plr . rotation
stojaki [ ID ]. endL : setPosition ( ps . x , ps . y , ps . z - 0.6 )
stojaki [ ID ]. endL : setRotation ( rot . x , rot . y , rot . z + 90 )
local posO = stojaki [ ID ]. start . position
local rotO = stojaki [ ID ]. start . rotation
local posO1 = stojaki [ ID ]. endL . position
local rotO1 = stojaki [ ID ]. endL . rotation
fx = posO . x + math . cos ( rotO . x + 90 ) * 1
fy = posO . y + math . sin ( rotO . y + 90 ) * 1
fx1 = posO . x + math . sin ( rotO . x - 90 ) * 1
fy1 = posO . y + math . cos ( rotO . y - 90 ) * 1
fx2 = posO1 . x + math . cos ( rotO1 . x + 90 ) * 1
fy2 = posO1 . y + math . sin ( rotO1 . y + 90 ) * 1
fx3 = posO1 . x + math . sin ( rotO1 . x - 90 ) * 1
fy3 = posO1 . y + math . cos ( rotO1 . y - 90 ) * 1
polygon [ ID ] = ColShape . Polygon ( fx , fy , fx , fy , fx1 , fy1 , fx3 , fy3 , fx2 , fy2 )
polygon [ ID ]: setData ( "line:col" , true )
polygon [ ID ]: setData ( "owner" , plr . name )
end
end
addEvent ( "createLine" , true )
addEventHandler ( "createLine" , localPlayer , createLine )
addEventHandler ( "onClientColShapeHit" , root ,function( plr , md )
if source : getData ( "line:col" ) then
if plr : getType () == "player" or plr : getType () == "vehicle" then
if not plr : getData ( "player:duty" ) then
local x , y , z = getPositionFromElementOffset ( plr , 0 ,- 2 , 0 )
plr : setPosition ( x , y , z )
plr : setFrozen ( true )
Timer (function( plr )
plr : setFrozen ( false )
end , 2 * 1000 , 1 , plr )
end
end
end
end )
addEventHandler ( "onClientRender" , root ,function()
for i = 1 , ID do
if isElement ( stojaki [ i ]. start ) then
local ps = stojaki [ i ]. start . position
local pse = stojaki [ i ]. endL . position
local tex = DxTexture ( cfg . material )
dxDrawMaterialLine3D ( ps . x , ps . y , ps . z + 0.2 , pse . x , pse . y , pse . z + 0.2 , tex , 0.1 )
end
end
end )
function destroy_line ( plr )
number = 0 ;
for i = 1 , ID do
if isElement ( stojaki [ i ]. start ) then
if stojaki [ i ]. start : getData ( "owner" ) == getPlayerName ( plr ) then
stojaki [ i ]. start : destroy ()
stojaki [ i ]. endL : destroy ()
polygon [ i ]: destroy ()
number = number + 1
end
end
end
outputChatBox ( "Usuni?to " .. number .. " ta?m(y)." , 255 , 255 , 255 )
end
addEvent ( "destroyLine" , true )
addEventHandler ( "destroyLine" , getRootElement (), destroy_line )
Wysłany: 2019-01-19, 22:49
karat1
Wiek: 24 Na forum: 3758 dni Posty: 95
Nick w MP: Karatos
Piwa : 4
[quote="Wilq"]"player:duty" a "duty" to dwie r?zne elementDaty.
Podmie? sobie kod:
Dzk za kod tylko ?e ka?dy pojazd mo?e przejechac nawet osoby kt?ra nie jest na sluzbie
Wysłany: 2019-01-19, 22:57
Wilq
Wiek: 24 Na forum: 4428 dni Posty: 3410
Piwa : 739
To spr?buj tak:
--[[
Ta ? ma Policyjna
Skrypt pisany dla GTAO . pl
Autor : marcin778
Zakaz zmiany autora .
--]]
function getElementMatrix ( element )
local rx , ry , rz = getElementRotation ( element , "ZXY" )
rx , ry , rz = math . rad ( rx ), math . rad ( ry ), math . rad ( rz )
local matrix = {}
matrix [ 1 ] = {}
matrix [ 1 ][ 1 ] = math . cos ( rz )* math . cos ( ry ) - math . sin ( rz )* math . sin ( rx )* math . sin ( ry )
matrix [ 1 ][ 2 ] = math . cos ( ry )* math . sin ( rz ) + math . cos ( rz )* math . sin ( rx )* math . sin ( ry )
matrix [ 1 ][ 3 ] = - math . cos ( rx )* math . sin ( ry )
matrix [ 1 ][ 4 ] = 1
matrix [ 2 ] = {}
matrix [ 2 ][ 1 ] = - math . cos ( rx )* math . sin ( rz )
matrix [ 2 ][ 2 ] = math . cos ( rz )* math . cos ( rx )
matrix [ 2 ][ 3 ] = math . sin ( rx )
matrix [ 2 ][ 4 ] = 1
matrix [ 3 ] = {}
matrix [ 3 ][ 1 ] = math . cos ( rz )* math . sin ( ry ) + math . cos ( ry )* math . sin ( rz )* math . sin ( rx )
matrix [ 3 ][ 2 ] = math . sin ( rz )* math . sin ( ry ) - math . cos ( rz )* math . cos ( ry )* math . sin ( rx )
matrix [ 3 ][ 3 ] = math . cos ( rx )* math . cos ( ry )
matrix [ 3 ][ 4 ] = 1
matrix [ 4 ] = {}
matrix [ 4 ][ 1 ], matrix [ 4 ][ 2 ], matrix [ 4 ][ 3 ] = getElementPosition ( element )
matrix [ 4 ][ 4 ] = 1
return matrix
end
function getPositionFromElementOffset ( element , offX , offY , offZ )
local m = getElementMatrix ( element ) -- Get the matrix
local x = offX * m [ 1 ][ 1 ] + offY * m [ 2 ][ 1 ] + offZ * m [ 3 ][ 1 ] + m [ 4 ][ 1 ] -- Apply transform
local y = offX * m [ 1 ][ 2 ] + offY * m [ 2 ][ 2 ] + offZ * m [ 3 ][ 2 ] + m [ 4 ][ 2 ]
local z = offX * m [ 1 ][ 3 ] + offY * m [ 2 ][ 3 ] + offZ * m [ 3 ][ 3 ] + m [ 4 ][ 3 ]
return x , y , z -- Return the transformed point
end
-----------------------------
local cfg = {
stojakID = 1228 ,
material = "line.png"
};
local ID = 0 ;
local stojaki = {}
local polygon = {}
function createLine ( plr , value )
if not value then
ID = ID + 1
local ps = plr . position
local rot = plr . rotation
stojaki [ ID ] = {}
stojaki [ ID ]. start = Object ( cfg . stojakID , ps . x , ps . y , ps . z - 0.6 , rot . x , rot . y , rot . z + 90 )
stojaki [ ID ]. endL = Object ( cfg . stojakID , ps . x , ps . y + 1 , ps . z , rot . x , rot . y , rot . z + 90 )
stojaki [ ID ]. start : setCollisionsEnabled ( false )
stojaki [ ID ]. endL : setCollisionsEnabled ( false )
stojaki [ ID ]. endL : setAlpha ( 0 )
stojaki [ ID ]. endL : attach ( plr )
stojaki [ ID ]. start : setData ( "owner" , plr . name )
stojaki [ ID ]. endL : setData ( "owner" , plr . name )
else
stojaki [ ID ]. endL : setAlpha ( 255 )
stojaki [ ID ]. endL : detach ()
local ps = plr . position
local rot = plr . rotation
stojaki [ ID ]. endL : setPosition ( ps . x , ps . y , ps . z - 0.6 )
stojaki [ ID ]. endL : setRotation ( rot . x , rot . y , rot . z + 90 )
local posO = stojaki [ ID ]. start . position
local rotO = stojaki [ ID ]. start . rotation
local posO1 = stojaki [ ID ]. endL . position
local rotO1 = stojaki [ ID ]. endL . rotation
fx = posO . x + math . cos ( rotO . x + 90 ) * 1
fy = posO . y + math . sin ( rotO . y + 90 ) * 1
fx1 = posO . x + math . sin ( rotO . x - 90 ) * 1
fy1 = posO . y + math . cos ( rotO . y - 90 ) * 1
fx2 = posO1 . x + math . cos ( rotO1 . x + 90 ) * 1
fy2 = posO1 . y + math . sin ( rotO1 . y + 90 ) * 1
fx3 = posO1 . x + math . sin ( rotO1 . x - 90 ) * 1
fy3 = posO1 . y + math . cos ( rotO1 . y - 90 ) * 1
polygon [ ID ] = ColShape . Polygon ( fx , fy , fx , fy , fx1 , fy1 , fx3 , fy3 , fx2 , fy2 )
polygon [ ID ]: setData ( "line:col" , true )
polygon [ ID ]: setData ( "owner" , plr . name )
end
end
addEvent ( "createLine" , true )
addEventHandler ( "createLine" , localPlayer , createLine )
addEventHandler ( "onClientColShapeHit" , root ,function( plr , md )
if source : getData ( "line:col" ) then
if plr : getType () == "player" or plr : getType () == "vehicle" then
if ( plr : getData ( "player:duty" ) ~= "SAPD" ) or ( getElementData ( getPedOccupiedVehicle ( plr ), "player:duty" ) ~= "SAPD" ) then
local x , y , z = getPositionFromElementOffset ( plr , 0 ,- 2 , 0 )
plr : setPosition ( x , y , z )
plr : setFrozen ( true )
Timer (function( plr )
plr : setFrozen ( false )
end , 2 * 1000 , 1 , plr )
end
end
end
end )
addEventHandler ( "onClientRender" , root ,function()
for i = 1 , ID do
if isElement ( stojaki [ i ]. start ) then
local ps = stojaki [ i ]. start . position
local pse = stojaki [ i ]. endL . position
local tex = DxTexture ( cfg . material )
dxDrawMaterialLine3D ( ps . x , ps . y , ps . z + 0.2 , pse . x , pse . y , pse . z + 0.2 , tex , 0.1 )
end
end
end )
function destroy_line ( plr )
number = 0 ;
for i = 1 , ID do
if isElement ( stojaki [ i ]. start ) then
if stojaki [ i ]. start : getData ( "owner" ) == getPlayerName ( plr ) then
stojaki [ i ]. start : destroy ()
stojaki [ i ]. endL : destroy ()
polygon [ i ]: destroy ()
number = number + 1
end
end
end
outputChatBox ( "Usuni?to " .. number .. " ta?m(y)." , 255 , 255 , 255 )
end
addEvent ( "destroyLine" , true )
addEventHandler ( "destroyLine" , getRootElement (), destroy_line )
Wysłany: 2019-01-19, 23:38
karat1
Wiek: 24 Na forum: 3758 dni Posty: 95
Nick w MP: Karatos
Piwa : 4
Znalaz?em b??d w db3 [files]/[Frakcje]/Policja-tasma/s.lua:35: Bad argument @ 'getElementData' [Expected element at argument 1, got nil]
Wysłany: 2019-01-20, 00:38
Wilq
Wiek: 24 Na forum: 4428 dni Posty: 3410
Piwa : 739
Dobra, to spr?buj tego:
--[[
Ta ? ma Policyjna
Skrypt pisany dla GTAO . pl
Autor : marcin778
Zakaz zmiany autora .
--]]
function getElementMatrix ( element )
local rx , ry , rz = getElementRotation ( element , "ZXY" )
rx , ry , rz = math . rad ( rx ), math . rad ( ry ), math . rad ( rz )
local matrix = {}
matrix [ 1 ] = {}
matrix [ 1 ][ 1 ] = math . cos ( rz )* math . cos ( ry ) - math . sin ( rz )* math . sin ( rx )* math . sin ( ry )
matrix [ 1 ][ 2 ] = math . cos ( ry )* math . sin ( rz ) + math . cos ( rz )* math . sin ( rx )* math . sin ( ry )
matrix [ 1 ][ 3 ] = - math . cos ( rx )* math . sin ( ry )
matrix [ 1 ][ 4 ] = 1
matrix [ 2 ] = {}
matrix [ 2 ][ 1 ] = - math . cos ( rx )* math . sin ( rz )
matrix [ 2 ][ 2 ] = math . cos ( rz )* math . cos ( rx )
matrix [ 2 ][ 3 ] = math . sin ( rx )
matrix [ 2 ][ 4 ] = 1
matrix [ 3 ] = {}
matrix [ 3 ][ 1 ] = math . cos ( rz )* math . sin ( ry ) + math . cos ( ry )* math . sin ( rz )* math . sin ( rx )
matrix [ 3 ][ 2 ] = math . sin ( rz )* math . sin ( ry ) - math . cos ( rz )* math . cos ( ry )* math . sin ( rx )
matrix [ 3 ][ 3 ] = math . cos ( rx )* math . cos ( ry )
matrix [ 3 ][ 4 ] = 1
matrix [ 4 ] = {}
matrix [ 4 ][ 1 ], matrix [ 4 ][ 2 ], matrix [ 4 ][ 3 ] = getElementPosition ( element )
matrix [ 4 ][ 4 ] = 1
return matrix
end
function getPositionFromElementOffset ( element , offX , offY , offZ )
local m = getElementMatrix ( element ) -- Get the matrix
local x = offX * m [ 1 ][ 1 ] + offY * m [ 2 ][ 1 ] + offZ * m [ 3 ][ 1 ] + m [ 4 ][ 1 ] -- Apply transform
local y = offX * m [ 1 ][ 2 ] + offY * m [ 2 ][ 2 ] + offZ * m [ 3 ][ 2 ] + m [ 4 ][ 2 ]
local z = offX * m [ 1 ][ 3 ] + offY * m [ 2 ][ 3 ] + offZ * m [ 3 ][ 3 ] + m [ 4 ][ 3 ]
return x , y , z -- Return the transformed point
end
-----------------------------
local cfg = {
stojakID = 1228 ,
material = "line.png"
};
local ID = 0 ;
local stojaki = {}
local polygon = {}
function createLine ( plr , value )
if not value then
ID = ID + 1
local ps = plr . position
local rot = plr . rotation
stojaki [ ID ] = {}
stojaki [ ID ]. start = Object ( cfg . stojakID , ps . x , ps . y , ps . z - 0.6 , rot . x , rot . y , rot . z + 90 )
stojaki [ ID ]. endL = Object ( cfg . stojakID , ps . x , ps . y + 1 , ps . z , rot . x , rot . y , rot . z + 90 )
stojaki [ ID ]. start : setCollisionsEnabled ( false )
stojaki [ ID ]. endL : setCollisionsEnabled ( false )
stojaki [ ID ]. endL : setAlpha ( 0 )
stojaki [ ID ]. endL : attach ( plr )
stojaki [ ID ]. start : setData ( "owner" , plr . name )
stojaki [ ID ]. endL : setData ( "owner" , plr . name )
else
stojaki [ ID ]. endL : setAlpha ( 255 )
stojaki [ ID ]. endL : detach ()
local ps = plr . position
local rot = plr . rotation
stojaki [ ID ]. endL : setPosition ( ps . x , ps . y , ps . z - 0.6 )
stojaki [ ID ]. endL : setRotation ( rot . x , rot . y , rot . z + 90 )
local posO = stojaki [ ID ]. start . position
local rotO = stojaki [ ID ]. start . rotation
local posO1 = stojaki [ ID ]. endL . position
local rotO1 = stojaki [ ID ]. endL . rotation
fx = posO . x + math . cos ( rotO . x + 90 ) * 1
fy = posO . y + math . sin ( rotO . y + 90 ) * 1
fx1 = posO . x + math . sin ( rotO . x - 90 ) * 1
fy1 = posO . y + math . cos ( rotO . y - 90 ) * 1
fx2 = posO1 . x + math . cos ( rotO1 . x + 90 ) * 1
fy2 = posO1 . y + math . sin ( rotO1 . y + 90 ) * 1
fx3 = posO1 . x + math . sin ( rotO1 . x - 90 ) * 1
fy3 = posO1 . y + math . cos ( rotO1 . y - 90 ) * 1
polygon [ ID ] = ColShape . Polygon ( fx , fy , fx , fy , fx1 , fy1 , fx3 , fy3 , fx2 , fy2 )
polygon [ ID ]: setData ( "line:col" , true )
polygon [ ID ]: setData ( "owner" , plr . name )
end
end
addEvent ( "createLine" , true )
addEventHandler ( "createLine" , localPlayer , createLine )
addEventHandler ( "onClientColShapeHit" , root ,function( plr , md )
if source : getData ( "line:col" ) then
if plr : getType () == "player" or plr : getType () == "vehicle" then
if plr : getData ( "player:duty" ) ~= "SAPD" then
local x , y , z = getPositionFromElementOffset ( plr , 0 ,- 2 , 0 )
plr : setPosition ( x , y , z )
plr : setFrozen ( true )
Timer (function( plr )
plr : setFrozen ( false )
end , 2 * 1000 , 1 , plr )
end
end
end
end )
addEventHandler ( "onClientRender" , root ,function()
for i = 1 , ID do
if isElement ( stojaki [ i ]. start ) then
local ps = stojaki [ i ]. start . position
local pse = stojaki [ i ]. endL . position
local tex = DxTexture ( cfg . material )
dxDrawMaterialLine3D ( ps . x , ps . y , ps . z + 0.2 , pse . x , pse . y , pse . z + 0.2 , tex , 0.1 )
end
end
end )
function destroy_line ( plr )
number = 0 ;
for i = 1 , ID do
if isElement ( stojaki [ i ]. start ) then
if stojaki [ i ]. start : getData ( "owner" ) == getPlayerName ( plr ) then
stojaki [ i ]. start : destroy ()
stojaki [ i ]. endL : destroy ()
polygon [ i ]: destroy ()
number = number + 1
end
end
end
outputChatBox ( "Usuni?to " .. number .. " ta?m(y)." , 255 , 255 , 255 )
end
addEvent ( "destroyLine" , true )
addEventHandler ( "destroyLine" , getRootElement (), destroy_line )
Wysłany: 2019-01-20, 09:36
karat1
Wiek: 24 Na forum: 3758 dni Posty: 95
Nick w MP: Karatos
Piwa : 4
Kod: -- Police SF
------------------------------------------------------
local polils = {
{1591.45,-1711.27,5.62,359.7,0.0,359.9,597},
{1587.45,-1711.27,5.62,359.7,0.0,359.9,597},
{1583.45,-1711.27,5.62,359.7,0.0,359.9,597},
{1578.60,-1711.27,5.62,359.7,0.0,359.9,597},
{1574.45,-1711.27,5.62,359.7,0.0,359.9,597},
{1570.45,-1711.27,5.62,359.7,0.0,359.9,597},
{-1608.22,692.28,-5.52,359.7,0.0,180.1,597},
{-1604.22,692.28,-5.52,359.7,0.0,180.1,597},
{-1600.22,692.28,-5.52,359.7,0.0,180.1,597},
}
for i,v in pairs(polils) do
local vehicle=createVehicle(v[7], v[1], v[2], v[3])
setVehicleColor(vehicle,0, 0, 0)
setElementRotation(vehicle, v[4], v[5], v[6])
setVehicleEngineState(vehicle, false)
setElementFrozen(vehicle, true)
setElementData( vehicle, "Unit",i )
removeVehicleSirens(vehicle)
addVehicleSirens(vehicle, 6, 2, true, false, true, true )
setVehicleSirens(vehicle, 1, -0.800, 2.400, 0.000, 255, 255, 255, 255, 255 )
setVehicleSirens(vehicle, 2, 0.800, 2.400, 0.000, 255, 255, 255, 255, 255 )
setVehicleSirens(vehicle, 3, -0.900, -2.700, 0.000, 255, 0, 0, 255, 255 )
setVehicleSirens(vehicle, 4, 0.900, -2.700, 0.000, 255, 0, 0, 255, 255 )
setVehicleSirens(vehicle, 5, -0.600, -0.350, 0.930, 255, 0, 0, 255, 255 )
setVehicleSirens(vehicle, 6, 0.600, -0.350, 0.930, 0, 0, 255, 255, 255 )
setVehicleColor( vehicle, 0, 0, 19, 255,255,255, 255,255,255 ,255,255,255 )
setElementData(vehicle,"vehicle:police", true)
setVehicleColor( vehicle, 0, 0, 0, 255, 255, 255 )
addVehicleUpgrade(vehicle, 1025)
local acc=getVehicleHandling(vehicle)
local val=acc["engineAcceleration"]
setVehicleHandling(vehicle,"maxVelocity",300)
setVehicleHandling(vehicle,"engineAcceleration",val+7)
--setElementData(vehicle,"vehicle:rank",1)
setElementFrozen(vehicle,true)
setElementData(vehicle,"vehicle:fuel", 100)
setElementData(vehicle,"dbid", i)
setVehiclePlateText(vehicle,"SAPD - " .. i)
setVehicleDamageProof(vehicle,true)
end
Wysłany: 2019-01-20, 10:10
Wilq
Wiek: 24 Na forum: 4428 dni Posty: 3410
Piwa : 739
Kod pojazd?w nie ma tutaj nic do rzeczy - po wej?ciu w ta?m? sprawdzana jest elementData gracza.
Sprawd? kod, kt?ry wys?a?em przed Twoj? wiadomo?ci? i daj zna? o efektach.
Wysłany: 2019-01-20, 10:38
karat1
Wiek: 24 Na forum: 3758 dni Posty: 95
Nick w MP: Karatos
Piwa : 4
To go sprawdzi?em i ja jako policjant mog? przejsc ale pojazd policji nie mo?e i gracza tez
[ Dodano : 2019-01-21, 10:15 ]
Od?wie?am
Tagi: tasma-policyjna
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: