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

Wysłany: 2019-02-04, 20:52


FreshuBiceps







Wiek: 19
Na forum: 3057 dni
Posty: 4
Nick w MP: FreshuY

Piwa: 35

Respekt: 50

Witam, posiadam nosze autorstwa IgorPL222. By?y pod SAMC, lecz zmieni?em na FDSA. Problem w tym, ?e normalnie wszystko cyka, opr?cz jednego. Gdy kolega z FDSA chce mnie wzi??? na nosze, pokazuje mu si?: "Ten gracz jest za daleko od Ciebie, b?d? nie jest na noszach!". Prosz? o rozwi?zanie.

EDIT: Zapomnialem doda? kodu. Oto on: (s.lua)
Autor: IgorPL222
Nie zezwalam na usuwanie tej notatki :)



local objectnosze = {} 
local nosze = {} 
local mrk = {} 
local cols = {} 
local timer = {} 
resourceRoot getResourceRootElement(getThisResource()) 

function dnosze(plr) 
if getElementData(plr"player:duty") == "FDSA" then 
x,y,getElementPosition(plrx2,y2,z2 getElementRotation(plrlocal veh getPedOccupiedVehicle(plr) 
if not veh then return end 
mrk[veh] = createMarker(000"cylinder"22550050attachElements(mrk[veh], veh0, -4, -1objectnosze[veh] = createObject(1997000000setElementCollisionsEnabled(objectnosze[veh], falseattachElements(objectnosze[veh], veh0, -1, -0.5outputChatBox("Dodano nosze do karetki!"plr255255255end 
end 
addCommandHandler("dnosze"dnosze) 

function onMarker(plr) 
if getElementData(plr"player:duty") == "FDSA" then 
outputChatBox("Aby wzi???/schowa? nosze wpisz: /wez-nosze"plr255255255setElementData(plr"able:to:nosze"trueend 
end 
addEventHandler("onMarkerHit"resourceRootonMarker) 

function onMarker2(plrsetElementData(plr"able:to:nosze"falseend 
addEventHandler("onMarkerLeave"resourceRootonMarker2) 

function weznosze(plr) 
if not getElementData(plr"able:to:nosze"then return outputChatBox("Nie jeste? w miejscu przeznaczonym do tego!"plr255255255end 
local xd,yd,zd getElementPosition(plrcols[plr] = createColSphere xdydzdveh getElementsWithinColShape cols[plr], "marker" ) 
for i,v in ipairs(veh) do 
elements getElementAttachedTo end 
destroyElement(cols[plr]) 
if not getElementData(plr"player:nosze") and getElementData(plr"player:duty") == "FDSA" then 
setElementData(plr"player:nosze"truesetElementData(plr"nosze:plr"1outputChatBox("Wzi??e? nosze z karetki."plr255255255outputChatBox("Aby pu?ci?/prowadzi? nosze, wpisz: /pusc-nosze."plr255255255outputChatBox("Aby kogo? po?o?y? na nosze, wpisz: /na-nosze <NICK>."plr255255255outputChatBox("Aby kogo? zdj?? z noszy, wpisz: /z-noszy <NICK>."plr255255255nosze[plr] = createObject(1997000000) 
if getElementData(plr"player:have:nanosze"then 
local elementy getAttachedElements objectnosze[elements] ) 
for i,v in ipairs(elementy) do 
detachElements(v,objectnosze[elements]) 
attachElements(vnosze[plr], 002end 
end 
destroyElement(objectnosze[elements]) 
attachElements(nosze[plr], plr01.5, -1toggleControl(plr"jump"falsetoggleControl(plr"sprint"falsetoggleControl(plr"enter_exit"falsesetElementCollisionsEnabled(nosze[plr], false) 
elseif getElementData(plr"player:nosze") and getElementData(plr"player:duty") == "FDSA" then 
outputChatBox("Schowa?e? nosze do karetki."plr255255255setElementData(plr"player:nosze"falsesetElementData(plr"nosze:plr"0objectnosze[elements] = createObject(1997000000) 
if getElementData(plr"player:have:nanosze"then 
local elementy2 getAttachedElements nosze[plr] ) 
for i,v in ipairs(elementy2) do 
detachElements(vnosze[plr]) 
attachElements(vobjectnosze[elements], 002end 
end 
destroyElement(nosze[plr]) 
attachElements(objectnosze[elements], elements0, -1, -0.5setElementData(plr"player:puscilnosze"falsetoggleControl(plr"jump"truetoggleControl(plr"sprint"truetoggleControl(plr"enter_exit"truesetElementCollisionsEnabled(objectnosze[elements], falseend 
end 
addCommandHandler("wez-nosze"weznosze) 

function znajdzGracza(plrcellocal target nil 
if (tonumber(cel) ~= nilthen 
target Element.getByID("p"..cel) 
else 
for _,thePlayer in ipairs(Element.getAllByType("player")) do 
if string.find(string.gsub(thePlayer.name:lower(),"#%x%x%x%x%x%x"""), cel:lower(), 0truethen 
if target then 
outputChatBox("Znaleziono wi?cej ni? jednego u?ytkownika o podobnym nicku, podaj wi?cej liter."plr255255255) 
return nil 
end 
target thePlayer 
end 
end 
end 
return target 
end 


function puscnosze(plrlocal x2,y2,z2 getElementPosition(nosze[plr]) 
local x,y,getElementPosition(plr) 
if (getDistanceBetweenPoints3D(x,y,z,x2,y2,z2)<1.9then 
if getElementData(plr"player:nosze") and not getElementData(plr"player:puscilnosze"then 
setElementData(plr"player:puscilnosze"trueoutputChatBox("Przesta?e? prowadzi? nosze."plr255255255r,y,getElementRotation(plrdetachElements(nosze[plr], plrsetElementRotation(nosze[plr], r,y,xtoggleControl(plr"jump"truetoggleControl(plr"sprint"truetoggleControl(plr"enter_exit"true) 
elseif getElementData(plr"player:nosze") and getElementData(plr"player:puscilnosze"then 
setElementData(plr"player:puscilnosze"falseoutputChatBox("Ponownie prowadzisz nosze."plr255255255attachElements(nosze[plr], plr01.5, -1toggleControl(plr"jump"falsetoggleControl(plr"sprint"falsetoggleControl(plr"enter_exit"falseend 
end 
end 
addCommandHandler("pusc-nosze"puscnoszeaddCommandHandler("na-nosze", function(plrcmdcel) 
if getElementData(plr"player:duty") == "FDSA" and not getElementData(plr"player:puscilnosze") and getElementData(plr"player:nosze") and getElementData(plr"nosze:plr") == 1 then 
if not cel then 
outputChatBox("Podaj u?ytkownika, kt?rego chcesz po?o?y? na nosze!"plr255255255) 
return 
end 

local target znajdzGracza(plrcel) 
if not target then 
outputChatBox("Taki u?ytkownik nie istnieje!"plr255255255) 
return 
end 

if target == plr then 
outputChatBox("Nie mo?esz po?o?y? siebie na nosze!"plr255255255) 
return 
end 



x,y,getElementPosition(plrcircle createColSphere(x,y,z30players isElementWithinColShape targetcircle ) 
if players and not getElementData(target"plr:onnosze") and not getElementData(plr"player:have:nanosze"then 
setElementData(plr"player:have:nanosze"trueattachElements(targetnosze[plr], 002outputChatBox("Po?o?y?e? na nosze gracza o nicku: #00ff00"..getPlayerName(target), plr255255255trueoutputChatBox("Zosta?e? po?o?ony na nosze, przez gracza o nicku: #00ff00"..getPlayerName(plr), target255255255truesetElementCollisionsEnabled(targetfalsesetPedAnimation target"CRACK""crckidle2", -1truefalse setElementData(target"plr:onnosze"truenow getTickCount() 
if getElementData(target"plr:onnosze"then 
timer[target] = setTimer( function() 
local elemenciki getElementAttachedTo target x5,y5,z5 getElementRotation(elemenciki"ZXY"setElementRotation(targetx5,y5,z5+90end6500end 
destroyElement(circle) 
else 
outputChatBox("Ten gracz jest za daleko od Ciebie, b?d? jest ju? na noszach!"plr255255255destroyElement(circleend 
end 
endaddCommandHandler("z-noszy", function(plrcmdcel) 
if getElementData(plr"player:duty") == "FDSA" and not getElementData(plr"player:puscilnosze") and getElementData(plr"player:nosze") and getElementData(plr"nosze:plr") == 1 then 
if not cel then 
outputChatBox("Podaj u?ytkownika, kt?rego chcesz ?ci?gn?? z noszy!"plr255255255) 
return 
end 

local target znajdzGracza(plrcel) 
if not target then 
outputChatBox("Taki u?ytkownik nie istnieje!"plr255255255) 
return 
end 

if target == plr then 
outputChatBox("Nie mo?esz ?ci?gn?? siebie z noszy!"plr255255255) 
return 
end 



x,y,getElementPosition(plrcircle createColSphere(x,y,z30players isElementWithinColShape targetcircle ) 
if players and getElementData(target"plr:onnosze") and getElementData(plr"player:have:nanosze"then 
setElementData(plr"player:have:nanosze"falseoutputChatBox("?ci?gna?e? z noszy gracza o nicku: #00ff00"..getPlayerName(target), plr255255255trueoutputChatBox("Zosta?e? sci?gniety z noszy, przez gracza o nicku: #00ff00"..getPlayerName(plr), target255255255truedetachElements(targetnosze[plr]) 
setElementData(plr"player:timer"falsesetPedAnimation(targetfalsesetElementCollisionsEnabled(targettruesetElementData(target"plr:onnosze"falsekillTimer(timer[target]) 
destroyElement(circle) 
else 
outputChatBox("Ten gracz jest za daleko od Ciebie, b?d? nie jest na noszach!"plr255255255destroyElement(circleend 
end 
endaddEvent("onPlayerQuit"trueaddEventHandler "onPlayerQuit"getRootElement(), function() 
if timer[sourcethen 
if isElement(timer[source]) then killTimer(timer[source]) end 
end 
end)


Komentarz DsJ3 dodany 2019-02-04, 22:35Następnym razem dodaj załącznik[BBCode] [lua]Kod[./lua] bez kropki
Ostatnio zmieniony przez DsJ3 2019-02-04, 22:35, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-05, 17:50


Gravgor







Wiek: 22
Na forum: 3620 dni
Posty: 380
Nick w MP: 1944

Piwa: 702

Respekt: 57,8

Na pewno gracz nie znajduj? si? w cuboidzie noszy, dlatego nie mo?na go z nich zdj??.
U?yj tej funkcji i sprawd? czy osoba jest w cuboidzie


Więcej informacji znajdziesz w Wikipedii MTA:

SetDevelopmentMode


Podpis
Portfolio marceliborowczak.me
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-05, 17:58


FreshuBiceps







Wiek: 19
Na forum: 3057 dni
Posty: 4
Nick w MP: FreshuY

Piwa: 35

Respekt: 50

"Gravgor" napisał/a:

Na pewno gracz nie znajduj? si? w cuboidzie noszy, dlatego nie mo?na go z nich zdj??.
U?yj tej funkcji i sprawd? czy osoba jest w cuboidzie


Więcej informacji znajdziesz w Wikipedii MTA:

SetDevelopmentMode


tzn? XD bo ja taki w lua pocz?tkuj?cy, m?g?by kto? poprawi? kod? piwko stawiam :P

[ Dodano: 2019-02-05, 18:30 ]
Dobra, dodam jeszcze ?e teraz z koleg? stestowa?em, i mu dzia?aj? normalnie. Moze kwestia rangi administracyjnej? Na pocz?tku testowalem z kolega, ktory ma range "1" i nie dzialaly, lecz z typem rangi "7" u innego typiarza juz tak.

[ Dodano: 2019-02-05, 19:51 ]
Dobra, koniec tematu. Naprawi?em jakos :P

Postaw piwo autorowi tego posta
 

 
Tagi: nosze :: niedzialają.
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » NOSZE - niedzialają. 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