What's new
  • logo_cipsoft
    Latest servers:
    New servers will open on: 19th Feb 2025:
    Noctalia (Open PvP) Ignitera (Open PvP) us_logo Xybra (Open PvP)

Actions Arena Player vs Monster

Status
Not open for further replies.

Matt

Banned
Joined
May 9, 2013
Messages
595
Reaction score
45
Witajcie.

Z nud?w postanowi?em poprawi? i udost?pni? Wam kod areny gracza vs potwora.
Oto nasz skrypt, kt?ry musimy doda?.


Do data/actions/scripts dodaj arenalever:
PHP:
function onUse(cid, item, frompos, item2, topos)

	if item.uid == 7001 and item.itemid == 1945 then
		player1pos = {x=356, y=775, z=9, stackpos=253}
		player1 = getThingfromPos(player1pos)

		player2pos = {x=367, y=775, z=9, stackpos=253}
		player2 = getThingfromPos(player2pos)

		if player1.itemid > 0 and player2.itemid > 0 then
			arenalevel = 1
			player1level = getPlayerLevel(player1.uid)
			player2level = getPlayerLevel(player2.uid)

			if player1level >= arenalevel then
				for arenax = 358,366 do
					for arenay = 773,778 do
						arenapos = {x=arenax, y=arenay, z=9, stackpos=253}
						arenapvm = getPVMfromPos(arenapos)
						
						if arenapvm == 0 then
						else
							doPlayerSendCancel(cid,"Poczekaj chwilke ktos wlasnie rozgrywa pojedynek.")
					return 1
						end
					end
				end

				nplayer1pos = {x=350, y=760, z=11}
				nrat2pos = {x=350, y=761, z=11}

				for arenax2 = 347,353 do
					for arenay2 = 756,764 do
						arenapos2 = {x=arenax2, y=arenay2, z=11, stackpos=253}
						kickMonsters(arenapos2)
					end
				end
				

				nplayer1pos = {x=358, y=775, z=9}
				nplayer2pos = {x=365, y=775, z=9}

				doSendMagicEffect(player1pos,2)
				doSendMagicEffect(player2pos,2)

				doTeleportThing(player1.uid,nplayer1pos)
				doTeleportThing(player2.uid,nplayer2pos)

				doSendMagicEffect(nplayer1pos,10)
				doSendMagicEffect(nplayer2pos,10)

				doPlayerSendTextMessage(player1.uid,18,"Walka!")
				doPlayerSendTextMessage(player2.uid,18,"Walka!")

			else
				doPlayerSendCancel(cid,"You must have minimum level 25.")

			end
		else
			doPlayerSendCancel(cid,"Potrzebujesz drugiej osoby do pojedynku.")
		end
	else
		return 0
   	end

	return 1
end

Nast?pnie tworzymy nowy folder arena i zamieszczamy w nim plik a1:
PHP:
-- do pvp arena lever

function onUse(cid, item, frompos, item2, topos)
	nmonsterpos = {x=349, y=761, z=11} -- gdzie ma sie tworzyc potwor
	nplayerpos = {x=350, y=760, z=11} -- gdzie ma tp gracza

    if getPlayerStorageValue(cid,5080) ~= 2 then
	if item.uid == 20801 and item.itemid == 1945 then
		doSummonCreature("orshabaal",nmonsterpos)
	  if getPlayerStorageValue(cid,5080) == 1 then
		setPlayerStorageValue(cid,5080,2)
		end
	  if getPlayerStorageValue(cid,5080) == 0 then
		setPlayerStorageValue(cid,5080,1)
		end

		doTeleportThing(cid, nplayerpos)
   	end
       doSendMagicEffect(nplayerpos,2)
       doTeleportThing(player,nplayerpos)
			else
				doPlayerSendTextMessage(cid,18,"Nie mozesz walczyc z wieksza iloscia potworow na raz!")			

   end

	return 1
end

Potem otwieramy actions.xml i wklejamy te 2 linijki:
PHP:
<action uniqueid="20508" script="arenalever.lua" />
<action uniqueid="20801" script="arena/a1.lua" />


