ID:2193419
 
Code:
proc/startexamfight()
for(var/mob/M in world)
if(M.login)
if(M.atwr==1)
M<<"Wait your turn, soon you can show what are you capable of!"
spawn(15)
M<<"1 minute to start!"
spawn(600)
this
if(!anyfighting)
if(listexam.len>2)
var/mob/A=pick(listexam)
var/mob/B=pick(listexam)
if(A.recentfighter||B.recentfighter)
goto this
M<<"Let's start..."
spawn(20)
M<<"Next fighters will be..."
spawn(30)
M<<"[A] from [A.village] VS [B] from [B.village]!"
spawn(20)
A.loc = locate(/turf/Aposition)
B.loc = locate(/turf/Bposition)
A.dead=0
B.dead=0
M<<"Wait for order to fight!"
spawn(100)
M<<"3"
spawn(10)
M<<"2"
spawn(10)
M<<"1"
spawn(10)
M<<"Fight"
anyfighting=1
if(listexam.len==2)
var/mob/A=pick(listexam)
var/mob/B=pick(listexam)
M<<"Congratulations guys!"
spawn(20)
M<<"You are the finalists..."
spawn(30)
M<<"Both of you now, are the most new Chuunin!"
spawn(20)
A.loc = locate(/turf/Aposition)
B.loc = locate(/turf/Bposition)
A.dead=0
B.dead=0
A.finalist=1
B.finalist=1
bechuunin()
M<<"Who win this fight will get a Second Element, good luck!"
spawn(10)
M<<"Wait for order to fight!"
spawn(100)
M<<"3"
spawn(10)
M<<"2"
spawn(10)
M<<"1"
spawn(10)
M<<"Fight"
anyfighting=1
if(listexam.len==1)
var/mob/A=pick(listexam)
A<<"Congratulations you winned the Exam Chuunin!"
world<<"<b><font size =1><u><font color = red>World News:</u> [A] from [A.village] winned the Exam Chuunin!</font>"
listexam.Remove(A)
A.INEXAM=0
A.finishsecond=0
anyfighting=0
A.Give2ndEle()
while(-1) A.SpawnV()
if(A.rank=="Genin")
bechuunin()
if(A.finalist)
A.finalist=0
A.atwr=0
world << "<b><font size =1><font color = silver>The Chuunin Exam has ended, the next one will be in One Hour!"
spawn() Chuunin()
else
goto this


Problem description: After "spawn(600) this" the game crash, i think that probly is a infinity loop, is really? how i fix?

This is a poor example of a loop. Try to avoid goto, it's easy to let things get away from you. If anyfighting is false, it continues using goto this, and repeats itself as fast as it can.

A quick fix is..

else
sleep(1 * world.fps)
goto this


A long term fix is learning loops properly and setting up something that isn't so prone to confusing you.
i tried to fix as you said and crashed again bro =(
Try adding the sleep right under

if(A.recentfighter||B.recentfighter)

As well, right above the goto
proc
Fight(mob/A,mob/B)
begin
if(A.health <= 0) /// YOU MIGHT HAVE TO CHANGE THIS INCASE YOUR HP VAR IS DIFF, see: your death proc for more info
world<<"[B] has won against [A]!"
Entries.Remove(A)
A.loc=locate(50,1,2) /// relocate the loser.
B.loc=locate(1,1,1)
Tournament_AI()
return // stop runtime errors
if(B.health <= 0) /// YOU MIGHT HAVE TO CHANGE THIS INCASE YOUR HP VAR IS DIFF, SEE: your death proc for more info
world<<"[A] has won against [B]!"
Entries.Remove(B)
A.loc=locate(1,1,1) /// relocate the loser.
B.loc=locate(50,1,2)
Tournament_AI()
return // stop runtime errors
else
spawn(200)
goto begin

proc
Tournament_AI()
if(Entries.len==1)
world<<"Tournament over, winner is:"
for(var/mob/K in Entries)
world<<K
Entries.Remove(K)
for(var/mob/M in world)
if(M.client)
M.verbs-=typesof(/mob/tournyverb/verb)
M.tourny=0
Tournament=0
return
doit
for(var/mob/M in world)
if(M.tourny)
var/A=pick(Entries)
var/B=pick(Entries)
if(A==B)
goto doit
sleep(10)
M<<"Tournament Announcer: Okay lets start this match!"
sleep(20)
M<<"Tournament Announcer: This match will be..."
sleep(30)
M<<"Tournament Announcer: [A] .VS. [B]!"
B:loc=locate(3,8,2) /// locate them to a specific place.
A:loc=locate(11,7,2) /// locate them to a specific place.
sleep(50)
M<<"Fight!"
Fight(A,B)


Try something like this i think it might work still a rookie at this programming.
You really need to ditch the goto; this is an inappropriate place and way to use it. Use a while() loop instead. It will also have the benefit of clarifying how this could get caught in an infinite loop.