;'Kings' Arena Guild War Gm Event' - Event start 2 - Timed

User1 = #PARAM1
User2 = #PARAM2
WAGER_AMOUNT = #PARAM3

Guild1 = GetUserGuild(User1)
Guild2 = GetUserGuild(User2)

If GetUserFlag(0,10) <> 0
	SendMessageToUser(User1,"An event is already running, please wait.",#MSG_SERVER)
	SendMessageToUser(User2,"An event is already running, please wait.",#MSG_SERVER)
	GoTo END
EndIf

If Lower(GetUserMessage(User1))="yes"
	If Lower(GetUserMessage(User2))="yes"
		If GetGuildSilver(Guild1) < WAGER_AMOUNT
			SendMessageToUser(User1,"Your guild doesn't have enough silver.",#MSG_CRITICAL)
			SendMessageToUser(User2,GetGuildName(Guild1)+" doesn't have enough silver.",#MSG_CRITICAL)
			GoTo END
		ElseIf GetGuildSilver(Guild2) < WAGER_AMOUNT
			SendMessageToUser(User2,"Your guild doesn't have enough silver.",#MSG_CRITICAL)
			SendMessageToUser(User1,GetGuildName(Guild2)+" doesn't have enough silver.",#MSG_CRITICAL)
			GoTo END
		EndIf
		
		SetGuildSilver(Guild1,GetGuildSilver(Guild1)-WAGER_AMOUNT)
		SetGuildSilver(Guild2,GetGuildSilver(Guild2)-WAGER_AMOUNT)
		
		SetUserFlag(0,10,-2)
		SetUserFlag(0,11,WAGER_AMOUNT)
		
		SendMessageToAll(GetGuildName(Guild1)+" and "+GetGuildName(Guild2)+" have challenged each other in the Arena of Kings.",#MSG_SERVER)
		
		Timer(335,100,0,Guild1,Guild2)
		Timer(336,10000,0,Guild1,Guild2)
	Else
		SendMessageToUser(User1,GetUserName(User2)+" has not responded.",#MSG_SAY)
	EndIf
Else
	SendMessageToUser(User2,GetUserName(User1)+" has not responded.",#MSG_SAY)
EndIf

Label END

Continue = 1