Jed?my dalej.
Tworzymy w actions nowy folder o nazwie room i tworzymy plik wejscie.lua:
PHP:
function onUse(cid, item, frompos, item2, topos)

	if item.uid == 20000 and item.itemid == 1945 then

		player1pos = {x=394, y=761, z=11, stackpos=253} -- gdzie stoi gracz przed wejsciem na arene
		player1 = getThingfromPos(player1pos)

		gdzie = {x=398, y=760, z=11} -- gdzie teleportuje gracza
		if isPremium(player1.uid) ~= 0 then
		
		else
		doPlayerSendTextMessage(player1.uid,22,"Aby tutaj expic, potrzebujesz Premium Account!")
		doTeleportThing(player1.uid, gdzie)
		return 1
		end
		
		if player1.itemid == 0 then


				for arenax = 384,390 do
					for arenay = 756,766 do
						arenapos = {x=arenax, y=arenay, z=11, stackpos=253}
						arenapvm = getPVMfromPos2(arenapos)
						
						
						if arenapvm == 0 then	
						else
							doPlayerSendTextMessage(cid, 18, "Musisz poczekac "..arenapvm.." sekund.")
		
							return 1
						end
					end
				end
	
			doPlayerSendTextMessage(cid,18,"Stan jak czlowiek!")
			return 1
			
		else

			
			arenalevel = 1
			player1level = getPlayerLevel(player1.uid)

			gdzie = {x=398, y=760, z=11} -- gdzie teleportuje gracza
			

				for arenax = 384,390 do
					for arenay = 756,766 do
						arenapos = {x=arenax, y=arenay, z=11, stackpos=253}
						arenapvm = getPVMfromPos2(arenapos)
						
						
						if arenapvm == 0 then	
						else
							doPlayerSendTextMessage(cid, 18, "Musisz poczekac "..arenapvm.." sekund.")
		
							return 1
						end
					end
				end
				
				nplayer1pos = {x=387, y=761, z=11} -- gdzie teleportuje gracza

				nrat2pos = {x=388, y=761, z=11} -- gdzie tworzy rata

				for arenax2 = 384,390 do
					for arenay2 = 756,766 do
						arenapos2 = {x=arenax2, y=arenay2, z=11, stackpos=253}
						kickMonsters(arenapos2)
						c = getThingfromPos(arenapos2)
						if c.itemid > 0 then
						doTeleportThing(c.uid, gdzie)
						else
						end
					end
				end
				
				doSummonCreature("rat",nrat2pos)

				doSendMagicEffect(player1pos,2)
				doTeleportThing(player1.uid,nplayer1pos)

				doSendMagicEffect(nplayer1pos,10)
				doSendMagicEffect(nrat2pos,10)
				dajczas(player1.uid,10*60)
		
			
		end
	else
		return 0
   	end

	return 1
end

dalej w tym samym folderze tworzymy nowy plik o nazwie tp i wklejamy:
PHP:
-- do pvp arena lever

function onUse(cid, item, frompos, item2, topos)

	nplayerpos = {x=757, y=259, z=15}



	if item.uid == 20186 and item.itemid == 1945 then
		
if (getPlayerVocation(cid) then
		doPlayerSendTextMessage(cid,22,"Wyspa przeznaczona jest dla Knight oraz Paladyn.")
		else 

		if getPlayerLevel(cid) < 80000 then
		doPlayerSendTextMessage(cid,22,"Musisz posiadac 80000 poziom, aby dac tam teleport.")
		else 
	
	
doTeleportThing(cid, nplayerpos)
end
end

   end

	return 1
end

i ostatnia rzecz zn?w w tym folderze, plik tworzymy o nazwie 1 i wklejamy:
PHP:
-- do pvp arena lever

function onUse(cid, item, frompos, item2, topos)
	nmonsterpos = {x=388, y=761, z=11} -- gdzie ma sie tworzyc potwor
	nplayerpos = {x=387, y=761, z=11} -- gdzie ma tp gracza

 
	if item.uid == 20001 and item.itemid == 1945 then
		


		
		doSummonCreature("Barbiana Shotorka",nmonsterpos)
doTeleportThing(cid, nplayerpos)


   end

	return 1
end

i na koniec do actions.xml dodajemy jeszcze takie linijki:
PHP:
<action uniqueid="20000" script="room/wejscie.lua" />
<action uniqueid="20186" script="room/tp.lua" />
<action uniqueid="20001" script="room/1.lua" />


To chyba tyle.
 
Status
Not open for further replies.
Top