What's new

Pewien Skrypt

Status
Not open for further replies.

Dblegend

Active User
Joined
Aug 12, 2008
Messages
133
Reaction score
1
Witam.
Poszukuje skryptu, gdy mamy np. 20 arrow damy na nie use to zabierze nam np. 200 many i te 20 arrow, a da 5 poison arrow.
Za pomoc Reput.
 

Xayan

Senior User
Joined
Jul 4, 2009
Messages
2,608
Reaction score
390
Age
28
Odp: Pewien Skrypt

Nie testowa?em, ale ten skrypt jest tak prosty, ?e na pewno zadzia?a.

local arrows = 20 - ile strza? potrzeba, aby zamieni? je na poison
local mana = 200 - ile many potrzeba
local poisonarrows = 5 - ile dostanie sie poison arrows
local idpoison = 2545 - id poison arrows (je?li masz takie samo, to nie zmieniaj, je?li nie zmie? w skrypcie oraz w actions.xml)

Actions.xml:
Code:
<action itemid="2545" event="script" value="arrowsnapoison.lua"/>

arrowsnapoison.lua:
Code:
function onUse(cid, item, FromPosition, itemEx, toPosition)
	[B]local arrows = 20[/B]
	[B]local mana = 200[/B]
	[B]local posionarrows = 5[/B]
	[B]local idpoison = 2545[/B]
	
	if(getPlayerItemCount(cid, item.itemid) >= arrows) then
		if(getCreatureMana(cid) >= mana) then
			doCreatureAddMana(cid, -mana)
			doPlayerRemoveItem(cid, item.itemid, arrows)
			doPlayerAddItem(cid, idpoison, poisonarrows)
		else
			doPlayerSendTextMessage(cid, 22, "Potrzebujesz "..mana..", aby zamienic strzaly na zatrute strzaly!")
			return true
		end
	else
		doPlayerSendTextMessage(cid, 22, "Potrzebujesz "..arrows.." strzal, aby je zamienic na zatrute strzaly!")
		return true
	end
	return true
end
 
Last edited:

Dblegend

Active User
Joined
Aug 12, 2008
Messages
133
Reaction score
1
Odp: Pewien Skrypt

wywala blad w konsoli ze niemoze zaladowac actions/scrypts, ale niewiem czy to od tego twego skryptu, czy ja cos nagrzebalem pojawia sie napis podczas wczytywania actions
...Permission denied.
Kilka skryptow z actions niedziala wraz z twoim(reszty nie sprawdzalem)
Prosze Help.
 

Kowol

Senior User
Joined
Apr 9, 2008
Messages
1,250
Reaction score
158
Odp: Pewien Skrypt

Zmie? to:
function onUse(cid, item, FromPosition, itemEx, toPosition)
na to:
function onUse(cid, item, frompos, item2, topos)
 

Xayan

Senior User
Joined
Jul 4, 2009
Messages
2,608
Reaction score
390
Age
28
Odp: Pewien Skrypt

W actions.xml zamiast tego, co ci poda?em, wrzu?:
Code:
<action itemid="2545" script="arrowsnapoison.lua" />
 

Dblegend

Active User
Joined
Aug 12, 2008
Messages
133
Reaction score
1
Odp: Pewien Skrypt

wywala silnik ze funkca "getCreatureMana" niedziala
 

Xayan

Senior User
Joined
Jul 4, 2009
Messages
2,608
Reaction score
390
Age
28
Odp: Pewien Skrypt

No to u?yj tego skryptu:

Code:
function onUse(cid, item, frompos, item2, topos) 
	local arrows = 20
	local mana = 200
	local posionarrows = 5
	local idpoison = 2545
	if(getPlayerItemCount(cid, item.itemid) >= arrows) then
		if(getPlayerMana(cid) >= mana) then
			doPlayerAddMana(cid, -mana)
			doPlayerRemoveItem(cid, item.itemid, arrows)
			doPlayerAddItem(cid, idpoison, poisonarrows)
		else
			doPlayerSendTextMessage(cid, 22, "Potrzebujesz "..mana..", aby zamienic strzaly na zatrute strzaly!")
			return true
		end
	else
		doPlayerSendTextMessage(cid, 22, "Potrzebujesz "..arrows.." strzal, aby je zamienic na zatrute strzaly!")
		return true
	end
	return true
end
 

Dblegend

Active User
Joined
Aug 12, 2008
Messages
133
Reaction score
1
Odp: Pewien Skrypt

jest jeszcze 1 blad, jak niemam poison arrow w bp to mi nie dodaje tych 5, wogle mi nie dodaje, a arrows snikaja , ale jak mam 1 to wtedy jak dam use mam 6.
 
Last edited:
Status
Not open for further replies.
Top