wicher4900
Były Programista
Wiek: 25 Na forum: 3610 dni Posty: 21
Nick w MP: Naveex
Piwa : 1732
Witam, prosz? podpi?cie tego skryptu pod baz? danych
Kod:
typy={
[837]=-.5,
[835]=1,
[847]=1,
[684]=-.6,
}
typy2={837,835,847,684}
function zniszczDrzewo(drzewo)
if isElement(drzewo) then
destroyElement(drzewo)
givePlayerMoney(client,500)
outputChatBox("Drzewo ?ci?te! Otrzymujesz 500PLN",client,0,255,0)
end
end
addEvent("PSP:Zniszczdrzewo",true)
addEventHandler("PSP:Zniszczdrzewo",resourceRoot,zniszczDrzewo)
function dodajNoweMiejsce(plr,cmd,ilosc)
local accName=getAccountName(getPlayerAccount(plr))
if isObjectInACLGroup("user."..accName,aclGetGroup("Admin")) then
if ilosc then
ilosc=tonumber(ilosc)
if ilosc then
if math.floor(ilosc)==ilosc then
if ilosc>0 then
if ilosc<=100 then
x,y,z=getElementPosition(plr)
exports["ogrpg-db"]:dbSet("insert into PSP_drzewa values(null,?,?,?,?)",x,y,z,ilosc)
outputChatBox("Nowe miejsce na drzewo dla PSP dodano pomy?lnie!",plr,0,255,0)
else
outputChatBox("Limit drzewa to 100!",plr,255,0,0)
end
else
outputChatBox("Ilo?? drzewa wi?ksza od zera!",plr,255,0,0)
end
else
outputChatBox("Ilo?? drzewa musi by? liczb? ca?kowit?!",plr,255,0,0)
end
else
outputChatBox("B??d, popraw na: /"..cmd.." [ilo?? drzewa]",plr,255,0,0)
end
else
outputChatBox("B??d, popraw na: /"..cmd.." [ilo?? drzewa]",plr,255,0,0)
end
end
end
addCommandHandler("pspdodajdrzewa",dodajNoweMiejsce)
function stworzDrzewo(id,x,y,z,rx,ry,rz)
obj=createObject(id,x,y,z,rx,ry,rz)
setElementData(resourceRoot,"objj",obj)
setElementData(obj,"health",math.random(30000,40000))
return obj
end
function spawnDrzewo(x,y,z,ilosc)
if ilosc>20 then
odl=ilosc/4
else
odl=ilosc/2
end
for i=1,ilosc do
plusx,plusy=math.random(-odl,odl),math.random(-odl,odl)
drzewotyp=typy2[math.random(#typy2)]
drzewoupdown=typy[drzewotyp]
stworzDrzewo(drzewotyp,x+plusx,y+plusy,z+drzewoupdown,0,0,math.random(1,360))
end
end
--spawnDrzewo(0,0,5,8)
function autospawn()
dane=exports["ogrpg-db"]:dbGet("SELECT * FROM `PSP_drzewa` WHERE 1 order by rand() limit 1")
dane=dane[1]
spawnDrzewo(dane.x,dane.y,dane.z,dane.wielkosc)
if getPlayerCount()>50 then
setTimer(autospawn,1000*60*10,1)
else
setTimer(autospawn,1000*60*30,1)
end
end
autospawn()
function manualSpawn(plr)
local accName=getAccountName(getPlayerAccount(plr))
if isObjectInACLGroup("user."..accName,aclGetGroup("Admin")) then
outputChatBox("*Zrespiono nowe drzewo!",plr,0,255,0)
end
end
addCommandHandler("pspdrzewaspawn",manualSpawn)
Za pomoc