function weznosze(plr)
if not getElementData(plr, "able:to:nosze") then return outputChatBox("Nie jeste? w miejscu przeznaczonym do tego!", plr, 255, 255, 255) end
local xd,yd,zd = getElementPosition(plr)
cols[plr] = createColSphere ( xd, yd, zd, 2 )
veh = getElementsWithinColShape ( cols[plr], "marker" )
for i,v in ipairs(veh) do
elements = getElementAttachedTo ( v )
end
if cols[plr] and isElement(cols[plr]) then destroyElement(cols[plr]) end
if not getElementData(plr, "player:nosze") and isObjectInACLGroup ("user."..getPlayerAccount(plr), aclGetGroup ( "PR" ) ) then
setElementData(plr, "player:nosze", true)
setElementData(plr, "nosze:plr", 1)
outputChatBox("Wzi??e? nosze z karetki.", plr, 255, 255, 255)
outputChatBox("Aby pu?ci?/prowadzi? nosze, wpisz: /pusc-nosze.", plr, 255, 255, 255)
outputChatBox("Aby kogo? po?o?y? na nosze, wpisz: /na-nosze <NICK>.", plr, 255, 255, 255)
outputChatBox("Aby kogo? zdj?? z noszy, wpisz: /z-noszy <NICK>.", plr, 255, 255, 255)
nosze[plr] = createObject(1997, 0, 0, 0, 0, 0, 0)
if getElementData(plr, "player:have:nanosze") then
local elementy = getAttachedElements ( objectnosze[elements] )
for i,v in ipairs(elementy) do
detachElements(v,objectnosze[elements])
attachElements(v, nosze[plr], 0, 0, 2)
end
end
--[[
Autor: IgorPL222
Nie zezwalam na usuwanie tej notatki :)
--]]
local objectnosze = {}
local nosze = {}
local mrk = {}
local cols = {}
local timer = {}
resourceRoot = getResourceRootElement(getThisResource())
function dnosze(plr)
local accName = getAccountName ( getPlayerAccount ( plr ) )
if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then
x,y,z = getElementPosition(plr)
x2,y2,z2 = getElementRotation(plr)
local veh = getPedOccupiedVehicle(plr)
if not veh then return end
mrk[veh] = createMarker(0, 0, 0, "cylinder", 2, 255, 0, 0, 50)
attachElements(mrk[veh], veh, 0, -4, -1)
objectnosze[veh] = createObject(1997, 0, 0, 0, 0, 0, 0)
setElementCollisionsEnabled(objectnosze[veh], false)
attachElements(objectnosze[veh], veh, 0, -1, -0.5)
outputChatBox("Dodano nosze do karetki!", plr, 255, 255, 255)
end
end
addCommandHandler("dnosze", dnosze)
function onMarker(plr)
local accName = getAccountName ( getPlayerAccount ( plr ) )
if isObjectInACLGroup ("user."..accName, aclGetGroup ( "PR" ) ) then
outputChatBox("Aby wzi???/schowa? nosze wpisz: /wez-nosze", plr, 255, 255, 255)
setElementData(plr, "able:to:nosze", true)
end
end
addEventHandler("onMarkerHit", resourceRoot, onMarker)
function onMarker2(plr)
setElementData(plr, "able:to:nosze", false)
end
addEventHandler("onMarkerLeave", resourceRoot, onMarker2)
function weznosze(plr)
if not getElementData(plr, "able:to:nosze") then return outputChatBox("Nie jeste? w miejscu przeznaczonym do tego!", plr, 255, 255, 255) end
local xd,yd,zd = getElementPosition(plr)
cols[plr] = createColSphere ( xd, yd, zd, 2 )
veh = getElementsWithinColShape ( cols[plr], "marker" )
for i,v in ipairs(veh) do
elements = getElementAttachedTo ( v )
end
if cols[plr] and isElement(cols[plr]) then destroyElement(cols[plr]) end
if not getElementData(plr, "player:nosze") and isObjectInACLGroup ("user."..getPlayerAccount(plr), aclGetGroup ( "PR" ) ) then
setElementData(plr, "player:nosze", true)
setElementData(plr, "nosze:plr", 1)
outputChatBox("Wzi??e? nosze z karetki.", plr, 255, 255, 255)
outputChatBox("Aby pu?ci?/prowadzi? nosze, wpisz: /pusc-nosze.", plr, 255, 255, 255)
outputChatBox("Aby kogo? po?o?y? na nosze, wpisz: /na-nosze <NICK>.", plr, 255, 255, 255)
outputChatBox("Aby kogo? zdj?? z noszy, wpisz: /z-noszy <NICK>.", plr, 255, 255, 255)
nosze[plr] = createObject(1997, 0, 0, 0, 0, 0, 0)
if getElementData(plr, "player:have:nanosze") then
local elementy = getAttachedElements ( objectnosze[elements] )
for i,v in ipairs(elementy) do
detachElements(v,objectnosze[elements])
attachElements(v, nosze[plr], 0, 0, 2)
end
end
destroyElement(objectnosze[elements])
attachElements(nosze[plr], plr, 0, 1.5, -1)
toggleControl(plr, "jump", false)
toggleControl(plr, "sprint", false)
toggleControl(plr, "enter_exit", false)
setElementCollisionsEnabled(nosze[plr], false)
elseif getElementData(plr, "player:nosze") and isObjectInACLGroup ("user."..getPlayerAccount(plr), aclGetGroup ( "PR" ) ) then
outputChatBox("Schowa?e? nosze do karetki.", plr, 255, 255, 255)
setElementData(plr, "player:nosze", false)
setElementData(plr, "nosze:plr", 0)
objectnosze[elements] = createObject(1997, 0, 0, 0, 0, 0, 0)
if getElementData(plr, "player:have:nanosze") then
local elementy2 = getAttachedElements ( nosze[plr] )
for i,v in ipairs(elementy2) do
detachElements(v, nosze[plr])
attachElements(v, objectnosze[elements], 0, 0, 2)
end
end
destroyElement(nosze[plr])
attachElements(objectnosze[elements], elements, 0, -1, -0.5)
setElementData(plr, "player:puscilnosze", false)
toggleControl(plr, "jump", true)
toggleControl(plr, "sprint", true)
toggleControl(plr, "enter_exit", true)
setElementCollisionsEnabled(objectnosze[elements], false)
end
end
addCommandHandler("wez-nosze", weznosze)
function znajdzGracza(plr, cel)
local target = nil
if (tonumber(cel) ~= nil) then
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(), 0, true) then
if target then
outputChatBox("Znaleziono wi?cej ni? jednego u?ytkownika o podobnym nicku, podaj wi?cej liter.", plr, 255, 255, 255)
return nil
end
target = thePlayer
end
end
end
return target
end
function puscnosze(plr)
local x2,y2,z2 = getElementPosition(nosze[plr])
local x,y,z = getElementPosition(plr)
if (getDistanceBetweenPoints3D(x,y,z,x2,y2,z2)<1.9) then
if getElementData(plr, "player:nosze") and not getElementData(plr, "player:puscilnosze") then
setElementData(plr, "player:puscilnosze", true)
outputChatBox("Przesta?e? prowadzi? nosze.", plr, 255, 255, 255)
r,y,x = getElementRotation(plr)
detachElements(nosze[plr], plr)
setElementRotation(nosze[plr], r,y,x)
toggleControl(plr, "jump", true)
toggleControl(plr, "sprint", true)
toggleControl(plr, "enter_exit", true)
elseif getElementData(plr, "player:nosze") and getElementData(plr, "player:puscilnosze") then
setElementData(plr, "player:puscilnosze", false)
outputChatBox("Ponownie prowadzisz nosze.", plr, 255, 255, 255)
attachElements(nosze[plr], plr, 0, 1.5, -1)
toggleControl(plr, "jump", false)
toggleControl(plr, "sprint", false)
toggleControl(plr, "enter_exit", false)
end
end
end
addCommandHandler("pusc-nosze", puscnosze)
addCommandHandler("na-nosze", function(plr, cmd, cel)
local accName = getAccountName ( getPlayerAccount ( plr ) )
if isObjectInACLGroup ("user."..accName, aclGetGroup ( "PR" ) ) 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!", plr, 255, 255, 255)
return
end
local target = znajdzGracza(plr, cel)
if not target then
outputChatBox("Taki u?ytkownik nie istnieje!", plr, 255, 255, 255)
return
end
if target == plr then
outputChatBox("Nie mo?esz po?o?y? siebie na nosze!", plr, 255, 255, 255)
return
end
x,y,z = getElementPosition(plr)
circle = createColSphere(x,y,z, 30)
players = isElementWithinColShape ( target, circle )
if players and not getElementData(target, "plr:onnosze") and not getElementData(plr, "player:have:nanosze") then
setElementData(plr, "player:have:nanosze", true)
attachElements(target, nosze[plr], 0, 0, 2)
outputChatBox("Po?o?y?e? na nosze gracza o nicku: #00ff00"..getPlayerName(target), plr, 255, 255, 255, true)
outputChatBox("Zosta?e? po?o?ony na nosze, przez gracza o nicku: #00ff00"..getPlayerName(plr), target, 255, 255, 255, true)
setElementCollisionsEnabled(target, false)
setPedAnimation ( target, "CRACK", "crckidle2", -1, true, false )
setElementData(target, "plr:onnosze", true)
now = getTickCount()
if getElementData(target, "plr:onnosze") then
timer[target] = setTimer( function()
local elemenciki = getElementAttachedTo ( target )
x5,y5,z5 = getElementRotation(elemenciki, "ZXY")
setElementRotation(target, x5,y5,z5+90)
end, 650, 0)
end
destroyElement(circle)
else
outputChatBox("Ten gracz jest za daleko od Ciebie, b?d? jest ju? na noszach!", plr, 255, 255, 255)
destroyElement(circle)
end
end
end)
addCommandHandler("z-noszy", function(plr, cmd, cel)
local accName = getAccountName ( getPlayerAccount ( plr ) )
if isObjectInACLGroup ("user."..accName, aclGetGroup ( "PR" ) ) 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!", plr, 255, 255, 255)
return
end
local target = znajdzGracza(plr, cel)
if not target then
outputChatBox("Taki u?ytkownik nie istnieje!", plr, 255, 255, 255)
return
end
if target == plr then
outputChatBox("Nie mo?esz ?ci?gn?? siebie z noszy!", plr, 255, 255, 255)
return
end
x,y,z = getElementPosition(plr)
circle = createColSphere(x,y,z, 30)
players = isElementWithinColShape ( target, circle )
if players and getElementData(target, "plr:onnosze") and getElementData(plr, "player:have:nanosze") then
setElementData(plr, "player:have:nanosze", false)
outputChatBox("?ci?gna?e? z noszy gracza o nicku: #00ff00"..getPlayerName(target), plr, 255, 255, 255, true)
outputChatBox("Zosta?e? sci?gniety z noszy, przez gracza o nicku: #00ff00"..getPlayerName(plr), target, 255, 255, 255, true)
detachElements(target, nosze[plr])
setElementData(plr, "player:timer", false)
setPedAnimation(target, false)
setElementCollisionsEnabled(target, true)
setElementData(target, "plr:onnosze", false)
killTimer(timer[target])
destroyElement(circle)
else
outputChatBox("Ten gracz jest za daleko od Ciebie, b?d? nie jest na noszach!", plr, 255, 255, 255)
destroyElement(circle)
end
end
end)
addEvent("onPlayerQuit", true)
addEventHandler ( "onPlayerQuit", getRootElement(), function()
if timer[source] then
if isElement(timer[source]) then killTimer(timer[source]) end
end
end)
53 LINIJKA
if cols[plr] and isElement(cols[plr]) then destroyElement(cols[plr]) end
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