Wysłany: 2017-04-27, 18:28
Qwertick
Coming soon...
Wiek: 23 Na forum: 3577 dni Posty: 472
Nick w MP: Qwertick
Piwa : 2726
Witam mam problem z kajdankami chodzi o to, ?e gdy zakuje gracza i id? oraz obkr?cam myszk? to zakuty gracz mi si? te? kr?ci. Prosz? o pomoc.
KOD:
function findPlayer ( plr , cel )
local target = nil
if ( tonumber ( cel ) ~= nil ) then
target = getElementByID ( "p" .. cel )
else
for _ , thePlayer in ipairs ( getElementsByType ( "player" )) do
if string . find ( string . gsub ( getPlayerName ( thePlayer ): lower (), "#%x%x%x%x%x%x" , "" ), cel : lower (), 1 , true ) then
if ( target ) then
outputChatBox ( "Znaleziono wiecej niz jednego gracza o pasujacym nicku, podaj wiecej liter." , plr )
return nil
end
target = thePlayer
end
end
end
return target
end
kaj = {}
function zalozkaj ( plr , cmd , target )
local gracz = findPlayer ( plr , target )
if getElementData ( plr , "kajdanki" ) == false then
local gracz = getPlayerName ( gracz )
local gracz = getPlayerFromName ( gracz )
local x2 , y2 , z2 = getElementPosition ( gracz )
local x , y , z = getElementPosition ( plr )
if ( getDistanceBetweenPoints3D ( x , y , z , x2 , y2 , z2 )< 20 ) then
toggleControl ( gracz , "enter_exit" , false )
toggleControl ( gracz , "enter_passenger" , false )
attachElements ( gracz , plr , 0 , 0.4 , 0 )
setElementPosition ( gracz , x , y , z )
local graczz = getPlayerName ( gracz )
kaj [ plr ] = {}
kaj [ plr ] = { graczz }
setElementData ( plr , "kajdanki" , true )
setPedAnimation ( gracz , "FAT" , "IDLE_tired" , - 1 , true , false )
outputChatBox ( "" .. getPlayerName ( plr ).. " zakuwa ci? w kajdanki." , gracz , 255 , 255 , 255 , true )
outputChatBox ( "Zak?adasz kajdanki graczowi " .. graczz .. "." , plr , 255 , 255 , 255 , true )
end
else
outputChatBox ( "Nie mo?esz za?o?y? kajdanek dw?m osobom na raz." , plr , 255 , 255 , 255 , true )
end
end
addCommandHandler ( "zakuj" , zalozkaj )
addEventHandler ( "onVehicleEnter" , root ,
function( plr )
if getElementData ( plr , "kajdanki" ) then
local peds = kaj [ plr ][ 1 ]
local ped = getPlayerFromName ( peds )
local veh = getPedOccupiedVehicle ( plr )
local atta = getAttachedElements ( plr )
for i , v in pairs ( atta )do
detachElements ( v , plr )
end
warpPedIntoVehicle ( ped , veh , 3 )
outputChatBox ( "" .. getPlayerName ( plr ).. " wsadza ci? do radiowozu." , ped , 255 , 255 , 255 , true )
outputChatBox ( "Wsadzasz do radiowozu gracza " .. getPlayerName ( ped ).. "." , plr , 255 , 255 , 255 , true )
end
end )
addEventHandler ( "onVehicleStartExit" , root ,
function( plr )
if getElementData ( plr , "kajdanki" ) then
local ped = kaj [ plr ][ 1 ]
local ped = getPlayerFromName ( ped )
local x , y , z = getElementPosition ( plr )
removePedFromVehicle ( ped )
attachElements ( ped , plr , 0 , 0.4 , 0 )
outputChatBox ( "" .. getPlayerName ( plr ).. " wyci?ga ci? z radiowozu." , ped , 255 , 255 , 255 , true )
outputChatBox ( "Wyci?gasz z radiowozu gracza " .. getPlayerName ( ped ).. "." , plr , 255 , 255 , 255 , true )
end
end )
function sciagnijkaj ( plr , cmd , target )
local gracz = findPlayer ( plr , target )
if getElementData ( plr , "kajdanki" ) then
local gracz = getPlayerName ( gracz )
local gracz = getPlayerFromName ( gracz )
local x2 , y2 , z2 = getElementPosition ( gracz )
local x , y , z = getElementPosition ( plr )
if ( getDistanceBetweenPoints3D ( x , y , z , x2 , y2 , z2 )< 20 ) then
local atta = getAttachedElements ( plr )
toggleControl ( gracz , "enter_exit" , true )
toggleControl ( gracz , "enter_passenger" , true )
for i , v in pairs ( atta )do
detachElements ( v , plr )
end
setElementPosition ( gracz , x + 2 , y , z )
setElementData ( plr , "kajdanki" , false )
kaj [ plr ] = {}
outputChatBox ( "" .. getPlayerName ( plr ).. " odkuwa ci?." , gracz , 255 , 255 , 255 , true )
outputChatBox ( "?ci?gasz kajdanki graczowi " .. getPlayerName ( gracz ).. "." , plr , 255 , 255 , 255 , true )
end
else
outputChatBox ( "Nie za?ozy?e? nikomu kajdanek." , plr , 255 , 255 , 255 , true )
end
end
addCommandHandler ( "odkuj" , sciagnijkaj )
[ Dodano : 2017-04-28, 13:32 ]
Pomo?e kto??
Podpis
Kontakt
Discord: Qwertick#1210
Wysłany: 2017-04-28, 14:41
amited
Wiek: 26 Na forum: 3714 dni Posty: 1233
Nick w MP: Amited
Piwa : 512
Przyklejasz gracza do siebie tym:
attachElements ( gracz , plr , 0 , 0.4 , 0 )
Dlatego za tob? chodzi.
Podpis
"amited" napisał/a :
Wysłany: 2017-04-28, 14:45
Qwertick
Coming soon...
Wiek: 23 Na forum: 3577 dni Posty: 472
Nick w MP: Qwertick
Piwa : 2726
amited , Dok?adnie
Podpis
Kontakt
Discord: Qwertick#1210
Wysłany: 2017-04-28, 16:30
amited
Wiek: 26 Na forum: 3714 dni Posty: 1233
Nick w MP: Amited
Piwa : 512
Wercio. , No wi?c?
Podpis
"amited" napisał/a :
Wysłany: 2017-04-28, 16:37
Qwertick
Coming soon...
Wiek: 23 Na forum: 3577 dni Posty: 472
Nick w MP: Qwertick
Piwa : 2726
amited , ?
Podpis
Kontakt
Discord: Qwertick#1210
Wysłany: 2017-04-28, 17:24
neku^
Wiek: 24 Na forum: 3521 dni Posty: 461
Nick w MP: neku^
Piwa : 1186
attachElements sprawia ?e gracz zakuty w kajdanki si? obraca. Poglowkuj troch? albo sprawd? w jakiej? innej paczce.
Wysłany: 2017-04-28, 17:28
amited
Wiek: 26 Na forum: 3714 dni Posty: 1233
Nick w MP: Amited
Piwa : 512
W?a?nie nie wiem o co mu chodzi. "Dok?adnie"? Ale co dok?adnie? Wiedzia?e? ?e to to obraca graczem? Czy jak? A mo?e problem rozwi?zany?
Podpis
"amited" napisał/a :
Wysłany: 2017-04-28, 20:03
=DC=
Wiek: 35 Na forum: 3944 dni Posty: 223
Nick w MP: =DC=
Piwa : 72
Po co uzywa? "attachElements" jak mo?na zrobi? ?eby zakuty chodzi? za osob? kt?ra go aresztowa?a:
function followZakuty ()
local x , y , z = getElementPosition ( plr )
local x1 , y1 , z1 = getElementPosition ( ped )
local obr = 0
obr = math . deg ( math . atan (- 1 *( x1 - x )/( y1 - y )))
if ( y1 - y )< 0 then
obr = obr + 180.0
end
obr =( obr + 180 )% 360
if not obr or not tonumber ( obr ) then return end
setPedRotation ( ped , obr )
local dist = getDistanceBetweenPoints3D ( x , y , z , x1 , y1 , z1 )
if localPlayer == ped then
if ( dist < 1 ) then
setControlState ( "forwards" , false )
else
setControlState ( "forwards" , true )
end
end
end
addEventHandler ( "onClientRender" , root , followZakuty )
Podpis
Witaj
[you]
, jeśli Ci pomogłem postaw mi lub Dzięki!
Tagi: kajdanki
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: