Siema, potrzebuje pomocy. mam tutaj kod na wyci?ganie torby R1 ale chce te? aby osoby ze grupy ACL "SAMD" mogli k?a?? torb? na ziemi. Tak wiem jest funkcja DestroyElement oraz createObject lecz nie ogarniam tego.
prosi?bym o gotowy kodzik
KOD:
[code]
function weztorba (plr)
local login = getAccountName(getPlayerAccount(plr))
if isObjectInACLGroup("user."..login,aclGetGroup("SAMD", plr)) then
local auto = getPedOccupiedVehicle(plr)
if isPedInVehicle(plr) then
if (getElementModel(auto) == 489) or (getElementModel(auto) == 407) or (getElementModel(auto) == 416) then
local torba = createObject(1248, 0, 0, 0, 0, 0, 0)
Witam mam skrypt na torbe r1 lecz nwm jak zrobic by jak wyciagnol ktos torbe z schowka to mogl takze uzywac tych komend w sensie /postawr1 itp
[lua]
local torby = {}
addCommandHandler("torbar1",function(plr,cmd)
if torby[plr] then return end
if not getElementData(plr,"player:faction") then outputChatBox("Aby u?y? tej torby musisz by? aktywny w jakiejkolwiek frakcji",plr,255,0,0) return end
local x,y,z = getElementPosition(plr)
local torba = createObject(1550,x,y,z)
torby[plr] = torba
outputChatBox("**Wyci?gn??e? torb?r1 z karetki!",plr,255,0,0)
setElementCollisionsEnabled (torba, false)
exports["bone_attach"]:attachElementToBone(torba,plr,12,-0.05,0.1,0.28,0,170,0)
end)
function stworztorbe(plr)
if not plr then return end
local x,y,z = getElementPosition(plr)
local torba = createObject(1550,x,y,z)
torby[plr] = torba
setElementCollisionsEnabled (torba, false)
exports["bone_attach"]:attachElementToBone(torba,plr,12,0,-0.09,0.3,0,180,0)
setObjectScale(torba,5)
end
function usuntorbe(plr)
if not plr then return end
local torba = torby[plr]
if torba then
if isElement(torba) then
if exports["bone_attach"]:isElementAttachedToBone(torba) then exports["bone_attach"]:detachElementFromBone(torba) end
destroyElement(torba)
end
torby[plr] = nil
end
end
addEventHandler ( "onPlayerQuit", root, function()
local torba = torby[source]
if torba then
if i...
Gdy wyci?gam torbe R1 z karetki to bierze mi j? i odrazu chowa pom?g? by mi kto? z tym z g?ry dzi?kuje. Za pomoc stawiam zimne piwko
Tutaj daje kod:
[code]local torbysamc = {}
addEvent("onTryTakeSAMCItem1",true)
addEventHandler("onTryTakeSAMCItem1",root,function ()
if not getElementData(client,"SAMC:item:r1") then
stworztorbe(client)
setElementData(client,"SAMC:item:r1",true)
toggleControl(client,"sprint", false )
else
usuntorbe(client)
setElementData(client,"SAMC:item:r1",nil)
toggleControl(client,"sprint", true )
end
end)
function stworztorbe(plr)
if not plr then return end
local x,y,z = getElementPosition(plr)
local torba = createObject(323,x,y,z)
torbysamc[plr] = torba
setElementCollisionsEnabled (torba, false)
exports["bone_attach"]:attachElementToBone(torba,plr,12,0.02,0.1,0.3,0,180,0)
setObjectScale(torba,1.0)
end
function usuntorbe(plr)
if not plr then return end
local torba = torbysamc[plr]
if torba then
if isElement(torba) then
if exports["bone_attach"]:isElementAttachedToBone(torba) then exports["bone_attach"]:detachElementFromBone(torba) end
destroyElement(torba)
end
torbysamc[plr] = nil
end
end
addEventHandler ( "onPlayerQuit", root, function()
local torba = torbysamc[source]
if torba then
if isElement(torba) then
if exports["bone_attach"]:isElementAttachedToBone(torba) then export...
Witam chcia? bym przerobi? torbe r1 u psp . Wyglada? to ma tak ze mo?na wyci?gna? torbe przez schowek i mozna polo?y? j? na ziemi skrypt na wyci?ganie mam lecz nie potrafie doda? funkcji k?adzenia i podnoszenia
Witam jak naprawi? takie co? ?e mam schowek pr jest to paczka new worda i gdy wyci?gam torb? to ona nie bierze si? do renki tylko zostaje i lata w miejscu
Witam chcia?bym si? spyta? jak zrobi? skrypt na k?adzenie torby r1 na ziemi
mam skrypt na schowek gdzie wyci?gam torbe r1 lecz nie ma tam k?adzenia :?
oto kod na schowek :
frakcja-samd >> s_schowek
[lua]function findPlayer(plr,cel)
local target=nil
if (tonumber(cel) ~= nil) then
target=getElementByID("p"..cel)
else -- podano fragment nicku
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
addEvent("PRszyny",true)
addEventHandler("PRszyny",root,function(el)
if not getElementData(el,"prm:item:szyny") then
local x,y,z = getElementPosition( el )
local object = createObject(3911,x,y,z)
exports.bone_attach:attachElementToBone(object,el,12,0,0,0.22,180,0)
setElementData(el,"prm:item:szyny",object)
exports["noti2"]:noti("Wyci?gasz szyny kramera z ambulansu.", el)
else
destroyElement(getElementData(el,"prm:item:szyny"))
exports["noti2"]:noti("Chowasz ...
Witam posiadam kod na R1 a wi?c problem polega na tym ze jak podejde do karetki i wpisze /torba to nie dzia?a.... mam bone_attach aha i jak ma ktos textury to prosze o podes?anie
Kod:[lua]
function weztorba (plr)
local login = getAccountName(getPlayerAccount(plr))
if isObjectInACLGroup("user."..login,aclGetGroup("Pogotowie", plr)) then
local auto = getPedOccupiedVehicle(plr)
if isPedInVehicle(plr) then
if (getElementModel(auto) == 489) or (getElementModel(auto) == 407) or (getElementModel(auto) == 416) then
local torba = createObject(1210, 0, 0, 0, 0, 0, 0)
setElementData ( plr, "torba", torba)
exports.bone_attach:attachElementToBone(torba,plr,12,0,0.1,0.3,0,180,0)
outputChatBox("** Bierzesz torb? medyczn?", plr)
outputChatBox("** "..login.." wyci?ga torb? medyczn? z pojazdu", root)
end
end
end
end
addCommandHandler("torba", weztorba)
-------------------------------------------------
function odloztorbe(plr)
local login = getAccountName(getPlayerAccount(plr))
if isObiectInACLGroup("user."..login,aclGetGroup("grupa_acl", plr)) then
local auto = getPedOccupiedVehicle(plr)
if isPedInVehicle(plr) then
if (getElementModel(auto) == 407) or (getElementModel(auto) == 489) or (getElementModel(auto) == 416) then
local torba = getElementData ( plr, "torba")
destroyElement(torba)
outputChatBox("** Chowasz torb? medyczn?", plr)
outputChatBox("**...