Wysłany: 2016-03-26, 09:27
sasik12
Wiek: 26 Na forum: 3763 dni Posty: 182
Piwa : 7
Witam. Tak jak w temacie jakich funkcji u?y? po kolei , wyt?umaczcie co mam zrobi?. Chce zrobi? skrypt na kolczatk? .
Wysłany: 2016-03-26, 10:29
FaydenFX.
Wiek: 27 Na forum: 4056 dni Posty: 246
Nick w MP: faydn
Piwa : 11
Wysłany: 2016-03-26, 14:32
sasik12
Wiek: 26 Na forum: 3763 dni Posty: 182
Piwa : 7
Nie wiem jak zrobic ?eby kolczatka sie usuwa?a
Pomo?ecie ?
local thePlayer = getLocalPlayer ()
local theKolczatka = {}
local kolec = {}
function kladz ()
if( isPedInVehicle ( thePlayer ) ) then -- is the player in a car ?
if( isElement ( theKolczatka [ thePlayer ] ) ) then
destroyElement ( theKolczatka [ thePlayer ] )
destroyElement ( kolec [ thePlayer ] )
end
local theVehicle = getPedOccupiedVehicle ( thePlayer )
local rx , ry , rz = getElementRotation ( theVehicle )
local x , y , z = getElementPosition ( theVehicle )
local a = getPedRotation ( thePlayer )
x = x + math . sin ( math . rad ( a ) ) * 4
y = y - math . cos ( math . rad ( a ) ) * 4
rz = rz + 90
local ziemiaZ = getGroundPosition ( x , y , z )
if( ziemiaZ ~= z ) then z = ziemiaZ + 0.2 end
theKolczatka [ thePlayer ] = createObject ( 2899 , x , y , z , 0 , 0 , rz )
kolec [ thePlayer ] = createColRectangle ( ( x - 2.0 ), ( y - 2.0 ), 4.0 , 4.0 )
setElementData ( kolec [ thePlayer ], "kolce" , "abc" )
outputChatBox ( "Rozԯ࠹ԥܠkolczatkꡢ, thePlayer, 255, 0, 0, true )
else
outputChatBox( " Musisz by & #26743; aucie ࠥby poԯ࠹c kolczatkꡢ, thePlayer, 255, 0, 0, true )
end
end
function kolabum ( theElement , matchingDimension )
if( getElementType ( theElement ) == "vehicle" and getElementData ( source , "kolce" ) == "abc" ) then
setVehicleWheelStates ( theElement , 2 , 2 , 2 , 2 )
end
end
addEventHandler ( "onClientColShapeHit" , getRootElement (), kolabum )
addCommandHandler ( "x" , kladz )
Podpis
Uczeń LUA . Mapper MTA.
Wysłany: 2016-03-26, 18:40
marcin778
Krytyk serwerów MTA
Wiek: 24 Na forum: 4149 dni Posty: 2268
Nick w MP: Marcineg
Piwa : 4662
spr?buj
function sprzatnij ()
if getElementData ( kolec [ thePlayer ], "kolce" , "abc" ) then
destroyElement ( theKolczatka [ thePlayer ] )
outputChatBox ( "Usun??e? kolczatke" )
end
end
addCommandHandler ( "usun" , sprzatnij )
Wysłany: 2016-03-27, 17:28
sasik12
Wiek: 26 Na forum: 3763 dni Posty: 182
Piwa : 7
Nic sie niedzieje
Podpis
Uczeń LUA . Mapper MTA.
Wysłany: 2016-03-28, 11:58
#404
Wiek: 26 Na forum: 4771 dni Posty: 1438
Piwa : 2512
Na co wy to robicie po stronie client'a? ?eby zaraz by?o, ?e widzi tylko jeden gracz? Powinno lata?, tylko tamt? ostatni? funkcj? i bindKey daj po stronie client'a, reszt? po stronie serwera.
kolczatki = {}
function UsunKol ( kolczatka )
if not kolczatka then return end
local att = getAttachedElements ( kolczatka )
if #att > 1 then
for k , v in ipairs ( att ) do
destroyElement ( v )
end
elseif #att == 1 then
destroyElement ( kolczatka )
end
end
function rozloz ( gracz , cmd )
if not isPedInVehicle ( gracz ) then return end
if isElement ( kolczatki [ gracz ]) then
usunKol ( kolczatki [ gracz ])
kolczatki [ gracz ] = false
end
local veh = getPedOccupiedVehicle ( gracz )
local rx , ry , rz = getElementRotation ( veh )
local x , y , z = getElementPosition ( veh )
local a = getPedRotation ( gracz )
x = x + math . sin ( math . rad ( a ) ) * 4
y = y - math . cos ( math . rad ( a ) ) * 4
rz = rz + 90
local ziemiaZ = getElementData ( gracz , "gleba" ) or z
if( ziemiaZ ~= z ) then z = ziemiaZ + 0.2 end
kolczatki [ gracz ] = createObject ( 2899 , x , y , z , 0 , 0 , rz )
local col = createColRectangle ( 0 , 0 , 4.0 , 4.0 )
attachElements ( col , kolczatki [ gracz ])
outputChatBox ( "Roz?o?ono kolczatk?" , gracz , 255 , 0 , 0 , true )
end
addCommandHandler ( "x" , rozloz )
function kolabum ( theElement , matchingDimension )
if getElementType ( theElement ) == "vehicle" then
setVehicleWheelStates ( theElement , 2 , 2 , 2 , 2 )
end
end
addEventHandler ( "onColShapeHit" , resourceRoot , kolabum )
-- to ni ? ej do client 'a
bindKey("x", "down", "x")
addEventHandler("onClientRender", root, function()
local x,y,z = getElementPosition(localPlayer)
local gleba = getGroundPosition(x,y,z)
if gleba then
setElementData(localPlayer, "gleba", gleba)
end
end)
Tagi: jakich :: funkcji :: uźyć?
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: