Hey everyone.. I got this huge problem i made this code:
Well basicly when player types -duel dialog window should appear with buttons but somehow it doesnt work, game freezes for about 5 seconds and nothing happens. Can anyone tell me whats wrong here?
EDIT:
I fixed the problem somehow loop in i function caused this to stop working. This thread should be closed or deleted.
JASS:
scope duel1on1 initializer i
globals
private dialog duelDialog=DialogCreate()
endglobals
private function duelRequestC takes nothing returns boolean
call DialogClear(duelDialog)
call DialogSetMessage(duelDialog,"Choose your opponent:")
call DialogAddButton(duelDialog,"Button 1",0)
call DialogDisplay(GetTriggerPlayer(),duelDialog,true)
return false
endfunction
private function i takes nothing returns nothing
local trigger duelRequest=CreateTrigger()
local integer index=1
loop
exitwhen index>9
call TriggerRegisterPlayerChatEvent(duelRequest,Player(index),"-duel",true)
endloop
call TriggerAddCondition(duelRequest,function duelRequestC)
set duelRequest=null
endfunction
endscope
Well basicly when player types -duel dialog window should appear with buttons but somehow it doesnt work, game freezes for about 5 seconds and nothing happens. Can anyone tell me whats wrong here?
EDIT:
I fixed the problem somehow loop in i function caused this to stop working. This thread should be closed or deleted.