What's new

Creaturescripts Party System

Status
Not open for further replies.

sameyes

Active User
Joined
Apr 3, 2009
Messages
97
Reaction score
4
Wiele os?b szuka kodu na party system. Te? go szuka?em. Po pewnym czasie znalaz?em wi?c chc? wam go udost?pni? + om?wi? co gdzie i jak.

W creaturescripts robimy plik 'party.lua'. Wklejamy do niego.
function onStatsChange(cid, attacker, type, combat, value)
if isPlayer(attacker) == false then
return true
end

if isPlayer(cid) == false then
return true
end

if isInParty(cid) == false then
return true
end

if getPlayerParty(cid) == getPlayerParty(attacker) then
if combat ~= COMBAT_HEALING then
return doPlayerSendCancel(cid, 'You cannot attack teammate.') and false
end
end

return true
end

Nast?pnie w login.lua b?d? onLogin.lua dajemy wpis.
registerCreatureEvent(cid, "Party")

I w pliku creaturecripts.xml dodajemy linijk?.
<event type="statschange" name="Party" event="script" value="party.lua"/>
 

Stasiorex

Advanced User
Joined
Dec 6, 2010
Messages
221
Reaction score
12
Odp: Party System

z tego co wiem (przynajmniej w silnikach kt?re mia?em) ten skrypt jest w wi?kszo?ci (jak nie we wszystkich) silnik?w.

Bless Ya !!!
 

dominikms1

Senior User
Joined
Feb 6, 2010
Messages
696
Reaction score
66
Odp: Party System

Mo?e dopisz co to za system.

S?u?y do protekcji mi?dzy cz?onkami graczy w party.

@up
Nie ma tego ?e wszystkich silnikach.
 

klon52

Advanced User
Joined
May 20, 2008
Messages
495
Reaction score
50
Odp: Party System

Z tego co widz? to on nie b?dzie dzia?a?, gdy? skrypt zadzia?a nast?puj?co: Wyrzuci tobie wiadomo??, ?e nie mo?esz atakowa? swoich, je?eli zaatakuje ci? kto? z twojego party. G??wna funkcja onStatsChange jest z?? funkcja do tego. ;]
 

rigzek

Active User
Joined
Mar 14, 2011
Messages
101
Reaction score
1
Odp: Party System

niedzia?a ! shit po cholere cos takiego wstawiacie ? Stracilem przez ciebie 15 sekund mojego ?ycia nq.
 

klon52

Advanced User
Joined
May 20, 2008
Messages
495
Reaction score
50
Odp: Party System

?apcie skrypt powinien dzia?a? jednak go nie testowa?em:
PHP:
function onAttack(cid, target)
	if isPlayer(target) == false then
		return true
	end

	if isPlayer(cid) == false then
		return true
	end

	if isInParty(cid) == false then
		return true
	end

	if getPlayerParty(cid) == getPlayerParty(target) then
		if combat ~= COMBAT_HEALING then
			doPlayerSendCancel(cid, 'You cannot attack teammate.')
			return false
		end
	end

	return true
end
Reszt? tak jak w pierwszym po?cie.

PS. @rigzek ogarnij sie i nie nabijaj sobie dennych post?w w ka?dym temacie tylko krytykuj?c ludzi bo podejrzewam sam si? nie znasz na lua w og?le, bo tylko spamujesz autor ju? si? dowiedzia?, ?e nie dzia?a bo napisa?o to 2-3 osoby ju? przed tob? ...
 

klon52

Advanced User
Joined
May 20, 2008
Messages
495
Reaction score
50
Odp: Party System

Sorki za od?wie?enie, ale sprawdza? kto? czy dzia?a moja wersja skryptu ? Bo nikt nie skomentowa?.
 

Oskar

Forum friend
Joined
Jan 24, 2009
Messages
2,256
Reaction score
331
Odp: Party System

Przerobiony skrypt z postu numer jeden.
PHP:
function onStatsChange(cid, attacker, type, combat, value)
return (isPlayer(cid) and isPlayer(attacker) and isInParty(cid) and getPlayerParty(cid) == getPlayerParty(attacker) and combat ~= COMBAT_HEALING and false or true)
end

M?j skrypt:
PHP:
function onTarget(cid, target)
return (isPlayer(cid) and isPlayer(target) and isInParty(cid) and getPlayerParty(cid) == getPlayerParty(attacker) and doPlayerSendCancel(cid, 'You cannot attack this player now.') and false or true)
end

function onCombat(cid, target)
return (isPlayer(cid) and isPlayer(target) and isInParty(cid) and getPlayerParty(cid) == getPlayerParty(attacker) and false or true)
end
Dwa wpisy do .xml, jeden na combat, drugi na target. Do login.lua deklaracja obu skrypt?w.

#down
login.lua uzupe?nione? .xml te? poprawnie uzupe?niony?
 
Last edited:

sameyes

Active User
Joined
Apr 3, 2009
Messages
97
Reaction score
4
Odp: Party System

M?j dzia?a w 100 % na tfs 0.3.6pl. Burczyk na pewno robisz co? ?le ;o
 

KrzychuLP

Active User
Joined
Oct 10, 2011
Messages
60
Reaction score
3
Odp: Party System

mi w?a?nie te? nie dzia?a a mam tak?e tfs 0.3.6 pod tibie 8.54 i czy kto? m?g?by poda? jaki? dobry system Party?
 

Idk

Senior User
Joined
Aug 5, 2009
Messages
546
Reaction score
68
Age
29
Odp: Party System

PHP:
function onTarget(cid, target)
return (isPlayer(cid) and isPlayer(target) and isInParty(cid) and getPlayerParty(cid) == getPlayerParty(target) and doPlayerSendCancel(cid, 'You cannot attack this player now.') and false or true)
end

function onCombat(cid, target)
return (isPlayer(cid) and isPlayer(target) and isInParty(cid) and getPlayerParty(cid) == getPlayerParty(target) and false or true)
end

Zamiast 'attacker' zmieni?em na 'target'. Mo?e wam teraz zadzia?a.
 

KrzychuLP

Active User
Joined
Oct 10, 2011
Messages
60
Reaction score
3
Odp: Party System

zaraz przetestuje to co zapoda? @up
 
Last edited:

Paffcio

New User
Joined
Nov 22, 2011
Messages
7
Reaction score
0
Odp: Party System

Takze przetestuje czy dziala na silniku WODBO.
 
Status
Not open for further replies.
Top