Help - Search - Members - Calendar
Full Version: Gun Duel
StealthBot.net > StealthBot > Scripting and Plugins > Plugin Projects
cyber_hunter
Ok, First off, this is the first script i've worked on for about 5 years, so i'm mostly looking for feedback on how it "looks".

Commands:
Duel <Username>
gdStats <Username/me>
Fire
Aim
Cover
Heal
Stim
Cloak

CODE

'Gd
'1.0
'&Gun Duel:Cyber_Hunter
'&Duel <username>:GdStats <Username>:Fire:Aim:Cover:Heal:Stim:Cloak
'&
'&Gun Dueling Game:Lvl your Character:Increase your stats:Battle Other Players in 1vs1 Duels

Public gdStats '// Holds All Player Stats
Public gdGameOn As Boolean '// Holds the Game Status (Game On/Off)
Public gdChallenge As Boolean '// Holds Challenge Status
Public gdPlayer1(6) '// Holds Challengers Stats
Public gdPlayer2(6) '// Holds Other Players Stats
Public gdStatsLookup(6) '// Holds Stats for gdStats Commands
Const gdStatsFilePath = "plugins\gdStats.txt" '// Stat File File Path


'//ACCESS (This will later be changed for use in the pluginsettings.txt file)

Const gdDuel_Access = -1 '// Default -> -1 (No Access)


'//COMMAND NAMES (These will later be changed for use in the pluginsettings.txt file)

Const gdDuel_Command = "duel" '// Used To Challange Player.
Const gdStats_Command = "gdstats" '// Used to check stats.
Const gdFire_Command = "Ffre" '// Simple Attack Command.
Const gdAim_Command = "aim" '// Skip a turn for 100% Accurcy.
Const gdCover_Command = "cover" '// Increase you Evasion, Decrease your Accurcy.
Const gdHeal_Command = "heal" '// Used to heal yourself.
Const gdStim_Command = "stim" '// Used to attack twice while losing 5hp.
Const gdCloak_Command = "cloak" '// Increase your evasion for one attack.


'//LEVEL REQUIREMENT (These will later be changed for use in the pluginsettings.txt file)

Const gdFire_Level = 1 '// Default -> 1
Const gdAim_Level = 1 '// Default -> 1
Const gdCover_Level = 1 '// Default -> 1
Const gdHeal_Level = 1 '// Default -> 1
Const gdStim_Level = 5 '// Default -> 5
Const gdCloak_Level = 15 '// Default -> 15

Sub gd_Event_Load()
Set gdStats = CreateObject("Scripting.Dictionary")
gdGameOn = False
End Sub

Sub gd_Event_UserTalk(Username, Flags, Message, Ping)

GetDBEntry Username, myAccess, MyFlags

If gdStats.Exists(Username) = False Then
gdStats.Add Username, Array(1, 1, 1, 1, 0) '// All Users in channel that talk will be added
addq "/whisper " & psd2 & Username & " You have been added to the Gun Duel Player List."
End If

If LCase(massage) = BotVars.Trigger & gdDuel_Command And myAccess >= gdDuel_Access Then
Call gdDuel(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdStats_Command And myAccess >= gdDuel_Access Then
Call gdStats(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdFire_Command And myAccess >= gdDuel_Access Then
Call gdFire(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdAim_Command And myAccess >= gdDuel_Access Then
Call gdAim(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdCover_Command And myAccess >= gdDuel_Access Then
Call gdCover(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdHeal_Command And myAccess >= gdDuel_Access Then
Call gdHeal(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdStim_Command And myAccess >= gdDuel_Access Then
Call gdStim(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdCloak_Command And myAccess >= gdDuel_Access Then
Call gdCloak(Username, Message)
End If
End Sub

Sub gd_Event_WhisperFromUser(Username, Flags, Message, Ping)

GetDBEntry Username, myAccess, MyFlags

If gdStats.Exists(Username) = False Then
gdStats.Add Username, Array(1, 1, 1, 1, 0) '// All Users in channel that talk will be added
addq "/whisper " & psd2 & Username & " You have been added to the Gun Duel Player List."
End If

If Left(LCase(massage), Len(gdDuel_Command) + 1) = BotVars.Trigger & gdDuel_Command And myAccess >= gdDuel_Access Then
User = Split(Mid(LCase(Trim(Message)), 2), " ")
msgUsername = User(1)
Call gdDuel(Username, Message)
If Left(LCase(massage), Len(gdStats_Command) + 1) = BotVars.Trigger & LCase(gdStats_Command) And myAccess >= gdDuel_Access Then
User = Split(Mid(LCase(Trim(Message)), 2), " ")
msgUsername = User(1)
Call gdStats(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & LCase(gdFire_Command And myAccess) >= gdDuel_Access Then
Call gdFire(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & LCase(gdAim_Command And myAccess) >= gdDuel_Access Then
Call gdAim(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & LCase(gdCover_Command And myAccess) >= gdDuel_Access Then
Call gdCover(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & LCase(gdHeal_Command And myAccess) >= gdDuel_Access Then
Call gdHeal(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & LCase(gdStim_Command And myAccess) >= gdDuel_Access Then
Call gdStim(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & LCase(gdCloak_Command And myAccess) >= gdDuel_Access Then
Call gdCloak(Username, Message)
End If

If gdChallenge = True And Username = msgUsername And LCase(Message) = "yes" Then
gdGameOn = True
gdPlayer1(2) = gdStats.Item(gdPlayer1(1))(1) '// Stores Player1's Level
gdPlayer1(3) = gdStats.Item(gdPlayer1(1))(2) '// Stores Player1's Attack
gdPlayer1(4) = gdStats.Item(gdPlayer1(1))(3) '// Stores Player1's Accurcy
gdPlayer1(5) = gdStats.Item(gdPlayer1(1))(4) '// Stores Player1's Evasion
gdPlayer1(6) = gdStats.Item(gdPlayer1(1))(5) '// Stores Player1's Exp (%)
gdPlayer2(2) = gdStats.Item(gdPlayer2(1))(1) '// Stores Player2's Level
gdPlayer2(3) = gdStats.Item(gdPlayer2(1))(2) '// Stores Player2's Attack
gdPlayer2(4) = gdStats.Item(gdPlayer2(1))(3) '// Stores Player2's Accurcy
gdPlayer2(5) = gdStats.Item(gdPlayer2(1))(4) '// Stores Player2's Evasion
gdPlayer2(6) = gdStats.Item(gdPlayer2(1))(5) '// Stores Player2's Exp (%)
addq "A Duel Has Started Between " & gdPlayer1(1) & "(Level " & gdPlayer1(2) & ") And " & gdPlayer2(1) & "(Level " & gdPlayer2(2) & ")"
End If

End Sub

Sub gdDuel(Username, Message)

If gdGameOn = True Then
addq "/whisper" & " " & psd2 & Username & " a duel is currently in progress. Please wait for this duel to end."
Exit Sub
End If

If GetPositionByName(msgUsername) = -1 Then
addq "/whisper " & psd2 & Username & " " & msgUsername & " is not currently in the channel."
Exit Sub
Else

addq "/whisper " & psd2 & msgUsername & " " & Username & " has challenged you to a duel."
addq "/whisper " & psd2 & msgUsername & "Whisper me 'Yes' or 'NO'."
gdChallenge = True
gdPlayer1(1) = Username
gdPlayer2(1) = msgUsername

End Sub

Sub gdStats(Username, Message)

If LCase(msgUsername) = "me" Then
msgUsername = Username
End If
If gdStats.Exists(msgUsername) = False Then
addq "/whisper " & Username & " This Player does not exist."
Exit Sub
Else
gdStatsLookup(1) = gdStats.Item(msgUsername)(1)
gdStatsLookup(2) = gdStats.Item(msgUsername)(2)
gdStatsLookup(3) = gdStats.Item(msgUsername)(3)
gdStatsLookup(4) = gdStats.Item(msgUsername)(4)
gdStatsLookup(5) = gdStats.Item(msgUsername)(5)
gdStatsLookup(6) = gdStats.Item(msgUsername)(6)
addq "/whisper " & Username & " " & gdStatsLookup(1) & " Level:" & gdStatsLookup(2) & " Attack:" & gdStatsLookup(3) & " Accurcy:" & gdStatsLookup(4) & " Evasion:" & gdStatsLookup(5) & " Experience(%):" & gdStatsLookup(6)
End If
End Sub

Sub gdFire(Username, Message)


End Sub

Sub gdAim(Username, Message)


End Sub

Sub gdCover(Username, Message)


End Sub

Sub gdHeal(Username, Message)


End Sub

Sub gdStim(Username, Message)


End Sub

Sub gdCloak(Username, Message)


End Sub





This is just the start and I am continuing to work on this. It hasn't been tested yet, and i think testing is still a long ways off. I'm looking for suggestions and ideas

I was going to have players be able to create multiple characters and select them before the Duel, and i still might add that feature, but right now i'm just trying to get this thing done and ready for testing.

I would like to thank anyone who wrote tutorials. Without you, this beginning of a script would have never happened.
FiftyToo
One quick thing you can do to increase performance is to exit your UserTalk event if the first character is not the trigger. You are making a lot of comparisons for each message that everyone types. After you add them to gdStats, you could do If Left(Message, 1) <> BotVars.Trigger Then Exit Sub and it will prevent a lot of needless conditions from being checked.

52
Snap
Yea, always important to check for a trigger.

Due to 2.7's multiple-char allotment for triggers. You should change that to:

If Left(Message, Len(Botvars.Trigger)) <> BotVars.Trigger Then Exit Sub
cyber_hunter
QUOTE(Snap @ Nov 13 2007, 04:49 PM) *

Yea, always important to check for a trigger.

Due to 2.7's multiple-char allotment for triggers. You should change that to:

If Left(Message, Len(Botvars.Trigger)) <> BotVars.Trigger Then Exit Sub


Yeah like i said i'm still trying to get back into scritpting, also i'm not currently on my computer but i have made some modifications to the usertalk and userwhisper events (i noticed a few mistakes after posting the code). I'll defenetly be using that little line for both of them, after the dictionary check.

I also had a question about dictionaries, the tutorial doesn't help me with it so i'm going to ask here.
Is it automatically saved in a text file or do i have to menually put the code in so it does, and if i do, what could that code be. I've never used dictionaries before so i'm a litle lost on this one.

I also won't be able to post new code until Friday night, cause i'm afway across the country right now.
Ths for your always apreciated comments.
Cyber_Hunter
Samsunait
Well, an error reloading scripts:
[21.59.22] Load Call Error On File> C:\Programmi\StealthBot\plugins\gun.txt
[21.59.22] Error Number: 13 Description: Type mismatch
cyber_hunter
Well I'm back from my trip and this is the latest version, again don't bother with testing just yet, you'll get errors like crazy.

The commands that should work with this are:
gdStats
Duel

At this point nothing else is even coded yet.

CODE

'Gd
'1.0
'&Gun Duel:Cyber_Hunter
'&Duel <username>:GdStats <Username>:Fire:Aim:Cover:Heal:Stim:Cloak
'&
'&Gun Dueling Game:Lvl your Character:Increase your stats:Battle Other Players in 1vs1 Duels

Public gdStats '// Holds All Player Stats
Public gdGameOn As Boolean '// Holds the Game Status (Game On/Off)
Public gdChallenge As Boolean '// Holds Challenge Status
Public gdPlayer1(6) '// Holds Challengers Stats
Public gdPlayer2(6) '// Holds Other Players Stats
Public gdStatsLookup(6) '// Holds Stats for gdStats Commands
Const gdStatsFilePath = BotPath() & "plugins\gdStats.txt" '// Stat File FilePath


'//ACCESS (This will later be changed for use in the pluginsettings.txt file)

Const gdDuel_Access = -1 '// Default -> -1 (No Access)


'//COMMAND NAMES (These will later be changed for use in the pluginsettings.txt file)

Const gdDuel_Command = "duel" '// Used To Challange Player.
Const gdStats_Command = "gdstats" '// Used to check stats.
Const gdFire_Command = "Fire" '// Simple Attack Command.
Const gdAim_Command = "aim" '// Skip a turn for 100% Accurcy.
Const gdCover_Command = "cover" '// Increase you Evasion, Decrease your Accurcy.
Const gdHeal_Command = "heal" '// Used to heal yourself.
Const gdStim_Command = "stim" '// Used to attack twice while losing 5hp.
Const gdCloak_Command = "cloak" '// Increase your evasion for one attack.


'//LEVEL REQUIREMENT (These will later be changed for use in the pluginsettings.txt file)

Const gdFire_Level = 1 '// Default -> 1
Const gdAim_Level = 1 '// Default -> 1
Const gdCover_Level = 1 '// Default -> 1
Const gdHeal_Level = 1 '// Default -> 1
Const gdStim_Level = 5 '// Default -> 5
Const gdCloak_Level = 15 '// Default -> 15

Sub gd_Event_Load()
Set gdStats = CreateObject("Scripting.Dictionary")
gdGameOn = False
gdChallenge = False
End Sub

Sub gd_Event_UserTalk(Username, Flags, Message, Ping)

GetDBEntry Username, myAccess, MyFlags

If gdStats.Exists(Username) = False Then
gdStats.Add Username, Array(1, 1, 1, 1, 0) '// All Users in channel that talk will be added
addq "/whisper " & psd2 & Username & " You have been added to the Gun Duel Player List."
End If

If Left(Message, Len(Botvars.Trigger)) <> BotVars.Trigger Then Exit Sub

If Left(LCase(massage), Len(gdDuel_Command) + 1) = BotVars.Trigger & gdDuel_Command And myAccess

>= gdDuel_Access Then
User = Split(Mid(LCase(Trim(Message)), 2), " ")
msgUsername = User(1)
Call gdDuel(Username, Message)
If Left(LCase(massage), Len(gdStats_Command) + 1) = BotVars.Trigger & LCase(gdStats_Command) And

myAccess >= gdDuel_Access Then
User = Split(Mid(LCase(Trim(Message)), 2), " ")
msgUsername = User(1)
Call gdStats(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdFire_Command And myAccess >= gdDuel_Access Then
Call gdFire(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdAim_Command And myAccess >= gdDuel_Access Then
Call gdAim(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdCover_Command And myAccess >= gdDuel_Access Then
Call gdCover(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdHeal_Command And myAccess >= gdDuel_Access Then
Call gdHeal(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdStim_Command And myAccess >= gdDuel_Access Then
Call gdStim(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdCloak_Command And myAccess >= gdDuel_Access Then
Call gdCloak(Username, Message)
End If
End Sub

Sub gd_Event_WhisperFromUser(Username, Flags, Message, Ping)

GetDBEntry Username, myAccess, MyFlags

If gdStats.Exists(Username) = False Then
gdStats.Add Username, Array(1, 1, 1, 1, 0) '// All Users in channel that talk will be added
addq "/whisper " & psd2 & Username & " You have been added to the Gun Duel Player List."
End If

If Left(Message, Len(Botvars.Trigger)) <> BotVars.Trigger Then Exit Sub

If Left(LCase(massage), Len(gdDuel_Command) + 1) = BotVars.Trigger & gdDuel_Command And myAccess

>= gdDuel_Access Then
User = Split(Mid(LCase(Trim(Message)), 2), " ")
msgUsername = User(1)
Call gdDuel(Username, Message)
If Left(LCase(massage), Len(gdStats_Command) + 1) = BotVars.Trigger & LCase(gdStats_Command) And

myAccess >= gdDuel_Access Then
User = Split(Mid(LCase(Trim(Message)), 2), " ")
msgUsername = User(1)
Call gdStats(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & LCase(gdFire_Command And myAccess) >= gdDuel_Access Then
Call gdFire(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & LCase(gdAim_Command And myAccess) >= gdDuel_Access Then
Call gdAim(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & LCase(gdCover_Command And myAccess) >= gdDuel_Access

Then
Call gdCover(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & LCase(gdHeal_Command And myAccess) >= gdDuel_Access Then
Call gdHeal(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & LCase(gdStim_Command And myAccess) >= gdDuel_Access Then
Call gdStim(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & LCase(gdCloak_Command And myAccess) >= gdDuel_Access

Then
Call gdCloak(Username, Message)
End If

If gdChallenge = True And Username = msgUsername And LCase(Message) = "yes" Then
gdGameOn = True
gdPlayer1(2) = gdStats.Item(gdPlayer1(1))(1) '// Stores Player1's Level
gdPlayer1(3) = gdStats.Item(gdPlayer1(1))(2) '// Stores Player1's Attack
gdPlayer1(4) = gdStats.Item(gdPlayer1(1))(3) '// Stores Player1's Accurcy
gdPlayer1(5) = gdStats.Item(gdPlayer1(1))(4) '// Stores Player1's Evasion
gdPlayer1(6) = gdStats.Item(gdPlayer1(1))(5) '// Stores Player1's Exp (%)
gdPlayer2(2) = gdStats.Item(gdPlayer2(1))(1) '// Stores Player2's Level
gdPlayer2(3) = gdStats.Item(gdPlayer2(1))(2) '// Stores Player2's Attack
gdPlayer2(4) = gdStats.Item(gdPlayer2(1))(3) '// Stores Player2's Accurcy
gdPlayer2(5) = gdStats.Item(gdPlayer2(1))(4) '// Stores Player2's Evasion
gdPlayer2(6) = gdStats.Item(gdPlayer2(1))(5) '// Stores Player2's Exp (%)
addq "A Duel Has Started Between " & gdPlayer1(1) & "(Level " & gdPlayer1(2) & ") And " &

gdPlayer2(1) & "(Level " & gdPlayer2(2) & ")"
ElseIf gdChallenge = True And Username = msgUsername And LCase(Message) = "no" Then
addq Username & " has refused the Duel Challenge."
End If

End Sub

Sub gdDuel(Username, Message)

If gdGameOn = True Then '// Checks for current duels
addq "/whisper" & " " & psd2 & Username & " a duel is currently in progress. Please wait for

this duel to end."
Exit Sub
End If

If GetPositionByName(msgUsername) = -1 Then '// Checks for use in channel
addq "/whisper " & psd2 & Username & " " & msgUsername & " is not currently in the channel."
Exit Sub
Else

addq "/whisper " & psd2 & msgUsername & " " & Username & " has challenged you to a duel."
addq "/whisper " & psd2 & msgUsername & "Whisper me 'Yes' or 'No'."
gdChallenge = True
gdPlayer1(1) = Username
gdPlayer2(1) = msgUsername

End Sub

Sub gdStats(Username, Message)

If LCase(msgUsername) = "me" Then '// Change Username Incase of "me"
msgUsername = Username
End If
If gdStats.Exists(msgUsername) = False Then '// Checks for user in dictionary
addq "/whisper " & Username & " This Player does not exist."
Exit Sub
Else
gdStatsLookup(1) = gdStats.Item(msgUsername)(1)
gdStatsLookup(2) = gdStats.Item(msgUsername)(2)
gdStatsLookup(3) = gdStats.Item(msgUsername)(3)
gdStatsLookup(4) = gdStats.Item(msgUsername)(4)
gdStatsLookup(5) = gdStats.Item(msgUsername)(5)
gdStatsLookup(6) = gdStats.Item(msgUsername)(6)
addq "/whisper " & Username & " " & gdStatsLookup(1) & " Level:" & gdStatsLookup(2) & "

Attack:" & gdStatsLookup(3) & " Accurcy:" & gdStatsLookup(4) & " Evasion:" & gdStatsLookup(5) & "

Experience(%):" & gdStatsLookup(6)
End If
End Sub

Sub gdFire(Username, Message)


End Sub

Sub gdAim(Username, Message)


End Sub

Sub gdCover(Username, Message)


End Sub

Sub gdHeal(Username, Message)


End Sub

Sub gdStim(Username, Message)


End Sub

Sub gdCloak(Username, Message)


End Sub


To Samsunait:
I kinda figured i'd get somthing like that. I still need to play around with dictionaries and figure it out. My last post explains my problems with it and I haven't had much time to look it up either. I'll be doing that within the next few days, right now i'm just to beat from my trip to do anything. Thx for trying to test it though biggrin.gif .

To Snap:
I've added the code, Many thx for the info on 2.7, It's going to be very useful for future updates to this script smile.gif

Ok, I've been working on it but i've spent to much time on one error

QUOTE
[8:38:03 AM] Load Call Error On File> E:\Program Files\StealthBot~Vlidor[ek]\plugins\GunDuelPlugin.plug
[8:38:03 AM] Error Number: 13 Description: Type mismatch


It has something to do with the dictionary, the rest of it remains untested to this point because of this error.

CODE

'Gd
'1.0
'&Gun Duel:Cyber_Hunter
'&Duel <username>:GdStats <Username>:Fire:Aim:Cover:Heal:Stim:Cloak
'&
'&Gun Dueling Game:Lvl your Character:Increase your stats:Battle Other Players in 1vs1 Duels

Option Explicit

Public gdstats '// Holds All Player Stats
Public gdFSO '// Holds Player Stats On Shutdown
Public gdGameOn As Boolean '// Holds the Game Status (Game On/Off)
Public gdChallenge As Boolean '// Holds Challenge Status
Public gdDonePlayer1 As Boolean '// Holds Turn Information
Public gdDonePlayer2 As Boolean '// Holds Turn Information
Public gdActionPlayer1 '// Holds Player Action
Public gdActionPlayer2 '// Holds Player Action
Private gdPlayer1(6) '// Holds Challengers Stats
Private gdPlayer2(6) '// Holds Other Players Stats
Private gdStatsLookup(6) '// Holds Stats for gdStats Commands



'//ACCESS (This will later be changed for use in the pluginsettings.txt file)

Const gdFilePath = BotPath & "plugins\gdStats.txt" '// Stat File FilePath
Const gdDuel_Access = 0 '// Default -> 0 (No Access)


'//COMMAND NAMES (These will later be changed for use in the pluginsettings.txt file)

Const gdDuel_Command = "duel" '// Used To Challange Player.
Const gdStats_Command = "gdstats" '// Used to check stats.
Const gdFire_Command = "fire" '// Simple Attack Command.
Const gdAim_Command = "aim" '// Skip a turn for 100% Accurcy.
Const gdCover_Command = "cover" '// Increase you Evasion, Decrease your Accurcy.
Const gdHeal_Command = "heal" '// Used to heal yourself.
Const gdStim_Command = "stim" '// Used to attack twice while losing 5hp.
Const gdCloak_Command = "cloak" '// Increase your evasion for one attack.


'//LEVEL REQUIREMENT (These will later be changed for use in the pluginsettings.txt file)

Const gdFire_Level = 1 '// Default -> 1
Const gdAim_Level = 1 '// Default -> 1
Const gdCover_Level = 1 '// Default -> 1
Const gdHeal_Level = 1 '// Default -> 1
Const gdStim_Level = 5 '// Default -> 5
Const gdCloak_Level = 15 '// Default -> 15

Sub gd_Event_Load()
Dim TempStr(6)
Set gdstats = CreateObject("Scripting.Dictionary")
Set gdFSO = CreateObject("Scripting.FileSystemObject")

If gdFSO.FileExists(gdFilePath) Then '// If File Exists, Retrieves Information
Set gdSaved = gdFSO.OpenTextFile(filepath, 1)
Do While Not File.AtEndOfStream
TempStr(1) = Split(File.ReadLine, " ")(0)
TempStr(2) = Split(File.ReadLine, " ")(1)
TempStr(3) = Split(File.ReadLine, " ")(2)
TempStr(4) = Split(File.ReadLine, " ")(3)
TempStr(5) = Split(File.ReadLine, " ")(4)
TempStr(6) = Split(File.ReadLine, " ")(5)
gdstats.Add TempStr(1), Array(TempStr(2), TempStr(3), TempStr(4), TempStr(5), TempStr(6))
Loop
gdSaved.Close
Set gdSaved = Nothing
Else
AddChat vbCyan, ">>>>>>>> Welcome Message Here <<<<<<<<"
End If

gdGameOn = False
gdChallenge = False
End Sub

Sub gd_Event_UserTalk(Username, Flags, Message, Ping)

GetDBEntry Username, myAccess, MyFlags

If gdstats.Exists(Username) = False Then
gdstats.Add Username, Array("1", "1", "1", "1", "0") '// All Users in channel that talk will be added
addq "/whisper " & psd2 & Username & " You have been added to the Gun Duel Player List."
End If

If Left(Message, Len(BotVars.Trigger)) <> BotVars.Trigger Then Exit Sub

If Left(LCase(massage), Len(gdDuel_Command) + 1) = BotVars.Trigger & gdDuel_Command And myAccess >= gdDuel_Access Then
User = Split(Mid(LCase(Trim(Message)), 2), " ")
msgUsername = User(1)
Call gdDuel(Username, Message)
If Left(LCase(massage), Len(gdStats_Command) + 1) = BotVars.Trigger & LCase(gdStats_Command) And myAccess >= gdDuel_Access Then
User = Split(Mid(LCase(Trim(Message)), 2), " ")
msgUsername = User(1)
Call gdStatReturn(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdFire_Command And myAccess >= gdDuel_Access Then
Call gdFire(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdAim_Command And myAccess >= gdDuel_Access Then
Call gdAim(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdCover_Command And myAccess >= gdDuel_Access Then
Call gdCover(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdHeal_Command And myAccess >= gdDuel_Access Then
Call gdHeal(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdStim_Command And myAccess >= gdDuel_Access Then
Call gdStim(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdCloak_Command And myAccess >= gdDuel_Access Then
Call gdCloak(Username, Message)
End If
End Sub

Sub gd_Event_WhisperFromUser(Username, Flags, Message, Ping)

GetDBEntry Username, myAccess, MyFlags

If gdstats.Exists(Username) = False Then
gdstats.Add Username, Array(1, 1, 1, 1, 0) '// All Users in channel that talk will be added
addq "/whisper " & psd2 & Username & " You have been added to the Gun Duel Player List."
End If

If Left(Message, Len(BotVars.Trigger)) <> BotVars.Trigger Then Exit Sub

If Left(LCase(massage), Len(gdDuel_Command) + 1) = BotVars.Trigger & gdDuel_Command And myAccess >= gdDuel_Access Then
User = Split(Mid(LCase(Trim(Message)), 2), " ")
msgUsername = User(1)
Call gdDuel(Username, Message)
If Left(LCase(massage), Len(gdStats_Command) + 1) = BotVars.Trigger & LCase(gdStats_Command) And myAccess >= gdDuel_Access Then
User = Split(Mid(LCase(Trim(Message)), 2), " ")
msgUsername = User(1)
Call gdStatReturn(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & LCase(gdFire_Command And myAccess) >= gdDuel_Access Then
Call gdFire(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & LCase(gdAim_Command And myAccess) >= gdDuel_Access Then
Call gdAim(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & LCase(gdCover_Command And myAccess) >= gdDuel_Access Then
Call gdCover(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & LCase(gdHeal_Command And myAccess) >= gdDuel_Access Then
Call gdHeal(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & LCase(gdStim_Command And myAccess) >= gdDuel_Access Then
Call gdStim(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & LCase(gdCloak_Command And myAccess) >= gdDuel_Access Then
Call gdCloak(Username, Message)
End If

If gdChallenge = True And Username = msgUsername And LCase(Message) = "yes" Then
gdGameOn = True
gdPlayer1(2) = gdstats.Item(gdPlayer1(1))(1) '// Stores Player1's Level
gdPlayer1(3) = gdstats.Item(gdPlayer1(1))(2) '// Stores Player1's Attack
gdPlayer1(4) = gdstats.Item(gdPlayer1(1))(3) '// Stores Player1's Accurcy
gdPlayer1(5) = gdstats.Item(gdPlayer1(1))(4) '// Stores Player1's Evasion
gdPlayer1(6) = gdstats.Item(gdPlayer1(1))(5) '// Stores Player1's Exp (%)
gdPlayer2(2) = gdstats.Item(gdPlayer2(1))(1) '// Stores Player2's Level
gdPlayer2(3) = gdstats.Item(gdPlayer2(1))(2) '// Stores Player2's Attack
gdPlayer2(4) = gdstats.Item(gdPlayer2(1))(3) '// Stores Player2's Accurcy
gdPlayer2(5) = gdstats.Item(gdPlayer2(1))(4) '// Stores Player2's Evasion
gdPlayer2(6) = gdstats.Item(gdPlayer2(1))(5) '// Stores Player2's Exp (%)
addq "A Duel Has Started Between " & gdPlayer1(1) & "(Level " & gdPlayer1(2) & ") And " & gdPlayer2(1) & "(Level " & gdPlayer2(2) & ")"
ElseIf gdChallenge = True And Username = msgUsername And LCase(Message) = "no" Then
addq Username & " has refused the Duel Challenge."
End If

End Sub

Sub script_Event_Close()
Dim TempStr

Set gdSaved = gdFSO.OpenTextFile(filepath, 2, True)
For Each Key In gdstats.Keys '// Puts All info into a file
TempStr = Key & " " & gdstats.Item(Key)(1) & " " & gdstats.Item(Key)(2) & " " & gdstats.Item(Key)(3) & " " & gdstats.Item(Key)(4) & " " & gdstats.Item(Key)(5)
gdSaved.WriteLine TempStr
Next
gdSaved.Close
Set gdSaved = Nothing
End Sub

Sub gdDuel(Username, Message)

If gdGameOn = True Then '// Checks for current duels
addq "/whisper" & " " & psd2 & Username & " a duel is currently in progress. Please wait for this duel to end."
Exit Sub
End If

If GetPositionByName(msgUsername) = -1 Then '// Checks for use in channel
addq "/whisper " & psd2 & Username & " " & msgUsername & " is not currently in the channel."
Exit Sub
Else

addq "/whisper " & psd2 & msgUsername & " " & Username & " has challenged you to a duel."
addq "/whisper " & psd2 & msgUsername & "Whisper me 'Yes' or 'NO'."
gdChallenge = True
gdPlayer1(1) = Username
gdPlayer2(1) = msgUsername

End Sub

Sub gdStatReturn(Username, Message)

If LCase(msgUsername) = "me" Then '// Change Username Incase of "me"
msgUsername = Username
End If
If gdstats.Exists(msgUsername) = False Then '// Checks for user in dictionary
addq "/whisper " & Username & " This Player does not exist."
Exit Sub
Else
gdStatsLookup(1) = gdstats.Item(msgUsername)(1)
gdStatsLookup(2) = gdstats.Item(msgUsername)(2)
gdStatsLookup(3) = gdstats.Item(msgUsername)(3)
gdStatsLookup(4) = gdstats.Item(msgUsername)(4)
gdStatsLookup(5) = gdstats.Item(msgUsername)(5)
gdStatsLookup(6) = gdstats.Item(msgUsername)(6)
addq "/whisper " & Username & " " & gdStatsLookup(1) & " Level:" & gdStatsLookup(2) & " Attack:" & gdStatsLookup(3) & " Accurcy:" & gdStatsLookup(4) & " Evasion:" & gdStatsLookup(5) & " Experience(%):" & gdStatsLookup(6)
End If
End Sub

Sub gdFire(Username, Message)

If Username = gdPlayer1 And gdDonePlayer1 = False Then
gdDonePlayer1 = True
gdActionPlayer1 = Fire
ElseIf Username = gdPlayer2 And gdDonePlayer2 = False Then
gdDonePlayer2 = True
gdActionPlayer2 = Fire
Else: ExitSub
End If

If gdDonePlayer1 = True And gdDonePlayer2 = True Then
Call gdActionChosen
End If
End Sub

Sub gdAim(Username, Message)

If Username = gdPlayer1 And gdDonePlayer1 = False Then
gdDonePlayer1 = True
gdActionPlayer1 = Aim
ElseIf Username = gdPlayer2 And gdDonePlayer2 = False Then
gdDonePlayer2 = True
gdActionPlayer2 = Aim
Else: ExitSub
End If

If gdDonePlayer1 = True And gdDonePlayer2 = True Then
Call gdActionChosen
End If
End Sub

Sub gdCover(Username, Message)

If Username = gdPlayer1 And gdDonePlayer1 = False Then
gdDonePlayer1 = True
gdActionPlayer1 = Cover
ElseIf Username = gdPlayer2 And gdDonePlayer2 = False Then
gdDonePlayer2 = True
gdActionPlayer2 = Cover
Else: ExitSub
End If

If gdDonePlayer1 = True And gdDonePlayer2 = True Then
Call gdActionChosen
End If
End Sub

Sub gdHeal(Username, Message)

If Username = gdPlayer1 And gdDonePlayer1 = False Then
gdDonePlayer1 = True
gdActionPlayer1 = Heal
ElseIf Username = gdPlayer2 And gdDonePlayer2 = False Then
gdDonePlayer2 = True
gdActionPlayer2 = Heal
Else: ExitSub
End If

If gdDonePlayer1 = True And gdDonePlayer2 = True Then
Call gdActionChosen
End If
End Sub

Sub gdStim(Username, Message)

If Username = gdPlayer1 And gdDonePlayer1 = False Then
gdDonePlayer1 = True
gdActionPlayer1 = Stim
ElseIf Username = gdPlayer2 And gdDonePlayer2 = False Then
gdDonePlayer2 = True
gdActionPlayer2 = Stim
Else: ExitSub
End If

If gdDonePlayer1 = True And gdDonePlayer2 = True Then
Call gdActionChosen
End If
End Sub

Sub gdCloak(Username, Message)

If Username = gdPlayer1 And gdDonePlayer1 = False Then
gdDonePlayer1 = True
gdActionPlayer1 = Cloak
ElseIf Username = gdPlayer2 And gdDonePlayer2 = False Then
gdDonePlayer2 = True
gdActionPlayer2 = Cloak
Else: ExitSub
End If

If gdDonePlayer1 = True And gdDonePlayer2 = True Then
Call gdActionChosen
End If
End Sub


I've tried everthing I can think of. Hope it's not something really stupid too smile.gif
Anyone can tell me whats wrong?

CODE
'Gd
'1.0
'&Gun Duel:Cyber_Hunter
'&Duel <username>:GdStats <Username>:Fire:Aim:Cover:Heal:Stim:Cloak
'&
'&Gun Dueling Game:Lvl your Character:Increase your stats:Battle Other Players in 1vs1 Duels

Option Explicit

Public gdstats '// Holds All Player Stats
Public gdfso '// Holds fso
Public gdsaved '// Save Info On Shutdown
Public gdGameOn As Boolean '// Holds the Game Status (Game On/Off)
Public gdChallenge As Boolean '// Holds Challenge Status
Public gdDonePlayer1 As Boolean '// Holds Turn Information
Public gdDonePlayer2 As Boolean '// Holds Turn Information
Public gdActionPlayer1 '// Holds Player Action
Public gdActionPlayer2 '// Holds Player Action
Private gdPlayer1(6) '// Holds Challengers Stats
Private gdPlayer2(6) '// Holds Other Players Stats
Private gdGameStats1(4) '// Holds InGame Stats
Private gdGameStats2(4) '// Holds InGame Stats
Private gdStatsLookup(6) '// Holds Stats for gdStats Commands



'//ACCESS (This will later be changed for use in the pluginsettings.txt file)

Const gdFilePath = "plugins\gdStats.txt" '// Stat File FilePath
Const gdDuel_Access = 0 '// Default -> 0 (No Access)


'//COMMAND NAMES (These will later be changed for use in the pluginsettings.txt file)

Const gdDuel_Command = "duel" '// Used To Challange Player.
Const gdStats_Command = "gdstats" '// Used to check stats.
Const gdFire_Command = "fire" '// Simple Attack Command.
Const gdAim_Command = "aim" '// Skip a turn for 100% Accurcy.
Const gdCover_Command = "cover" '// Increase you Evasion, Decrease your Accurcy.
Const gdHeal_Command = "heal" '// Used to heal yourself.
Const gdStim_Command = "stim" '// Used to attack twice while losing 5hp.
Const gdCloak_Command = "cloak" '// Increase your evasion for one attack.


'//LEVEL REQUIREMENT (These will later be changed for use in the pluginsettings.txt file)

Const gdFire_Level = 1 '// Default -> 1
Const gdAim_Level = 1 '// Default -> 1
Const gdCover_Level = 1 '// Default -> 1
Const gdHeal_Level = 1 '// Default -> 1
Const gdStim_Level = 5 '// Default -> 5
Const gdCloak_Level = 15 '// Default -> 15

Sub gd_Event_Load()
Dim TempStr(6)
Set gdstats = CreateObject("Scripting.Dictionary")
Set gdfso = CreateObject("Scripting.FileSystemObject")

If gdfso.FileExists(gdFilePath) Then '// If File Exists, Retrieves Information
Set gdsaved = gdfso.OpenTextFile(filepath, 1)
Do While Not gdsaved.AtEndOfStream
TempStr(1) = Split(gdsaved.ReadLine, " ")(0)
TempStr(2) = Split(gdsaved.ReadLine, " ")(1)
TempStr(3) = Split(gdsaved.ReadLine, " ")(2)
TempStr(4) = Split(gdsaved.ReadLine, " ")(3)
TempStr(5) = Split(gdsaved.ReadLine, " ")(4)
TempStr(6) = Split(gdsaved.ReadLine, " ")(5)
gdstats.Add TempStr(1), Array(TempStr(2), TempStr(3), TempStr(4), TempStr(5), TempStr(6))
Loop
gdsaved.Close
Set gdsaved = Nothing
Else
AddChat vbCyan, ">>>>>>>> Welcome Message Here <<<<<<<<"
End If

gdGameOn = False
gdChallenge = False
End Sub

Sub gd_Event_UserTalk(Username, Flags, Message, Ping)

GetDBEntry Username, myAccess, MyFlags

If gdstats.Exists(Username) = False Then
gdstats.Add Username, Array("1", "1", "1", "1", "0") '// All Users in channel that talk will be added
addq "/whisper " & psd2 & Username & " You have been added to the Gun Duel Player List."
End If

If Left(Message, Len(BotVars.Trigger)) <> BotVars.Trigger Then Exit Sub

If Left(LCase(massage), Len(gdDuel_Command) + 1) = BotVars.Trigger & gdDuel_Command And myAccess >= gdDuel_Access Then
User = Split(Mid(LCase(Trim(Message)), 2), " ")
msgUsername = User(1)
Call gdDuel(Username, Message)
If Left(LCase(massage), Len(gdStats_Command) + 1) = BotVars.Trigger & LCase(gdStats_Command) And myAccess >= gdDuel_Access Then
User = Split(Mid(LCase(Trim(Message)), 2), " ")
msgUsername = User(1)
Call gdStatReturn(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdFire_Command And myAccess >= gdDuel_Access Then
Call gdFire(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdAim_Command And myAccess >= gdDuel_Access Then
Call gdAim(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdCover_Command And myAccess >= gdDuel_Access Then
Call gdCover(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdHeal_Command And myAccess >= gdDuel_Access Then
Call gdHeal(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdStim_Command And myAccess >= gdDuel_Access Then
Call gdStim(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdCloak_Command And myAccess >= gdDuel_Access Then
Call gdCloak(Username, Message)
End If
End Sub

Sub gd_Event_WhisperFromUser(Username, Flags, Message, Ping)
GetDBEntry Username, myAccess, MyFlags

If gdstats.Exists(Username) = False Then
gdstats.Add Username, Array(1, 1, 1, 1, 0) '// All Users in channel that talk will be added
addq "/whisper " & psd2 & Username & " You have been added to the Gun Duel Player List."
End If

If Left(Message, Len(BotVars.Trigger)) <> BotVars.Trigger Then Exit Sub

If Left(LCase(massage), Len(gdDuel_Command) + 1) = BotVars.Trigger & gdDuel_Command And myAccess >= gdDuel_Access Then
User = Split(Mid(LCase(Trim(Message)), 2), " ")
msgUsername = User(1)
Call gdDuel(Username, Message)
If Left(LCase(massage), Len(gdStats_Command) + 1) = BotVars.Trigger & LCase(gdStats_Command) And myAccess >= gdDuel_Access Then
User = Split(Mid(LCase(Trim(Message)), 2), " ")
msgUsername = User(1)
Call gdStatReturn(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & LCase(gdFire_Command And myAccess) >= gdDuel_Access Then
Call gdFire(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & LCase(gdAim_Command And myAccess) >= gdDuel_Access Then
Call gdAim(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & LCase(gdCover_Command And myAccess) >= gdDuel_Access Then
Call gdCover(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & LCase(gdHeal_Command And myAccess) >= gdDuel_Access Then
Call gdHeal(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & LCase(gdStim_Command And myAccess) >= gdDuel_Access Then
Call gdStim(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & LCase(gdCloak_Command And myAccess) >= gdDuel_Access Then
Call gdCloak(Username, Message)
End If

If gdChallenge = True And Username = msgUsername And LCase(Message) = "yes" Then
gdGameOn = True
gdPlayer1(2) = gdstats.Item(gdPlayer1(1))(1) '// Stores Player1's Level
gdPlayer1(3) = gdstats.Item(gdPlayer1(1))(2) '// Stores Player1's Attack
gdPlayer1(4) = gdstats.Item(gdPlayer1(1))(3) '// Stores Player1's Accurcy
gdPlayer1(5) = gdstats.Item(gdPlayer1(1))(4) '// Stores Player1's Evasion
gdPlayer1(6) = gdstats.Item(gdPlayer1(1))(5) '// Stores Player1's Exp (%)
gdPlayer2(2) = gdstats.Item(gdPlayer2(1))(1) '// Stores Player2's Level
gdPlayer2(3) = gdstats.Item(gdPlayer2(1))(2) '// Stores Player2's Attack
gdPlayer2(4) = gdstats.Item(gdPlayer2(1))(3) '// Stores Player2's Accurcy
gdPlayer2(5) = gdstats.Item(gdPlayer2(1))(4) '// Stores Player2's Evasion
gdPlayer2(6) = gdstats.Item(gdPlayer2(1))(5) '// Stores Player2's Exp (%)
gdGameStats1(1) = gdPlayer1(2) * 10 '// Stores InGame HP
gdGameStats1(2) = gdPlayer1(3) '// Stores InGame Attack
gdGameStats1(3) = gdPlayer1(4) '// Stores InGame Accurcy
gdGameStats1(4) = gdPlayer1(5) '// Stores InGame Evasion
gdGameStats2(1) = gdPlayer1(2) * 10 '// Stores InGame HP
gdGameStats2(2) = gdPlayer1(3) '// Stores InGame Attack
gdGameStats2(3) = gdPlayer1(4) '// Stores InGame Accurcy
gdGameStats2(4) = gdPlayer1(5) '// Stores InGame Evasion
addq "A Duel Has Started Between " & gdPlayer1(1) & "(Level " & gdPlayer1(2) & ") And " & gdPlayer2(1) & "(Level " & gdPlayer2(2) & ")"
ElseIf gdChallenge = True And Username = msgUsername And LCase(Message) = "no" Then
addq Username & " has refused the Duel Challenge."
End If
End Sub

Sub script_Event_Close()
Dim TempStr

Set gdsaved = gdfso.OpenTextFile(filepath, 2, True)
For Each Key In gdstats.Keys '// Puts All info into a file
TempStr = Key & " " & gdstats.Item(Key)(1) & " " & gdstats.Item(Key)(2) & " " & gdstats.Item(Key)(3) & " " & gdstats.Item(Key)(4) & " " & gdstats.Item(Key)(5)
gdsaved.WriteLine TempStr
Next
gdsaved.Close
Set gdsaved = Nothing
End Sub

Sub gdDuel(Username, Message)

If gdGameOn = True Then '// Checks for current duels
addq "/whisper" & " " & psd2 & Username & " a duel is currently in progress. Please wait for this duel to end."
Exit Sub
End If

If GetPositionByName(msgUsername) = -1 Then '// Checks for use in channel
addq "/whisper " & psd2 & Username & " " & msgUsername & " is not currently in the channel."
Exit Sub
Else

addq "/whisper " & psd2 & msgUsername & " " & Username & " has challenged you to a duel."
addq "/whisper " & psd2 & msgUsername & "Whisper me 'Yes' or 'NO'."
gdChallenge = True
gdPlayer1(1) = Username
gdPlayer2(1) = msgUsername

End Sub

Sub gdStatReturn(Username, Message)

If LCase(msgUsername) = "me" Then '// Change Username Incase of "me"
msgUsername = Username
End If
If gdstats.Exists(msgUsername) = False Then '// Checks for user in dictionary
addq "/whisper " & Username & " This Player does not exist."
Exit Sub
Else
gdStatsLookup(1) = gdstats.Item(msgUsername)(1)
gdStatsLookup(2) = gdstats.Item(msgUsername)(2)
gdStatsLookup(3) = gdstats.Item(msgUsername)(3)
gdStatsLookup(4) = gdstats.Item(msgUsername)(4)
gdStatsLookup(5) = gdstats.Item(msgUsername)(5)
gdStatsLookup(6) = gdstats.Item(msgUsername)(6)
addq "/whisper " & Username & " " & gdStatsLookup(1) & " Level:" & gdStatsLookup(2) & " Attack:" & gdStatsLookup(3) & " Accurcy:" & gdStatsLookup(4) & " Evasion:" & gdStatsLookup(5) & " Experience(%):" & gdStatsLookup(6)
End If
End Sub

Sub gdFire(Username, Message)

If Username = gdPlayer1 And gdDonePlayer1 = False Then
gdDonePlayer1 = True
gdActionPlayer1 = 1
ElseIf Username = gdPlayer2 And gdDonePlayer2 = False Then
gdDonePlayer2 = True
gdActionPlayer2 = 1
Else: ExitSub
End If

If gdDonePlayer1 = True And gdDonePlayer2 = True Then
Call gdActionChosen
End If
End Sub

Sub gdAim(Username, Message)

If Username = gdPlayer1 And gdDonePlayer1 = False Then
gdDonePlayer1 = True
gdActionPlayer1 = 2
ElseIf Username = gdPlayer2 And gdDonePlayer2 = False Then
gdDonePlayer2 = True
gdActionPlayer2 = 2
Else: ExitSub
End If

If gdDonePlayer1 = True And gdDonePlayer2 = True Then
Call gdActionChosen
End If
End Sub

Sub gdCover(Username, Message)

If Username = gdPlayer1 And gdDonePlayer1 = False Then
gdDonePlayer1 = True
gdActionPlayer1 = 3
ElseIf Username = gdPlayer2 And gdDonePlayer2 = False Then
gdDonePlayer2 = True
gdActionPlayer2 = 3
Else: ExitSub
End If

If gdDonePlayer1 = True And gdDonePlayer2 = True Then
Call gdActionChosen
End If
End Sub

Sub gdHeal(Username, Message)

If Username = gdPlayer1 And gdDonePlayer1 = False Then
gdDonePlayer1 = True
gdActionPlayer1 = 4
ElseIf Username = gdPlayer2 And gdDonePlayer2 = False Then
gdDonePlayer2 = True
gdActionPlayer2 = 4
Else: ExitSub
End If

If gdDonePlayer1 = True And gdDonePlayer2 = True Then
Call gdActionChosen
End If
End Sub

Sub gdStim(Username, Message)

If Username = gdPlayer1 And gdDonePlayer1 = False Then
gdDonePlayer1 = True
gdActionPlayer1 = 5
ElseIf Username = gdPlayer2 And gdDonePlayer2 = False Then
gdDonePlayer2 = True
gdActionPlayer2 = 5
Else: ExitSub
End If

If gdDonePlayer1 = True And gdDonePlayer2 = True Then
Call gdActionChosen
End If
End Sub

Sub gdCloak(Username, Message)

If Username = gdPlayer1 And gdDonePlayer1 = False Then
gdDonePlayer1 = True
gdActionPlayer1 = 6
ElseIf Username = gdPlayer2 And gdDonePlayer2 = False Then
gdDonePlayer2 = True
gdActionPlayer2 = 6
Else: ExitSub
End If

If gdDonePlayer1 = True And gdDonePlayer2 = True Then
Call gdActionChosen
End If
End Sub

Sub gdActionChosen()
Dim P1msg, P2msg, a
If gdActionPlayer1 = 1 Then
P1msg = gdPlayer1 & " Fires One Round At " & gdPlayer2
a = (gdGameStats1(3) + randint(1, 10)) - gdGameStats2(4)
If a >= 5 Then
P1msg = P1msg & " And Hits For Critical!!"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(3, 5))
ElseIf a >= 1 Then
P1msg = P1msg & " And Hits"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(0, 3))
ElseIf a = 0 Then
P1msg = P1msg & " And Almost Missed"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2))
ElseIf a <= -1 Then
P1msg = P1msg & " And Misses"
gdGameStats2(1) = gdGameStats2(1)
End If
ElseIf gdActionPlayer1 = 2 Then
P1msg = gdPlayer1 & " Takes Aim At " & gdPlayer2
gdGameStats1(3) = 999
ElseIf gdActionPlayer1 = 3 Then
P1msg = gdPlayer1 & " Takes Cover And Fires At " & gdPlayer2
gdGameStats1(3) = gdGameStats1(3) - 1
gdGameStats1(4) = gdGameStats1(4) + 1
a = (gdGameStats1(3) + randint(1, 10)) - gdGameStats2(4)
If a >= 5 Then
P1msg = P1msg & " And Hits For Critical!!"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(3, 5))
ElseIf a >= 1 Then
P1msg = P1msg & " And Hits"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(0, 3))
ElseIf a = 0 Then
P1msg = P1msg & " And Almost Missed"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2))
ElseIf a <= -1 Then
P1msg = P1msg & " And Misses"
gdGameStats2(1) = gdGameStats2(1)
End If
ElseIf gdActionPlayer1 = 4 Then
P1msg = gdPlayer1 & " Heals"
gdGameStats1(1) = gdGameStats1(1) + randint(1, 5)
ElseIf gdActionPlayer1 = 5 Then
P1msg = gdPlayer1 & " Fires Two Rounds At " & gdPlayer2
a = (gdGameStats1(3) + randint(1, 10)) - gdGameStats2(4)
If a >= 5 Then
P1msg = P1msg & " 1:Critical!!"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(3, 5))
ElseIf a >= 1 Then
P1msg = P1msg & " 1:Hits"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(0, 3))
ElseIf a = 0 Then
P1msg = P1msg & " 1:Almost Missed"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2))
ElseIf a <= -1 Then
P1msg = P1msg & " 1:Misses"
gdGameStats2(1) = gdGameStats2(1)
End If
a = (gdGameStats1(3) + randint(1, 10)) - gdGameStats2(4)
If a >= 5 Then
P1msg = P1msg & " 2:Critical!!"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(3, 5))
ElseIf a >= 1 Then
P1msg = P1msg & " 2:Hits"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(0, 3))
ElseIf a = 0 Then
P1msg = P1msg & " 2:Almost Missed"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2))
ElseIf a <= -1 Then
P1msg = P1msg & " 2:Misses"
gdGameStats2(1) = gdGameStats2(1)
End If
ElseIf gdActionPlayer1 = 6 Then
P1msg = gdPlayer1 & " Cloaks And Fires At " & gdPlayer2
gdGameStats1(4) = 999
a = (gdGameStats1(3) + randint(1, 10)) - gdGameStats2(4)
If a >= 5 Then
P1msg = P1msg & " 2:Critical!!"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(3, 5))
ElseIf a >= 1 Then
P1msg = P1msg & " 2:Hits"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(0, 3))
ElseIf a = 0 Then
P1msg = P1msg & " 2:Almost Missed"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2))
ElseIf a <= -1 Then
P1msg = P1msg & " 2:Misses"
gdGameStats2(1) = gdGameStats2(1)
End If
Else
P1msg = gdPlayer1 & " :gdActionChosen Error"
AddChat vbRed, "P1 gdActionPlayer1 is Incorrect", vbBlue, gdActionPlayer1
End If


If gdActionPlayer1 = 1 Then
P2msg = gdPlayer2 & " Fires One Round At " & gdPlayer1
a = (gdGameStats2(3) + randint(1, 10)) - gdGameStats1(4)
If a >= 5 Then
P2msg = P2msg & " And Hits For Critical!!"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(3, 5))
ElseIf a >= 1 Then
P2msg = P2msg & " And Hits"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(0, 3))
ElseIf a = 0 Then
P2msg = P2msg & " And Almost Missed"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2))
ElseIf a <= -1 Then
P2msg = P2msg & " And Misses"
gdGameStats1(1) = gdGameStats1(1)
End If
ElseIf gdActionPlayer2 = 2 Then
P1msg = gdPlayer2 & " Takes Aim At " & gdPlayer1
gdGameStats2(3) = 999
ElseIf gdActionPlayer2 = 3 Then
P1msg = gdPlayer2 & " Takes Cover And Fires At " & gdPlayer1
gdGameStats2(3) = gdGameStats2(3) - 1
gdGameStats2(4) = gdGameStats2(4) + 1
a = (gdGameStats1(3) + randint(1, 10)) - gdGameStats2(4)
If a >= 5 Then
P2msg = P2msg & " And Hits For Critical!!"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(3, 5))
ElseIf a >= 1 Then
P2msg = P2msg & " And Hits"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(0, 3))
ElseIf a = 0 Then
P2msg = P2msg & " And Almost Missed"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2))
ElseIf a <= -1 Then
P2msg = P2msg & " And Misses"
gdGameStats1(1) = gdGameStats1(1)
End If
ElseIf gdActionPlayer2 = 4 Then
P2msg = gdPlayer2 & " Heals"
gdGameStats1(1) = gdGameStats1(1) + randint(1, 5)
ElseIf gdActionPlayer2 = 5 Then
P2msg = gdPlayer2 & " Fires Two Rounds At " & gdPlayer1
a = (gdGameStats2(3) + randint(1, 10)) - gdGameStats1(4)
If a >= 5 Then
P2msg = P2msg & " 1:Critical!!"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(3, 5))
ElseIf a >= 1 Then
P2msg = P2msg & " 1:Hits"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(0, 3))
ElseIf a = 0 Then
P2msg = P2msg & " 1:Almost Missed"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2))
ElseIf a <= -1 Then
P2msg = P2msg & " 1:Misses"
gdGameStats1(1) = gdGameStats1(1)
End If
a = (gdGameStats2(3) + randint(1, 10)) - gdGameStats1(4)
If a >= 5 Then
P2msg = P2msg & " 2:Critical!!"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(3, 5))
ElseIf a >= 1 Then
P2msg = P2msg & " 2:Hits"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(0, 3))
ElseIf a = 0 Then
P2msg = P2msg & " 2:Almost Missed"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2))
ElseIf a <= -1 Then
P2msg = P2msg & " 2:Misses"
gdGameStats1(1) = gdGameStats1(1)
End If
ElseIf gdActionPlayer2 = 6 Then
P2msg = gdPlayer2 & " Cloaks And Fires At " & gdPlayer1
gdGameStats2(4) = 999
a = (gdGameStats2(3) + randint(1, 10)) - gdGameStats1(4)
If a >= 5 Then
P2msg = P2msg & " 2:Critical!!"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(3, 5))
ElseIf a >= 1 Then
P2msg = P2msg & " 2:Hits"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(0, 3))
ElseIf a = 0 Then
P2msg = P2msg & " 2:Almost Missed"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2))
ElseIf a <= -1 Then
P2msg = P2msg & " 2:Misses"
gdGameStats1(1) = gdGameStats1(1)
End If
Else
P2msg = gdPlayer2 & " :gdActionChosen Error"
AddChat vbRed, "P1 gdActionPlayer2 is Incorrect", vbBlue, gdActionPlayer2
End If


'// NORMALISE STATS
addq P1msg
addq P2msg

End Sub


Final Version **Until I Can Fix Loading Problem**
[codebox]'Gd
'1.1
'&Gun Duel:Cyber_Hunter
'&Duel <username>:GdStats <Username>:Fire:Aim:Cover:Heal:Stim:Cloak
'&
'&Gun Dueling Game:Lvl your Character:Increase your stats:Battle Other Players in 1vs1 Duels

'Ver: 1.1
'First Basic Script. Still Many bugs to work out, Won't work yet because of a
'loading error that i can't seem to fix. After I finally fix this the script will
'be workable. Hope that will happen soon.

Option Explicit

Public gdstats '// Holds All Player Stats
Public gdfso '// Holds fso
Public gdsaved '// Save Info On Shutdown
Public gdGameOn As Boolean '// Holds the Game Status (Game On/Off)
Public gdChallenge As Boolean '// Holds Challenge Status
Public gdDonePlayer1 As Boolean '// Holds Turn Information
Public gdDonePlayer2 As Boolean '// Holds Turn Information
Public gdLeveling As Boolean '// Sends messages directly to gdLevelUp
Public gdLvlingPlayer '// Holds Leveling Players Name
Public gdActionPlayer1 '// Holds Player Action
Public gdActionPlayer2 '// Holds Player Action
Private gdPlayer1(6) '// Holds Challengers Stats
Private gdPlayer2(6) '// Holds Other Players Stats
Private gdGameStats1(4) '// Holds InGame Stats
Private gdGameStats2(4) '// Holds InGame Stats
Private gdStatsLookup(6) '// Holds Stats for gdStats Commands



'//ACCESS (This will later be changed for use in the pluginsettings.txt file)

Const gdFilePath = "plugins\gdStats.txt" '// Stat File FilePath
Const gdDuel_Access = 0 '// Default -> 0 (No Access)


'//COMMAND NAMES (These will later be changed for use in the pluginsettings.txt file)

Const gdDuel_Command = "duel" '// Used To Challange Player.
Const gdStats_Command = "gdstats" '// Used to check stats.
Const gdFire_Command = "fire" '// Simple Attack Command.
Const gdAim_Command = "aim" '// Skip a turn for 100% Accurcy.
Const gdCover_Command = "cover" '// Increase you Evasion, Decrease your Accurcy.
Const gdHeal_Command = "heal" '// Used to heal yourself.
Const gdStim_Command = "stim" '// Used to attack twice while losing 5hp.
Const gdCloak_Command = "cloak" '// Increase your evasion for one attack.


'//LEVEL REQUIREMENT (These will later be changed for use in the pluginsettings.txt file)

Const gdFire_Level = 1 '// Default -> 1
Const gdAim_Level = 1 '// Default -> 1
Const gdCover_Level = 1 '// Default -> 1
Const gdHeal_Level = 1 '// Default -> 1
Const gdStim_Level = 5 '// Default -> 5
Const gdCloak_Level = 15 '// Default -> 15

'//OTHER USER-SELECTED VARIABLES

Const gdPointsPerKill = 5
Const gdPointsPerTie = 1


Sub gd_Event_Load()
Dim TempStr(6)
Set gdstats = CreateObject("Scripting.Dictionary")
Set gdfso = CreateObject("Scripting.FileSystemObject")

If gdfso.FileExists(gdFilePath) Then '// If File Exists, Retrieves Information
Set gdsaved = gdfso.OpenTextFile(gdFilePath, 1)
Do While Not gdsaved.AtEndOfStream
TempStr(1) = Split(gdsaved.ReadLine, " ")(0)
TempStr(2) = Split(gdsaved.ReadLine, " ")(1)
TempStr(3) = Split(gdsaved.ReadLine, " ")(2)
TempStr(4) = Split(gdsaved.ReadLine, " ")(3)
TempStr(5) = Split(gdsaved.ReadLine, " ")(4)
TempStr(6) = Split(gdsaved.ReadLine, " ")(5)
gdstats.Add TempStr(1), Array(TempStr(2), TempStr(3), TempStr(4), TempStr(5), TempStr(6))
Loop
gdsaved.Close
Set gdsaved = Nothing
Else '// If File Does Not Exists, Gives a Welcome Msg >>> The File Will Be Created With Other Subs
AddChat vbCyan, ">>>>>>>> Welcome Message Here <<<<<<<<"
End If

gdGameOn = False
gdChallenge = False
End Sub

Sub gd_Event_UserTalk(Username, Flags, Message, Ping)

GetDBEntry Username, myAccess, MyFlags

If gdLeveling = True And Username = gdLvlingPlayer Then '// Checks to see if a Player Is Leveling
Call gdLevelUp(Message)
ElseIf gdLeveling = True And Username <> gdLvlingPlayer And Left(Message, Len(BotVars.Trigger)) <> BotVars.Trigger Then '// If A Player Is Leveling, Inform Player That He Has To Wait
AddQ "/w " & Username & " I'm Helping " & gdLvlingPlayer & ". Please wait while they finish."
End If

If gdstats.Exists(Username) = False Then
gdstats.Add Username, Array("1", "1", "1", "1", "0") '// All Users in channel that talk will be added
AddQ "/whisper " & psd2 & Username & " You have been added to the Gun Duel Player List."
End If

If Left(Message, Len(BotVars.Trigger)) <> BotVars.Trigger Then Exit Sub

If Left(LCase(massage), Len(gdDuel_Command) + 1) = BotVars.Trigger & gdDuel_Command And myAccess >= gdDuel_Access Then
User = Split(Mid(LCase(Trim(Message)), 2), " ")
msgUsername = User(1)
Call gdDuel(Username, Message)
If Left(LCase(massage), Len(gdStats_Command) + 1) = BotVars.Trigger & LCase(gdStats_Command) And myAccess >= gdDuel_Access Then
User = Split(Mid(LCase(Trim(Message)), 2), " ")
msgUsername = User(1)
Call gdStatReturn(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdFire_Command And myAccess >= gdDuel_Access Then
Call gdFire(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdAim_Command And myAccess >= gdDuel_Access Then
Call gdAim(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdCover_Command And myAccess >= gdDuel_Access Then
Call gdCover(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdHeal_Command And myAccess >= gdDuel_Access Then
Call gdHeal(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdStim_Command And myAccess >= gdDuel_Access Then
Call gdStim(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdCloak_Command And myAccess >= gdDuel_Access Then
Call gdCloak(Username, Message)
End If
End Sub

Sub gd_Event_WhisperFromUser(Username, Flags, Message, Ping)
GetDBEntry Username, myAccess, MyFlags

If gdstats.Exists(Username) = False Then
gdstats.Add Username, Array(1, 1, 1, 1, 0) '// All Users in channel that talk will be added
AddQ "/whisper " & psd2 & Username & " You have been added to the Gun Duel Player List."
End If

If Left(Message, Len(BotVars.Trigger)) <> BotVars.Trigger Then Exit Sub

If Left(LCase(massage), Len(gdDuel_Command) + 1) = BotVars.Trigger & gdDuel_Command And myAccess >= gdDuel_Access Then
User = Split(Mid(LCase(Trim(Message)), 2), " ")
msgUsername = User(1)
Call gdDuel(Username, Message)
If Left(LCase(massage), Len(gdStats_Command) + 1) = BotVars.Trigger & LCase(gdStats_Command) And myAccess >= gdDuel_Access Then
User = Split(Mid(LCase(Trim(Message)), 2), " ")
msgUsername = User(1)
Call gdStatReturn(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & LCase(gdFire_Command And myAccess) >= gdDuel_Access Then
Call gdFire(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & LCase(gdAim_Command And myAccess) >= gdDuel_Access Then
Call gdAim(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & LCase(gdCover_Command And myAccess) >= gdDuel_Access Then
Call gdCover(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & LCase(gdHeal_Command And myAccess) >= gdDuel_Access Then
Call gdHeal(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & LCase(gdStim_Command And myAccess) >= gdDuel_Access Then
Call gdStim(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & LCase(gdCloak_Command And myAccess) >= gdDuel_Access Then
Call gdCloak(Username, Message)
End If

If gdChallenge = True And Username = msgUsername And LCase(Message) = "yes" Then '// Player Has Accepted Challenge, Store All Needed Info For The Match
gdGameOn = True
gdPlayer1(2) = gdstats.Item(gdPlayer1(1))(1) '// Stores Player1's Level
gdPlayer1(3) = gdstats.Item(gdPlayer1(1))(2) '// Stores Player1's Attack
gdPlayer1(4) = gdstats.Item(gdPlayer1(1))(3) '// Stores Player1's Accurcy
gdPlayer1(5) = gdstats.Item(gdPlayer1(1))(4) '// Stores Player1's Evasion
gdPlayer1(6) = gdstats.Item(gdPlayer1(1))(5) '// Stores Player1's Exp (%)
gdPlayer2(2) = gdstats.Item(gdPlayer2(1))(1) '// Stores Player2's Level
gdPlayer2(3) = gdstats.Item(gdPlayer2(1))(2) '// Stores Player2's Attack
gdPlayer2(4) = gdstats.Item(gdPlayer2(1))(3) '// Stores Player2's Accurcy
gdPlayer2(5) = gdstats.Item(gdPlayer2(1))(4) '// Stores Player2's Evasion
gdPlayer2(6) = gdstats.Item(gdPlayer2(1))(5) '// Stores Player2's Exp (%)
gdGameStats1(1) = gdPlayer1(2) * 10 '// Stores InGame HP
gdGameStats1(2) = gdPlayer1(3) '// Stores InGame Attack
gdGameStats1(3) = gdPlayer1(4) '// Stores InGame Accurcy
gdGameStats1(4) = gdPlayer1(5) '// Stores InGame Evasion
gdGameStats2(1) = gdPlayer1(2) * 10 '// Stores InGame HP
gdGameStats2(2) = gdPlayer1(3) '// Stores InGame Attack
gdGameStats2(3) = gdPlayer1(4) '// Stores InGame Accurcy
gdGameStats2(4) = gdPlayer1(5) '// Stores InGame Evasion
AddQ "A Duel Has Started Between " & gdPlayer1(1) & "(Level " & gdPlayer1(2) & ") And " & gdPlayer2(1) & "(Level " & gdPlayer2(2) & ")"
ElseIf gdChallenge = True And Username = msgUsername A
Samsunait
Can you repost the final version?
I think there are problems, it isn't codeboxed and finished
cyber_hunter
CODE
'Gd
'1.1
'&Gun Duel:Cyber_Hunter
'&Duel <username>:GdStats <Username>:Fire:Aim:Cover:Heal:Stim:Cloak
'&
'&Gun Dueling Game:Lvl your Character:Increase your stats:Battle Other Players in 1vs1 Duels

'Ver: 1.1
'First Basic Script. Still Many bugs to work out, Won't work yet because of a
'loading error that i can't seem to fix. After I finally fix this the script will
'be workable. Hope that will happen soon.

Option Explicit

Public gdstats '// Holds All Player Stats
Public gdfso '// Holds fso
Public gdsaved '// Save Info On Shutdown
Public gdGameOn As Boolean '// Holds the Game Status (Game On/Off)
Public gdChallenge As Boolean '// Holds Challenge Status
Public gdDonePlayer1 As Boolean '// Holds Turn Information
Public gdDonePlayer2 As Boolean '// Holds Turn Information
Public gdLeveling As Boolean '// Sends messages directly to gdLevelUp
Public gdLvlingPlayer '// Holds Leveling Players Name
Public gdActionPlayer1 '// Holds Player Action
Public gdActionPlayer2 '// Holds Player Action
Private gdPlayer1(6) '// Holds Challengers Stats
Private gdPlayer2(6) '// Holds Other Players Stats
Private gdGameStats1(4) '// Holds InGame Stats
Private gdGameStats2(4) '// Holds InGame Stats
Private gdStatsLookup(6) '// Holds Stats for gdStats Commands



'//ACCESS (This will later be changed for use in the pluginsettings.txt file)

Const gdFilePath = "plugins\gdStats.txt" '// Stat File FilePath
Const gdDuel_Access = 0 '// Default -> 0 (No Access)


'//COMMAND NAMES (These will later be changed for use in the pluginsettings.txt file)

Const gdDuel_Command = "duel" '// Used To Challange Player.
Const gdStats_Command = "gdstats" '// Used to check stats.
Const gdFire_Command = "fire" '// Simple Attack Command.
Const gdAim_Command = "aim" '// Skip a turn for 100% Accurcy.
Const gdCover_Command = "cover" '// Increase you Evasion, Decrease your Accurcy.
Const gdHeal_Command = "heal" '// Used to heal yourself.
Const gdStim_Command = "stim" '// Used to attack twice while losing 5hp.
Const gdCloak_Command = "cloak" '// Increase your evasion for one attack.


'//LEVEL REQUIREMENT (These will later be changed for use in the pluginsettings.txt file)

Const gdFire_Level = 1 '// Default -> 1
Const gdAim_Level = 1 '// Default -> 1
Const gdCover_Level = 1 '// Default -> 1
Const gdHeal_Level = 1 '// Default -> 1
Const gdStim_Level = 5 '// Default -> 5
Const gdCloak_Level = 15 '// Default -> 15

'//OTHER USER-SELECTED VARIABLES

Const gdPointsPerKill = 5
Const gdPointsPerTie = 1


Sub gd_Event_Load()
Dim TempStr(6)
Set gdstats = CreateObject("Scripting.Dictionary")
Set gdfso = CreateObject("Scripting.FileSystemObject")

If gdfso.FileExists(gdFilePath) Then '// If File Exists, Retrieves Information
Set gdsaved = gdfso.OpenTextFile(gdFilePath, 1)
Do While Not gdsaved.AtEndOfStream
TempStr(1) = Split(gdsaved.ReadLine, " ")(0)
TempStr(2) = Split(gdsaved.ReadLine, " ")(1)
TempStr(3) = Split(gdsaved.ReadLine, " ")(2)
TempStr(4) = Split(gdsaved.ReadLine, " ")(3)
TempStr(5) = Split(gdsaved.ReadLine, " ")(4)
TempStr(6) = Split(gdsaved.ReadLine, " ")(5)
gdstats.Add TempStr(1), Array(TempStr(2), TempStr(3), TempStr(4), TempStr(5), TempStr(6))
Loop
gdsaved.Close
Set gdsaved = Nothing
Else '// If File Does Not Exists, Gives a Welcome Msg >>> The File Will Be Created With Other Subs
AddChat vbCyan, ">>>>>>>> Welcome Message Here <<<<<<<<"
End If

gdGameOn = False
gdChallenge = False
End Sub

Sub gd_Event_UserTalk(Username, Flags, Message, Ping)

GetDBEntry Username, myAccess, MyFlags

If gdLeveling = True And Username = gdLvlingPlayer Then '// Checks to see if a Player Is Leveling
Call gdLevelUp(Message)
ElseIf gdLeveling = True And Username <> gdLvlingPlayer And Left(Message, Len(BotVars.Trigger)) <> BotVars.Trigger Then '// If A Player Is Leveling, Inform Player That He Has To Wait
AddQ "/w " & Username & " I'm Helping " & gdLvlingPlayer & ". Please wait while they finish."
End If

If gdstats.Exists(Username) = False Then
gdstats.Add Username, Array("1", "1", "1", "1", "0") '// All Users in channel that talk will be added
AddQ "/whisper " & psd2 & Username & " You have been added to the Gun Duel Player List."
End If

If Left(Message, Len(BotVars.Trigger)) <> BotVars.Trigger Then Exit Sub

If Left(LCase(massage), Len(gdDuel_Command) + 1) = BotVars.Trigger & gdDuel_Command And myAccess >= gdDuel_Access Then
User = Split(Mid(LCase(Trim(Message)), 2), " ")
msgUsername = User(1)
Call gdDuel(Username, Message)
If Left(LCase(massage), Len(gdStats_Command) + 1) = BotVars.Trigger & LCase(gdStats_Command) And myAccess >= gdDuel_Access Then
User = Split(Mid(LCase(Trim(Message)), 2), " ")
msgUsername = User(1)
Call gdStatReturn(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdFire_Command And myAccess >= gdDuel_Access Then
Call gdFire(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdAim_Command And myAccess >= gdDuel_Access Then
Call gdAim(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdCover_Command And myAccess >= gdDuel_Access Then
Call gdCover(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdHeal_Command And myAccess >= gdDuel_Access Then
Call gdHeal(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdStim_Command And myAccess >= gdDuel_Access Then
Call gdStim(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdCloak_Command And myAccess >= gdDuel_Access Then
Call gdCloak(Username, Message)
End If
End Sub

Sub gd_Event_WhisperFromUser(Username, Flags, Message, Ping)
GetDBEntry Username, myAccess, MyFlags

If gdstats.Exists(Username) = False Then
gdstats.Add Username, Array(1, 1, 1, 1, 0) '// All Users in channel that talk will be added
AddQ "/whisper " & psd2 & Username & " You have been added to the Gun Duel Player List."
End If

If Left(Message, Len(BotVars.Trigger)) <> BotVars.Trigger Then Exit Sub

If Left(LCase(massage), Len(gdDuel_Command) + 1) = BotVars.Trigger & gdDuel_Command And myAccess >= gdDuel_Access Then
User = Split(Mid(LCase(Trim(Message)), 2), " ")
msgUsername = User(1)
Call gdDuel(Username, Message)
If Left(LCase(massage), Len(gdStats_Command) + 1) = BotVars.Trigger & LCase(gdStats_Command) And myAccess >= gdDuel_Access Then
User = Split(Mid(LCase(Trim(Message)), 2), " ")
msgUsername = User(1)
Call gdStatReturn(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & LCase(gdFire_Command And myAccess) >= gdDuel_Access Then
Call gdFire(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & LCase(gdAim_Command And myAccess) >= gdDuel_Access Then
Call gdAim(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & LCase(gdCover_Command And myAccess) >= gdDuel_Access Then
Call gdCover(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & LCase(gdHeal_Command And myAccess) >= gdDuel_Access Then
Call gdHeal(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & LCase(gdStim_Command And myAccess) >= gdDuel_Access Then
Call gdStim(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & LCase(gdCloak_Command And myAccess) >= gdDuel_Access Then
Call gdCloak(Username, Message)
End If

If gdChallenge = True And Username = msgUsername And LCase(Message) = "yes" Then '// Player Has Accepted Challenge, Store All Needed Info For The Match
gdGameOn = True
gdPlayer1(2) = gdstats.Item(gdPlayer1(1))(1) '// Stores Player1's Level
gdPlayer1(3) = gdstats.Item(gdPlayer1(1))(2) '// Stores Player1's Attack
gdPlayer1(4) = gdstats.Item(gdPlayer1(1))(3) '// Stores Player1's Accurcy
gdPlayer1(5) = gdstats.Item(gdPlayer1(1))(4) '// Stores Player1's Evasion
gdPlayer1(6) = gdstats.Item(gdPlayer1(1))(5) '// Stores Player1's Exp (%)
gdPlayer2(2) = gdstats.Item(gdPlayer2(1))(1) '// Stores Player2's Level
gdPlayer2(3) = gdstats.Item(gdPlayer2(1))(2) '// Stores Player2's Attack
gdPlayer2(4) = gdstats.Item(gdPlayer2(1))(3) '// Stores Player2's Accurcy
gdPlayer2(5) = gdstats.Item(gdPlayer2(1))(4) '// Stores Player2's Evasion
gdPlayer2(6) = gdstats.Item(gdPlayer2(1))(5) '// Stores Player2's Exp (%)
gdGameStats1(1) = gdPlayer1(2) * 10 '// Stores InGame HP
gdGameStats1(2) = gdPlayer1(3) '// Stores InGame Attack
gdGameStats1(3) = gdPlayer1(4) '// Stores InGame Accurcy
gdGameStats1(4) = gdPlayer1(5) '// Stores InGame Evasion
gdGameStats2(1) = gdPlayer1(2) * 10 '// Stores InGame HP
gdGameStats2(2) = gdPlayer1(3) '// Stores InGame Attack
gdGameStats2(3) = gdPlayer1(4) '// Stores InGame Accurcy
gdGameStats2(4) = gdPlayer1(5) '// Stores InGame Evasion
AddQ "A Duel Has Started Between " & gdPlayer1(1) & "(Level " & gdPlayer1(2) & ") And " & gdPlayer2(1) & "(Level " & gdPlayer2(2) & ")"
ElseIf gdChallenge = True And Username = msgUsername And LCase(Message) = "no" Then
AddQ Username & " has refused the Duel Challenge."
End If
End Sub

Sub gd_Event_Close()
Dim TempStr

Set gdsaved = gdfso.OpenTextFile(filepath, 2, True)
For Each Key In gdstats.Keys '// Puts All info into a file
TempStr = Key & " " & gdstats.Item(Key)(1) & " " & gdstats.Item(Key)(2) & " " & gdstats.Item(Key)(3) & " " & gdstats.Item(Key)(4) & " " & gdstats.Item(Key)(5)
gdsaved.WriteLine TempStr
Next
gdsaved.Close
Set gdsaved = Nothing
End Sub

Sub gdDuel(Username, Message)

If gdGameOn = True Then '// Checks for current duels
AddQ "/whisper" & " " & psd2 & Username & " a duel is currently in progress. Please wait for this duel to end."
Exit Sub
End If

If GetPositionByName(msgUsername) = -1 Then '// Checks for user in channel
AddQ "/whisper " & psd2 & Username & " " & msgUsername & " is not currently in the channel."
Exit Sub
Else

AddQ "/whisper " & psd2 & msgUsername & " " & Username & " has challenged you to a duel."
AddQ "/whisper " & psd2 & msgUsername & "Whisper me 'Yes' or 'NO'."
gdChallenge = True
gdPlayer1(1) = Username
gdPlayer2(1) = msgUsername

End Sub

Sub gdStatReturn(Username, Message)

If LCase(msgUsername) = "me" Then '// Change Username Incase of "me"
msgUsername = Username
End If
If gdstats.Exists(msgUsername) = False Then '// Checks for user in dictionary
AddQ "/whisper " & Username & " This Player does not exist."
Exit Sub
Else
gdStatsLookup(1) = gdstats.Item(msgUsername)(1)
gdStatsLookup(2) = gdstats.Item(msgUsername)(2)
gdStatsLookup(3) = gdstats.Item(msgUsername)(3)
gdStatsLookup(4) = gdstats.Item(msgUsername)(4)
gdStatsLookup(5) = gdstats.Item(msgUsername)(5)
gdStatsLookup(6) = gdstats.Item(msgUsername)(6)
AddQ "/whisper " & Username & " " & gdStatsLookup(1) & " Level:" & gdStatsLookup(2) & " Attack:" & gdStatsLookup(3) & " Accurcy:" & gdStatsLookup(4) & " Evasion:" & gdStatsLookup(5) & " Experience(%):" & gdStatsLookup(6)
End If
End Sub

Sub gdFire(Username, Message)

If gdstats.Item(Username)(1) < gdFire_Level Then
AddQ "/w " & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1 And gdDonePlayer1 = False Then
gdDonePlayer1 = True
gdActionPlayer1 = 1
ElseIf Username = gdPlayer2 And gdDonePlayer2 = False Then
gdDonePlayer2 = True
gdActionPlayer2 = 1
Else: exitSub
End If

If gdDonePlayer1 = True And gdDonePlayer2 = True Then
Call gdActionChosen
End If
End Sub

Sub gdAim(Username, Message)

If gdstats.Item(Username)(1) < gdAim_Level Then
AddQ "/w " & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1 And gdDonePlayer1 = False Then
gdDonePlayer1 = True
gdActionPlayer1 = 2
ElseIf Username = gdPlayer2 And gdDonePlayer2 = False Then
gdDonePlayer2 = True
gdActionPlayer2 = 2
Else: exitSub
End If

If gdDonePlayer1 = True And gdDonePlayer2 = True Then
Call gdActionChosen
End If
End Sub

Sub gdCover(Username, Message)

If gdstats.Item(Username)(1) < gdCover_Level Then
AddQ "/w " & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1 And gdDonePlayer1 = False Then
gdDonePlayer1 = True
gdActionPlayer1 = 3
ElseIf Username = gdPlayer2 And gdDonePlayer2 = False Then
gdDonePlayer2 = True
gdActionPlayer2 = 3
Else: exitSub
End If

If gdDonePlayer1 = True And gdDonePlayer2 = True Then
Call gdActionChosen
End If
End Sub

Sub gdHeal(Username, Message)

If gdstats.Item(Username)(1) < gdHeal_Level Then
AddQ "/w " & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1 And gdDonePlayer1 = False Then
gdDonePlayer1 = True
gdActionPlayer1 = 4
ElseIf Username = gdPlayer2 And gdDonePlayer2 = False Then
gdDonePlayer2 = True
gdActionPlayer2 = 4
Else: exitSub
End If

If gdDonePlayer1 = True And gdDonePlayer2 = True Then
Call gdActionChosen
End If
End Sub

Sub gdStim(Username, Message)

If gdstats.Item(Username)(1) < gdStim_Level Then
AddQ "/w " & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1 And gdDonePlayer1 = False Then
gdDonePlayer1 = True
gdActionPlayer1 = 5
ElseIf Username = gdPlayer2 And gdDonePlayer2 = False Then
gdDonePlayer2 = True
gdActionPlayer2 = 5
Else: exitSub
End If

If gdDonePlayer1 = True And gdDonePlayer2 = True Then
Call gdActionChosen
End If
End Sub

Sub gdCloak(Username, Message)

If gdstats.Item(Username)(1) < gdCloak_Level Then
AddQ "/w " & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1 And gdDonePlayer1 = False Then
gdDonePlayer1 = True
gdActionPlayer1 = 6
ElseIf Username = gdPlayer2 And gdDonePlayer2 = False Then
gdDonePlayer2 = True
gdActionPlayer2 = 6
Else: exitSub
End If

If gdDonePlayer1 = True And gdDonePlayer2 = True Then
Call gdActionChosen
End If
End Sub

Sub gdActionChosen()
Dim P1msg, P2msg, a
If gdActionPlayer1 = 1 Then
P1msg = gdPlayer1 & " Fires One Round At " & gdPlayer2
a = (gdGameStats1(3) + randint(1, 5)) - gdGameStats2(4)
If a >= 5 Then
P1msg = P1msg & " And Hits For Critical!!"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(3, 5))
ElseIf a >= 1 Then
P1msg = P1msg & " And Hits"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(0, 3))
ElseIf a = 0 Then
P1msg = P1msg & " And Almost Missed"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2))
ElseIf a <= -1 Then
P1msg = P1msg & " And Misses"
gdGameStats2(1) = gdGameStats2(1)
End If
gdGameStats1(3) = gdPlayer1(4)
gdGameStats1(4) = gdPlayer1(5)
ElseIf gdActionPlayer1 = 2 Then
P1msg = gdPlayer1 & " Takes Aim At " & gdPlayer2
gdGameStats1(3) = 999
gdGameStats1(4) = gdPlayer1(5)
ElseIf gdActionPlayer1 = 3 Then
P1msg = gdPlayer1 & " Takes Cover And Fires At " & gdPlayer2
gdGameStats1(3) = gdPlayer1(4) - 1
gdGameStats1(4) = gdPlayer1(5) + 1
a = (gdGameStats1(3) + randint(1, 5)) - gdGameStats2(4)
If a >= 5 Then
P1msg = P1msg & " And Hits For Critical!!"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(3, 5))
ElseIf a >= 1 Then
P1msg = P1msg & " And Hits"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(0, 3))
ElseIf a = 0 Then
P1msg = P1msg & " And Almost Missed"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2))
ElseIf a <= -1 Then
P1msg = P1msg & " And Misses"
gdGameStats2(1) = gdGameStats2(1)
End If
ElseIf gdActionPlayer1 = 4 Then
P1msg = gdPlayer1 & " Heals"
gdGameStats1(1) = gdGameStats1(1) + randint(1, 5)
gdGameStats1(3) = gdPlayer1(4)
gdGameStats1(4) = gdPlayer1(5)
ElseIf gdActionPlayer1 = 5 Then
P1msg = gdPlayer1 & " Fires Two Rounds At " & gdPlayer2
gdGameStats1(1) = gdGameStats1(1) - 4
a = (gdGameStats1(3) + randint(1, 5)) - gdGameStats2(4)
If a >= 5 Then
P1msg = P1msg & " 1:Critical!!"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(3, 5))
ElseIf a >= 1 Then
P1msg = P1msg & " 1:Hits"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(0, 3))
ElseIf a = 0 Then
P1msg = P1msg & " 1:Almost Missed"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2))
ElseIf a <= -1 Then
P1msg = P1msg & " 1:Misses"
gdGameStats2(1) = gdGameStats2(1)
End If
a = (gdGameStats1(3) + randint(1, 5)) - gdGameStats2(4)
If a >= 5 Then
P1msg = P1msg & " 2:Critical!!"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(3, 5))
ElseIf a >= 1 Then
P1msg = P1msg & " 2:Hits"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(0, 3))
ElseIf a = 0 Then
P1msg = P1msg & " 2:Almost Missed"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2))
ElseIf a <= -1 Then
P1msg = P1msg & " 2:Misses"
gdGameStats2(1) = gdGameStats2(1)
End If
gdGameStats1(3) = gdPlayer1(4)
gdGameStats1(4) = gdPlayer1(5)
ElseIf gdActionPlayer1 = 6 Then
P1msg = gdPlayer1 & " Cloaks And Fires At " & gdPlayer2
gdGameStats1(4) = 999
a = (gdGameStats1(3) + randint(1, 5)) - gdGameStats2(4)
If a >= 5 Then
P1msg = P1msg & " 2:Critical!!"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(3, 5))
ElseIf a >= 1 Then
P1msg = P1msg & " 2:Hits"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(0, 3))
ElseIf a = 0 Then
P1msg = P1msg & " 2:Almost Missed"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2))
ElseIf a <= -1 Then
P1msg = P1msg & " 2:Misses"
gdGameStats2(1) = gdGameStats2(1)
End If
gdGameStats1(3) = gdPlayer1(4)
Else
P1msg = gdPlayer1 & " :gdActionChosen Error"
AddChat vbRed, "P1 gdActionPlayer1 is Incorrect", vbBlue, gdActionPlayer1
End If


If gdActionPlayer2 = 1 Then
P2msg = gdPlayer2 & " Fires One Round At " & gdPlayer1
a = (gdGameStats2(3) + randint(1, 5)) - gdGameStats1(4)
If a >= 5 Then
P2msg = P2msg & " And Hits For Critical!!"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(3, 5))
ElseIf a >= 1 Then
P2msg = P2msg & " And Hits"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(0, 3))
ElseIf a = 0 Then
P2msg = P2msg & " And Almost Missed"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2))
ElseIf a <= -1 Then
P2msg = P2msg & " And Misses"
gdGameStats1(1) = gdGameStats1(1)
End If
gdGameStats2(3) = gdPlayer2(4)
gdGameStats2(4) = gdPlayer2(5)
ElseIf gdActionPlayer2 = 2 Then
P1msg = gdPlayer2 & " Takes Aim At " & gdPlayer1
gdGameStats2(3) = 999
gdGameStats2(4) = gdPlayer2(5)
ElseIf gdActionPlayer2 = 3 Then
P1msg = gdPlayer2 & " Takes Cover And Fires At " & gdPlayer1
gdGameStats2(3) = gdPlayer2(4) - 1
gdGameStats2(4) = gdPlayer2(5) + 1
a = (gdGameStats1(3) + randint(1, 5)) - gdGameStats2(4)
If a >= 5 Then
P2msg = P2msg & " And Hits For Critical!!"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(3, 5))
ElseIf a >= 1 Then
P2msg = P2msg & " And Hits"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(0, 3))
ElseIf a = 0 Then
P2msg = P2msg & " And Almost Missed"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2))
ElseIf a <= -1 Then
P2msg = P2msg & " And Misses"
gdGameStats1(1) = gdGameStats1(1)
End If
ElseIf gdActionPlayer2 = 4 Then
P2msg = gdPlayer2 & " Heals"
gdGameStats1(1) = gdGameStats1(1) + randint(1, 5)
gdGameStats2(3) = gdPlayer2(4)
gdGameStats2(4) = gdPlayer2(5)
ElseIf gdActionPlayer2 = 5 Then
P2msg = gdPlayer2 & " Fires Two Rounds At " & gdPlayer1
gdGameStats2(1) = gdGameStats2(1) - 4
a = (gdGameStats2(3) + randint(1, 5)) - gdGameStats1(4)
If a >= 5 Then
P2msg = P2msg & " 1:Critical!!"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(3, 5))
ElseIf a >= 1 Then
P2msg = P2msg & " 1:Hits"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(0, 3))
ElseIf a = 0 Then
P2msg = P2msg & " 1:Almost Missed"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2))
ElseIf a <= -1 Then
P2msg = P2msg & " 1:Misses"
gdGameStats1(1) = gdGameStats1(1)
End If
a = (gdGameStats2(3) + randint(1, 5)) - gdGameStats1(4)
If a >= 5 Then
P2msg = P2msg & " 2:Critical!!"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(3, 5))
ElseIf a >= 1 Then
P2msg = P2msg & " 2:Hits"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(0, 3))
ElseIf a = 0 Then
P2msg = P2msg & " 2:Almost Missed"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2))
ElseIf a <= -1 Then
P2msg = P2msg & " 2:Misses"
gdGameStats1(1) = gdGameStats1(1)
End If
gdGameStats2(3) = gdPlayer2(4)
gdGameStats2(4) = gdPlayer2(5)
ElseIf gdActionPlayer2 = 6 Then
P2msg = gdPlayer2 & " Cloaks And Fires At " & gdPlayer1
gdGameStats2(4) = 999
a = (gdGameStats2(3) + randint(1, 5)) - gdGameStats1(4)
If a >= 5 Then
P2msg = P2msg & " 2:Critical!!"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(3, 5))
ElseIf a >= 1 Then
P2msg = P2msg & " 2:Hits"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(0, 3))
ElseIf a = 0 Then
P2msg = P2msg & " 2:Almost Missed"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2))
ElseIf a <= -1 Then
P2msg = P2msg & " 2:Misses"
gdGameStats1(1) = gdGameStats1(1)
End If
gdGameStats2(3) = gdPlayer2(4)
Else
P2msg = gdPlayer2 & " :gdActionChosen Error"
AddChat vbRed, "P1 gdActionPlayer2 is Incorrect", vbBlue, gdActionPlayer2
End If
AddQ P1msg
AddQ P2msg

If gdGameStats1(1) <= 0 Then
gdPlayer1(6) = gdPlayer1(6) + 5
AddChat gdPlayer1(1) & " Has Killed " & gdPlayer2(1)
gdGameOn = False
gdChallenge = False
If gdPlayer1(6) >= 100 Then Call gdLevelUp
Call gd_Event_Close
ElseIf gdGameStats2(1) <= 0 Then
gdPlayer2(6) = gdPlayer2(6) + 5
AddChat gdPlayer2(1) & " Has Killed " & gdPlayer1(1)
gdGameOn = False
gdChallenge = False
If gdPlayer2(6) >= 100 Then Call gdLevelUp
Call gd_Event_Close
ElseIf gdGameStats1(1) <= 0 And gdGameStats2(1) = 0 Then
gdPlayer2(6) = gdPlayer2(6) + 1
gdPlayer1(6) = gdPlayer1(6) + 1
AddChat gdPlayer2(1) & " And " & gdPlayer1(1) & " Have Killed Eachother!!!"
gdGameOn = False
gdChallenge = False
If gdPlayer1(6) >= 100 Then Call gdLevelUp
If gdPlayer2(6) >= 100 Then Call gdLevelUp
Call gd_Event_Close
End If
End Sub

Sub gdLevelUp(Message)
gdPlayer1(2) = gdstats.Item(gdPlayer1(1))(1) '// Stores Player1's Level
gdPlayer1(6) = gdstats.Item(gdPlayer1(1))(5) '// Stores Player1's Exp (%)
gdPlayer2(2) = gdstats.Item(gdPlayer2(1))(1) '// Stores Player2's Level
gdPlayer2(6) = gdstats.Item(gdPlayer2(1))(5) '// Stores Player2's Exp (%)

If gdPlayer1(6) >= 100 Then
gdPlayer1(2) = gdPlayer1(2) + 1
gdPlayer1(6) = gdPlayer1(6) - 100
AddQ "/w " & gdPlayer1(1) & " You Have Leveled, Please tell me which stat you would like to upgrade. Atk, Acc, Eva"
gdLeveling = True
gdLvlingPlayer = gdPlayer1(1)
Exit Sub '// Wait For User Input
ElseIf gdPlayer2(6) >= 100 Then
gdPlayer2(2) = gdPlayer2(2) + 1
gdPlayer2(6) = gdPlayer2(6) - 100
AddQ "/w " & gdPlayer2(1) & " You Have Leveled, Please tell me which stat you would like to upgrade. Atk, Acc, Eva"
gdLeveling = True
gdLvlingPlayer = gdPlayer2(1)
Exit Sub '// Wait For User Input
End If

If gdLeveling = False Then Exit Sub

If gdLeveling = True And Message = Atk Then
gdstats.Item(gdLvlingPlayer)(2) = gdstats.Item(gdLvlingPlayer)(2) + 1
gdLeveling = False
AddQ "/w " & gdLvlingPlayer & " Thank You For Making Your Selection. Succesfully Increased Atk By ONE."
Exit Sub
ElseIf gdLeveling = True And Message = Acc Then
gdstats.Item(gdLvlingPlayer)(3) = gdstats.Item(gdLvlingPlayer)(3) + 1
gdLeveling = False
AddQ "/w " & gdLvlingPlayer & " Thank You For Making Your Selection. Succesfully Increased Acc By ONE."
Exit Sub
ElseIf gdLeveling = True And Message = Eva Then
gdstats.Item(gdLvlingPlayer)(4) = gdstats.Item(gdLvlingPlayer)(4) + 1
gdLeveling = False
AddQ "/w " & gdLvlingPlayer & " Thank You For Making Your Selection. Succesfully Increased Eva By ONE."
Exit Sub
ElseIf gdLeveling = True Then
AddQ "/w " & gdLvlingPlayer & " Your Selection is Incorrect: " & Message & ". Please Try Again."
Exit Sub
End If
End Sub


Final Version **Until I Can Fix Loading Problem**

If you know how to fix, Plz help me out on this one.
cyber_hunter
Ok, I fixed the problems that where causing the error, now the bot doesn't receive errors, but i'm sure there will be more errors to sort out later.

CODE
'gd
'1.2
'&Gun Duel:Cyber_Hunter
'&Duel <username>:GdStats <Username>:Fire:Aim:Cover:Heal:Stim:Cloak
'&
'&Gun Dueling Game:Lvl your Character:Increase your stats:Battle Other Players in 1vs1 Duels

'Ver: 1.2
'Ok, at least now the script doesn't give error messages, but the problem is it won't
'do much at all. The commands dont't work but I know that the bot is going through the
'subs. Need to figure out what stoping the commands from being executed.

'Ver: 1.1
'First Basic Script. Still Many bugs to work out, Won't work yet because of a
'loading error that i can't seem to fix. After I finally fix this the script will
'be workable. Hope that will happen soon.

Public gdstats '// Holds All Player Stats
Public gdfso '// Holds fso
Public gdsaved '// Save Info On Shutdown
Public gdGameOn '// Holds the Game Status (Game On/Off)
Public gdChallenge '// Holds Challenge Status
Public gdDonePlayer1 '// Holds Turn Information
Public gdDonePlayer2 '// Holds Turn Information
Public gdLeveling '// Sends messages directly to gdLevelUp
Public gdLvlingPlayer '// Holds Leveling Players Name
Public gdActionPlayer1 '// Holds Player Action
Public gdActionPlayer2 '// Holds Player Action
Private gdPlayer1(6) '// Holds Challengers Stats
Private gdPlayer2(6) '// Holds Other Players Stats
Private gdGameStats1(4) '// Holds InGame Stats
Private gdGameStats2(4) '// Holds InGame Stats
Private gdStatsLookup(6) '// Holds Stats for gdStats Commands
Public gdFilePath '// Stat File FilePath


'//ACCESS (This will later be changed for use in the pluginsettings.txt file)

Const gdDuel_Access = 0 '// Default -> 0 (No Access)


'//COMMAND NAMES (These will later be changed for use in the pluginsettings.txt file)

Const gdDuel_Command = "duel" '// Used To Challange Player.
Const gdStats_Command = "gdstats" '// Used to check stats.
Const gdFire_Command = "fire" '// Simple Attack Command.
Const gdAim_Command = "aim" '// Skip a turn for 100% Accurcy.
Const gdCover_Command = "cover" '// Increase you Evasion, Decrease your Accurcy.
Const gdHeal_Command = "heal" '// Used to heal yourself.
Const gdStim_Command = "stim" '// Used to attack twice while losing 5hp.
Const gdCloak_Command = "cloak" '// Increase your evasion for one attack.


'//LEVEL REQUIREMENT (These will later be changed for use in the pluginsettings.txt file)

Const gdFire_Level = 1 '// Default -> 1
Const gdAim_Level = 1 '// Default -> 1
Const gdCover_Level = 1 '// Default -> 1
Const gdHeal_Level = 1 '// Default -> 1
Const gdStim_Level = 5 '// Default -> 5
Const gdCloak_Level = 15 '// Default -> 15

'//OTHER USER-SELECTED VARIABLES

Const gdPointsPerKill = 5
Const gdPointsPerTie = 1

Sub gd_event_Load()
Dim TempStr(6)
gdFilePath = BotPath & "plugins\gdStats.txt"
Set gdstats = CreateObject("Scripting.Dictionary")
Set gdfso = CreateObject("Scripting.FileSystemObject")

If gdfso.FileExists(gdFilePath) Then '// If File Exists, Retrieves Information
Set gdsaved = gdfso.OpenTextFile(gdFilePath, 1)
Do While Not gdsaved.AtEndOfStream
TempStr(1) = Split(gdsaved.ReadLine, " ")(0)
TempStr(2) = Split(gdsaved.ReadLine, " ")(1)
TempStr(3) = Split(gdsaved.ReadLine, " ")(2)
TempStr(4) = Split(gdsaved.ReadLine, " ")(3)
TempStr(5) = Split(gdsaved.ReadLine, " ")(4)
TempStr(6) = Split(gdsaved.ReadLine, " ")(5)
gdstats.Add TempStr(1), Array(TempStr(2), TempStr(3), TempStr(4), TempStr(5), TempStr(6))
Loop
gdsaved.Close
Set gdsaved = Nothing
Else '// If File Does Not Exists, Gives a Welcome Msg >>> The File Will Be Created With Other Subs
AddChat vbCyan, ">>>>>>>> Welcome Message Here <<<<<<<<"
End If

gdGameOn = "False"
gdChallenge = "False"
End Sub



Sub gd_event_UserTalk(Username, Flags, Message, Ping)

Dim MyAccess, MyFlags, msgUsername
GetDBEntry Username, MyAccess, MyFlags

If gdstats.Exists(Username) = False Then
gdstats.Add Username, Array("1", "1", "1", "1", "0") '// All Users in channel that talk will be added
AddQ "/whisper " & psd2 & Username & " You have been added to the Gun Duel Player List."
End If

If Left(Message, Len(BotVars.Trigger)) <> BotVars.Trigger Then Exit Sub

If gdLeveling = "True" And Username = gdLvlingPlayer Then '// Checks to see if a Player Is Leveling
Call gdLevelUp(Message)
ElseIf gdLeveling = "True" And Username <> gdLvlingPlayer And Left(Message, Len(BotVars.Trigger)) <> BotVars.Trigger Then '// If A Player Is Leveling, Inform Player That He Has To Wait
AddQ "/whisper " & psd2 & Username & " I'm Helping " & gdLvlingPlayer & ". Please wait while they finish."
End If

If Left(LCase(massage), Len(gdDuel_Command) + 1) = BotVars.Trigger & gdDuel_Command And myAccess >= gdDuel_Access Then
User = Split(Mid(LCase(Trim(Message)), 2), " ")
msgUsername = User(1)
Call gdDuel(Username, Message)
ElseIf Left(LCase(massage), Len(gdStats_Command) + 1) = BotVars.Trigger & LCase(gdStats_Command) And myAccess >= gdDuel_Access Then
User = Split(Mid(LCase(Trim(Message)), 2), " ")
msgUsername = User(1)
Call gdStatReturn(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdFire_Command And myAccess >= gdDuel_Access Then
Call gdFire(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdAim_Command And myAccess >= gdDuel_Access Then
Call gdAim(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdCover_Command And myAccess >= gdDuel_Access Then
Call gdCover(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdHeal_Command And myAccess >= gdDuel_Access Then
Call gdHeal(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdStim_Command And myAccess >= gdDuel_Access Then
Call gdStim(Username, Message)
ElseIf LCase(massage) = BotVars.Trigger & gdCloak_Command And myAccess >= gdDuel_Access Then
Call gdCloak(Username, Message)
End If

If gdChallenge = "True" And Username = msgUsername And LCase(Message) = "yes" Then '//Player Has Accepted Challenge, Store All Needed Info For The Match
gdGameOn = "True"
gdPlayer1(2) = gdstats.Item(gdPlayer1(1))(1) '// Stores Player1's Level
gdPlayer1(3) = gdstats.Item(gdPlayer1(1))(2) '// Stores Player1's Attack
gdPlayer1(4) = gdstats.Item(gdPlayer1(1))(3) '// Stores Player1's Accurcy
gdPlayer1(5) = gdstats.Item(gdPlayer1(1))(4) '// Stores Player1's Evasion
gdPlayer1(6) = gdstats.Item(gdPlayer1(1))(5) '// Stores Player1's Exp (%)
gdPlayer2(2) = gdstats.Item(gdPlayer2(1))(1) '// Stores Player2's Level
gdPlayer2(3) = gdstats.Item(gdPlayer2(1))(2) '// Stores Player2's Attack
gdPlayer2(4) = gdstats.Item(gdPlayer2(1))(3) '// Stores Player2's Accurcy
gdPlayer2(5) = gdstats.Item(gdPlayer2(1))(4) '// Stores Player2's Evasion
gdPlayer2(6) = gdstats.Item(gdPlayer2(1))(5) '// Stores Player2's Exp (%)
gdGameStats1(1) = gdPlayer1(2) * 10 '// Stores InGame HP
gdGameStats1(2) = gdPlayer1(3) '// Stores InGame Attack
gdGameStats1(3) = gdPlayer1(4) '// Stores InGame Accurcy
gdGameStats1(4) = gdPlayer1(5) '// Stores InGame Evasion
gdGameStats2(1) = gdPlayer1(2) * 10 '// Stores InGame HP
gdGameStats2(2) = gdPlayer1(3) '// Stores InGame Attack
gdGameStats2(3) = gdPlayer1(4) '// Stores InGame Accurcy
gdGameStats2(4) = gdPlayer1(5) '// Stores InGame Evasion
AddQ "A Duel Has Started Between " & gdPlayer1(1) & "(Level " & gdPlayer1(2) & ") And " & gdPlayer2(1) & "(Level " & gdPlayer2(2) & ")"
ElseIf gdChallenge = "True" And Username = msgUsername And LCase(Message) = "no" Then
AddQ Username & " has refused the Duel Challenge."
End If
End Sub

Sub gd_Event_WhisperFromUser(Username, Flags, Message, Ping)
Call gd_event_UserTalk(Username, Flags, Message, Ping)
End Sub

Sub gd_Event_Close()
Dim TempStr

Set gdsaved = gdfso.OpenTextFile(gdFilePath, 8, True)
For Each Key In gdstats.Keys '// Puts All info into a file
TempStr = Key & " " & gdstats.Item(Key)(1) & " " & gdstats.Item(Key)(2) & " " & gdstats.Item(Key)(3) & " " & gdstats.Item(Key)(4) & " " & gdstats.Item(Key)(5)
gdsaved.WriteLine TempStr
Next
gdsaved.Close
Set gdsaved = Nothing
End Sub

Sub gdDuel(Username, Message)

If gdGameOn = "True" Then '// Checks for current duels
AddQ "/whisper " & psd2 & Username & " a duel is currently in progress. Please wait for this duel to end."
Exit Sub
End If

If GetPositionByName(msgUsername) = -1 Then '// Checks for user in channel
AddQ "/whisper " & psd2 & Username & " " & msgUsername & " is not currently in the channel."
Exit Sub
Else
AddQ "/whisper " & psd2 & msgUsername & " " & Username & " has challenged you to a duel."
AddQ "/whisper " & psd2 & msgUsername & "Whisper me 'Yes' or 'NO'."
gdChallenge = "True"
gdPlayer1(1) = Username
gdPlayer2(1) = msgUsername
End if
End Sub

Sub gdStatReturn(Username, Message)

AddChat vbBlue, "Checkpoint"
If LCase(msgUsername) = "me" Then '// Change Username Incase of "me"
msgUsername = Username
End If
If gdstats.Exists(msgUsername) = False Then '// Checks for user in dictionary
AddQ "/whisper " & psd2 & Username & " This Player does not exist."
Exit Sub
Else
gdStatsLookup(1) = gdstats.Item(msgUsername)(1)
gdStatsLookup(2) = gdstats.Item(msgUsername)(2)
gdStatsLookup(3) = gdstats.Item(msgUsername)(3)
gdStatsLookup(4) = gdstats.Item(msgUsername)(4)
gdStatsLookup(5) = gdstats.Item(msgUsername)(5)
gdStatsLookup(6) = gdstats.Item(msgUsername)(6)
AddQ "/whisper " & psd2 & Username & " " & gdStatsLookup(1) & " Level:" & gdStatsLookup(2) & " Attack:" & gdStatsLookup(3) & " Accurcy:" & gdStatsLookup(4) & " Evasion:" & gdStatsLookup(5) & " Experience(%):" & gdStatsLookup(6)
End If
End Sub


Sub gdFire(Username, Message)

If gdstats.Item(Username)(1) < gdFire_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1 And gdDonePlayer1 = False Then
gdDonePlayer1 = True
gdActionPlayer1 = 1
ElseIf Username = gdPlayer2 And gdDonePlayer2 = False Then
gdDonePlayer2 = True
gdActionPlayer2 = 1
Else: exitSub
End If

If gdDonePlayer1 = True And gdDonePlayer2 = True Then
Call gdActionChosen
End If
End Sub

Sub gdAim(Username, Message)

If gdstats.Item(Username)(1) < gdAim_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1 And gdDonePlayer1 = False Then
gdDonePlayer1 = True
gdActionPlayer1 = 2
ElseIf Username = gdPlayer2 And gdDonePlayer2 = False Then
gdDonePlayer2 = True
gdActionPlayer2 = 2
Else: exitSub
End If

If gdDonePlayer1 = True And gdDonePlayer2 = True Then
Call gdActionChosen
End If
End Sub

Sub gdCover(Username, Message)

If gdstats.Item(Username)(1) < gdCover_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1 And gdDonePlayer1 = False Then
gdDonePlayer1 = True
gdActionPlayer1 = 3
ElseIf Username = gdPlayer2 And gdDonePlayer2 = False Then
gdDonePlayer2 = True
gdActionPlayer2 = 3
Else: exitSub
End If

If gdDonePlayer1 = True And gdDonePlayer2 = True Then
Call gdActionChosen
End If
End Sub

Sub gdHeal(Username, Message)

If gdstats.Item(Username)(1) < gdHeal_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1 And gdDonePlayer1 = False Then
gdDonePlayer1 = True
gdActionPlayer1 = 4
ElseIf Username = gdPlayer2 And gdDonePlayer2 = False Then
gdDonePlayer2 = True
gdActionPlayer2 = 4
Else: exitSub
End If

If gdDonePlayer1 = True And gdDonePlayer2 = True Then
Call gdActionChosen
End If
End Sub

Sub gdStim(Username, Message)

If gdstats.Item(Username)(1) < gdStim_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1 And gdDonePlayer1 = False Then
gdDonePlayer1 = True
gdActionPlayer1 = 5
ElseIf Username = gdPlayer2 And gdDonePlayer2 = False Then
gdDonePlayer2 = True
gdActionPlayer2 = 5
Else: exitSub
End If

If gdDonePlayer1 = True And gdDonePlayer2 = True Then
Call gdActionChosen
End If
End Sub

Sub gdCloak(Username, Message)

If gdstats.Item(Username)(1) < gdCloak_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1 And gdDonePlayer1 = False Then
gdDonePlayer1 = True
gdActionPlayer1 = 6
ElseIf Username = gdPlayer2 And gdDonePlayer2 = False Then
gdDonePlayer2 = True
gdActionPlayer2 = 6
Else: exitSub
End If

If gdDonePlayer1 = True And gdDonePlayer2 = True Then
Call gdActionChosen
End If
End Sub

Sub gdActionChosen()
Dim P1msg, P2msg, a
If gdActionPlayer1 = 1 Then
P1msg = gdPlayer1 & " Fires One Round At " & gdPlayer2
a = (gdGameStats1(3) + randint(1, 5)) - gdGameStats2(4)
If a >= 5 Then
P1msg = P1msg & " And Hits For Critical!!"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(3, 5))
ElseIf a >= 1 Then
P1msg = P1msg & " And Hits"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(0, 3))
ElseIf a = 0 Then
P1msg = P1msg & " And Almost Missed"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2))
ElseIf a <= -1 Then
P1msg = P1msg & " And Misses"
gdGameStats2(1) = gdGameStats2(1)
End If
gdGameStats1(3) = gdPlayer1(4)
gdGameStats1(4) = gdPlayer1(5)
ElseIf gdActionPlayer1 = 2 Then
P1msg = gdPlayer1 & " Takes Aim At " & gdPlayer2
gdGameStats1(3) = 999
gdGameStats1(4) = gdPlayer1(5)
ElseIf gdActionPlayer1 = 3 Then
P1msg = gdPlayer1 & " Takes Cover And Fires At " & gdPlayer2
gdGameStats1(3) = gdPlayer1(4) - 1
gdGameStats1(4) = gdPlayer1(5) + 1
a = (gdGameStats1(3) + randint(1, 5)) - gdGameStats2(4)
If a >= 5 Then
P1msg = P1msg & " And Hits For Critical!!"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(3, 5))
ElseIf a >= 1 Then
P1msg = P1msg & " And Hits"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(0, 3))
ElseIf a = 0 Then
P1msg = P1msg & " And Almost Missed"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2))
ElseIf a <= -1 Then
P1msg = P1msg & " And Misses"
gdGameStats2(1) = gdGameStats2(1)
End If
ElseIf gdActionPlayer1 = 4 Then
P1msg = gdPlayer1 & " Heals"
gdGameStats1(1) = gdGameStats1(1) + randint(1, 5)
gdGameStats1(3) = gdPlayer1(4)
gdGameStats1(4) = gdPlayer1(5)
ElseIf gdActionPlayer1 = 5 Then
P1msg = gdPlayer1 & " Fires Two Rounds At " & gdPlayer2
gdGameStats1(1) = gdGameStats1(1) - 4
a = (gdGameStats1(3) + randint(1, 5)) - gdGameStats2(4)
If a >= 5 Then
P1msg = P1msg & " 1:Critical!!"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(3, 5))
ElseIf a >= 1 Then
P1msg = P1msg & " 1:Hits"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(0, 3))
ElseIf a = 0 Then
P1msg = P1msg & " 1:Almost Missed"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2))
ElseIf a <= -1 Then
P1msg = P1msg & " 1:Misses"
gdGameStats2(1) = gdGameStats2(1)
End If
a = (gdGameStats1(3) + randint(1, 5)) - gdGameStats2(4)
If a >= 5 Then
P1msg = P1msg & " 2:Critical!!"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(3, 5))
ElseIf a >= 1 Then
P1msg = P1msg & " 2:Hits"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(0, 3))
ElseIf a = 0 Then
P1msg = P1msg & " 2:Almost Missed"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2))
ElseIf a <= -1 Then
P1msg = P1msg & " 2:Misses"
gdGameStats2(1) = gdGameStats2(1)
End If
gdGameStats1(3) = gdPlayer1(4)
gdGameStats1(4) = gdPlayer1(5)
ElseIf gdActionPlayer1 = 6 Then
P1msg = gdPlayer1 & " Cloaks And Fires At " & gdPlayer2
gdGameStats1(4) = 999
a = (gdGameStats1(3) + randint(1, 5)) - gdGameStats2(4)
If a >= 5 Then
P1msg = P1msg & " 2:Critical!!"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(3, 5))
ElseIf a >= 1 Then
P1msg = P1msg & " 2:Hits"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(0, 3))
ElseIf a = 0 Then
P1msg = P1msg & " 2:Almost Missed"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2))
ElseIf a <= -1 Then
P1msg = P1msg & " 2:Misses"
gdGameStats2(1) = gdGameStats2(1)
End If
gdGameStats1(3) = gdPlayer1(4)
Else
P1msg = gdPlayer1 & " :gdActionChosen Error"
AddChat vbRed, "P1 gdActionPlayer1 is Incorrect", vbBlue, gdActionPlayer1
End If


If gdActionPlayer2 = 1 Then
P2msg = gdPlayer2 & " Fires One Round At " & gdPlayer1
a = (gdGameStats2(3) + randint(1, 5)) - gdGameStats1(4)
If a >= 5 Then
P2msg = P2msg & " And Hits For Critical!!"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(3, 5))
ElseIf a >= 1 Then
P2msg = P2msg & " And Hits"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(0, 3))
ElseIf a = 0 Then
P2msg = P2msg & " And Almost Missed"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2))
ElseIf a <= -1 Then
P2msg = P2msg & " And Misses"
gdGameStats1(1) = gdGameStats1(1)
End If
gdGameStats2(3) = gdPlayer2(4)
gdGameStats2(4) = gdPlayer2(5)
ElseIf gdActionPlayer2 = 2 Then
P1msg = gdPlayer2 & " Takes Aim At " & gdPlayer1
gdGameStats2(3) = 999
gdGameStats2(4) = gdPlayer2(5)
ElseIf gdActionPlayer2 = 3 Then
P1msg = gdPlayer2 & " Takes Cover And Fires At " & gdPlayer1
gdGameStats2(3) = gdPlayer2(4) - 1
gdGameStats2(4) = gdPlayer2(5) + 1
a = (gdGameStats1(3) + randint(1, 5)) - gdGameStats2(4)
If a >= 5 Then
P2msg = P2msg & " And Hits For Critical!!"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(3, 5))
ElseIf a >= 1 Then
P2msg = P2msg & " And Hits"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(0, 3))
ElseIf a = 0 Then
P2msg = P2msg & " And Almost Missed"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2))
ElseIf a <= -1 Then
P2msg = P2msg & " And Misses"
gdGameStats1(1) = gdGameStats1(1)
End If
ElseIf gdActionPlayer2 = 4 Then
P2msg = gdPlayer2 & " Heals"
gdGameStats1(1) = gdGameStats1(1) + randint(1, 5)
gdGameStats2(3) = gdPlayer2(4)
gdGameStats2(4) = gdPlayer2(5)
ElseIf gdActionPlayer2 = 5 Then
P2msg = gdPlayer2 & " Fires Two Rounds At " & gdPlayer1
gdGameStats2(1) = gdGameStats2(1) - 4
a = (gdGameStats2(3) + randint(1, 5)) - gdGameStats1(4)
If a >= 5 Then
P2msg = P2msg & " 1:Critical!!"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(3, 5))
ElseIf a >= 1 Then
P2msg = P2msg & " 1:Hits"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(0, 3))
ElseIf a = 0 Then
P2msg = P2msg & " 1:Almost Missed"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2))
ElseIf a <= -1 Then
P2msg = P2msg & " 1:Misses"
gdGameStats1(1) = gdGameStats1(1)
End If
a = (gdGameStats2(3) + randint(1, 5)) - gdGameStats1(4)
If a >= 5 Then
P2msg = P2msg & " 2:Critical!!"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(3, 5))
ElseIf a >= 1 Then
P2msg = P2msg & " 2:Hits"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(0, 3))
ElseIf a = 0 Then
P2msg = P2msg & " 2:Almost Missed"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2))
ElseIf a <= -1 Then
P2msg = P2msg & " 2:Misses"
gdGameStats1(1) = gdGameStats1(1)
End If
gdGameStats2(3) = gdPlayer2(4)
gdGameStats2(4) = gdPlayer2(5)
ElseIf gdActionPlayer2 = 6 Then
P2msg = gdPlayer2 & " Cloaks And Fires At " & gdPlayer1
gdGameStats2(4) = 999
a = (gdGameStats2(3) + randint(1, 5)) - gdGameStats1(4)
If a >= 5 Then
P2msg = P2msg & " 2:Critical!!"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(3, 5))
ElseIf a >= 1 Then
P2msg = P2msg & " 2:Hits"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(0, 3))
ElseIf a = 0 Then
P2msg = P2msg & " 2:Almost Missed"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2))
ElseIf a <= -1 Then
P2msg = P2msg & " 2:Misses"
gdGameStats1(1) = gdGameStats1(1)
End If
gdGameStats2(3) = gdPlayer2(4)
Else
P2msg = gdPlayer2 & " :gdActionChosen Error"
AddChat vbRed, "P1 gdActionPlayer2 is Incorrect", vbBlue, gdActionPlayer2
End If
AddQ P1msg
AddQ P2msg

If gdGameStats1(1) <= 0 Then
gdPlayer1(6) = gdPlayer1(6) + 5
AddChat gdPlayer1(1) & " Has Killed " & gdPlayer2(1)
gdGameOn = False
gdChallenge = False
If gdPlayer1(6) >= 100 Then Call gdLevelUp
Call gd_Event_Close
ElseIf gdGameStats2(1) <= 0 Then
gdPlayer2(6) = gdPlayer2(6) + 5
AddChat gdPlayer2(1) & " Has Killed " & gdPlayer1(1)
gdGameOn = False
gdChallenge = False
If gdPlayer2(6) >= 100 Then Call gdLevelUp
Call gd_Event_Close
ElseIf gdGameStats1(1) <= 0 And gdGameStats2(1) = 0 Then
gdPlayer2(6) = gdPlayer2(6) + 1
gdPlayer1(6) = gdPlayer1(6) + 1
AddChat gdPlayer2(1) & " And " & gdPlayer1(1) & " Have Killed Eachother!!!"
gdGameOn = False
gdChallenge = False
If gdPlayer1(6) >= 100 Then Call gdLevelUp
If gdPlayer2(6) >= 100 Then Call gdLevelUp
Call gd_Event_Close
End If
End Sub

Sub gdLevelUp(Message)
gdPlayer1(2) = gdstats.Item(gdPlayer1(1))(1) '// Stores Player1's Level
gdPlayer1(6) = gdstats.Item(gdPlayer1(1))(5) '// Stores Player1's Exp (%)
gdPlayer2(2) = gdstats.Item(gdPlayer2(1))(1) '// Stores Player2's Level
gdPlayer2(6) = gdstats.Item(gdPlayer2(1))(5) '// Stores Player2's Exp (%)

If gdPlayer1(6) >= 100 Then
gdPlayer1(2) = gdPlayer1(2) + 1
gdPlayer1(6) = gdPlayer1(6) - 100
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Have Leveled, Please tell me which stat you would like to upgrade. Atk, Acc, Eva"
gdLeveling = True
gdLvlingPlayer = gdPlayer1(1)
Exit Sub '// Wait For User Input
ElseIf gdPlayer2(6) >= 100 Then
gdPlayer2(2) = gdPlayer2(2) + 1
gdPlayer2(6) = gdPlayer2(6) - 100
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Have Leveled, Please tell me which stat you would like to upgrade. Atk, Acc, Eva"
gdLeveling = True
gdLvlingPlayer = gdPlayer2(1)
Exit Sub '// Wait For User Input
End If

If gdLeveling = False Then Exit Sub

If gdLeveling = True And Message = Atk Then
gdstats.Item(gdLvlingPlayer)(2) = gdstats.Item(gdLvlingPlayer)(2) + 1
gdLeveling = False
AddQ "/whisper " & psd2 & gdLvlingPlayer & " Thank You For Making Your Selection. Succesfully Increased Atk By ONE."
Exit Sub
ElseIf gdLeveling = True And Message = Acc Then
gdstats.Item(gdLvlingPlayer)(3) = gdstats.Item(gdLvlingPlayer)(3) + 1
gdLeveling = False
AddQ "/whisper " & psd2 & gdLvlingPlayer & " Thank You For Making Your Selection. Succesfully Increased Acc By ONE."
Exit Sub
ElseIf gdLeveling = True And Message = Eva Then
gdstats.Item(gdLvlingPlayer)(4) = gdstats.Item(gdLvlingPlayer)(4) + 1
gdLeveling = False
AddQ "/whisper " & psd2 & gdLvlingPlayer & " Thank You For Making Your Selection. Succesfully Increased Eva By ONE."
Exit Sub
ElseIf gdLeveling = True Then
AddQ "/whisper " & psd2 & gdLvlingPlayer & " Your Selection is Incorrect: " & Message & ". Please Try Again."
Exit Sub
End If
End Sub


CODE
'gd
'1.2
'&Gun Duel:Cyber_Hunter
'&Duel <username>:Stats <Username>:Fire:Aim:Cover:Heal:Stim:Cloak
'&
'&Gun Dueling Game:Lvl your Character:Increase your stats:Battle Other Players in 1vs1 Duels

'*****UPDATE*****
'Finally found the time to test this game. Stats Command Works And Player will be recorded
'in your plugins folder in gdStats.txt. You can play around with the levels and Stats of all
'Players, but only modify the file when the bot if shutdonw, outherwise your changes will be
'lost.
'Ver: 1.2
'Ok, at least now the script doesn't give error messages, but the problem is it won't
'do much at all. The commands dont't work but I know that the bot is going through the
'subs. Need to figure out what stoping the commands from being executed.


'Ver: 1.1
'First Basic Script. Still Many bugs to work out, Won't work yet because of a
'loading error that i can't seem to fix. After I finally fix this the script will
'be workable. Hope that will happen soon.

Public gdstats '// Holds All Player Stats
Public gdfso '// Holds fso
Public gdsaved '// Save Info On Shutdown
Public gdGameOn '// Holds the Game Status (Game On/Off)
Public gdChallenge '// Holds Challenge Status
Public gdDonePlayer1 '// Holds Turn Information
Public gdDonePlayer2 '// Holds Turn Information
Public gdLeveling '// Sends messages directly to gdLevelUp
Public gdLvlingPlayer '// Holds Leveling Players Name
Public gdActionPlayer1 '// Holds Player Action
Public gdActionPlayer2 '// Holds Player Action
Private gdPlayer1(6) '// Holds Challengers Stats
Private gdPlayer2(6) '// Holds Other Players Stats
Private gdGameStats1(4) '// Holds InGame Stats
Private gdGameStats2(4) '// Holds InGame Stats
Private gdStatsLookup(4) '// Holds Stats for gdStats Commands
Public gdFilePath '// Stat File FilePath

'//ACCESS (This will later be changed for use in the pluginsettings.txt file)

Const gdDuel_Access = -1 '// Default -> -1 (No Access)

'//COMMAND NAMES (These will later be changed for use in the pluginsettings.txt file)

Const gdDuel_Command = "duel" '// Used To Challange Player.
Const gdStats_Command = "stats" '// Used to check stats.
Const gdFire_Command = "fire" '// Simple Attack Command.
Const gdAim_Command = "aim" '// Skip a turn for 100% Accurcy.
Const gdCover_Command = "cover" '// Increase you Evasion, Decrease your Accurcy.
Const gdHeal_Command = "heal" '// Used to heal yourself.
Const gdStim_Command = "stim" '// Used to attack twice while losing 5hp.
Const gdCloak_Command = "cloak" '// Increase your evasion for one attack.


'//LEVEL REQUIREMENT (These will later be changed for use in the pluginsettings.txt file)

Const gdFire_Level = 1 '// Default -> 1
Const gdAim_Level = 1 '// Default -> 1
Const gdCover_Level = 1 '// Default -> 1
Const gdHeal_Level = 1 '// Default -> 1
Const gdStim_Level = 5 '// Default -> 5
Const gdCloak_Level = 15 '// Default -> 15

'//OTHER USER-SELECTED VARIABLES (These will later be changed for use in the pluginsettings.txt file)

Const gdUserFilePath = "plugins\gdStats.txt"
Const gdPointsPerKill = 5 '// Experience per Kill (%)
Const gdPointsPerTie = 1 '// Experience per Tie (%)

Sub gd_event_Load()

Dim TempStr
gdFilePath = BotPath & gdUserFilePath
Set gdstats = CreateObject("Scripting.Dictionary")
Set gdfso = CreateObject("Scripting.FileSystemObject")

If gdfso.FileExists(gdFilePath) Then '// If File Exists, Retrieves Information
Set gdsaved = gdfso.OpenTextFile(gdFilePath, 1, False)
Do While Not gdsaved.AtEndOfStream
TempStr = Split(gdsaved.ReadLine, " ")
gdstats.Add TempStr(0), Array(TempStr(1), TempStr(2), TempStr(3), TempStr(4), TempStr(5))
Loop
gdsaved.Close
Set gdsaved = Nothing
Else '// If File Does Not Exists, Gives a Welcome Msg >>> The File Will Be Created With Other Subs
AddChat vbBlue, "Welcome To Gun Duel. Thank you for testing the script."
AddChat vbCyan, "All the variables for the Duel can be changed in the plugin file."
AddChat vbRed, "Current Errors: Commands are not executed"
End If

gdGameOn = "False"
gdChallenge = "False"
End Sub



Sub gd_event_UserTalk(Username, Flags, Message, Ping)

Dim MyAccess, MyFlags, msgUsername
GetDBEntry Username, MyAccess, MyFlags

If gdstats.Exists(Username) = False Then
gdstats.Add Username, Array("1", "1", "1", "1", "0") '// All Users in channel that talk will be added
AddQ "/whisper " & psd2 & Username & " You have been added to the Gun Duel Player List."
End If

If gdLeveling = "True" And Username = gdLvlingPlayer Then '// Checks to see if a Player Is Leveling
Call gdLevelUp(Message)
ElseIf gdLeveling = "True" And Username <> gdLvlingPlayer And Left(Message, Len(BotVars.Trigger)) <> BotVars.Trigger Then '// If A Player Is Leveling, Inform Player That He Has To Wait
AddQ "/whisper " & psd2 & Username & " I'm Helping " & gdLvlingPlayer & ". Please wait while they finish."
End If

If Left(Message, Len(BotVars.Trigger)) <> BotVars.Trigger Then
Exit Sub
Else
Message = Replace(Message, BotVars.Trigger, "", 1, 1) '// Remove The Trigger From Message
End If

If gdDuel_Access > MyAccess Then Exit Sub

If Split(LCase(Message), " ")(0) = LCase(gdDuel_Command) Then
Call gdDuel(Username, Message)
ElseIf Split(LCase(Message), " ")(0) = LCase(gdStats_Command) Then
Call gdStatReturn(Username, Message)
ElseIf LCase(Message) = gdFire_Command Then
Call gdFire(Username, Message)
ElseIf LCase(Message) = gdAim_Command Then
Call gdAim(Username, Message)
ElseIf LCase(Message) = gdCover_Command Then
Call gdCover(Username, Message)
ElseIf LCase(Message) = gdHeal_Command Then
Call gdHeal(Username, Message)
ElseIf LCase(Message) = gdStim_Command Then
Call gdStim(Username, Message)
ElseIf LCase(Message) = gdCloak_Command Then
Call gdCloak(Username, Message)
End If

If gdChallenge = "True" And Username = msgUsername And LCase(Message) = "yes" Then '//Player Has Accepted Challenge, Store All Needed Info For The Match
gdGameOn = "True"
gdPlayer1(2) = gdstats.Item(gdPlayer1(1))(1) '// Stores Player1's Level
gdPlayer1(3) = gdstats.Item(gdPlayer1(1))(2) '// Stores Player1's Attack
gdPlayer1(4) = gdstats.Item(gdPlayer1(1))(3) '// Stores Player1's Accurcy
gdPlayer1(5) = gdstats.Item(gdPlayer1(1))(4) '// Stores Player1's Evasion
gdPlayer1(6) = gdstats.Item(gdPlayer1(1))(5) '// Stores Player1's Exp (%)
gdPlayer2(2) = gdstats.Item(gdPlayer2(1))(1) '// Stores Player2's Level
gdPlayer2(3) = gdstats.Item(gdPlayer2(1))(2) '// Stores Player2's Attack
gdPlayer2(4) = gdstats.Item(gdPlayer2(1))(3) '// Stores Player2's Accurcy
gdPlayer2(5) = gdstats.Item(gdPlayer2(1))(4) '// Stores Player2's Evasion
gdPlayer2(6) = gdstats.Item(gdPlayer2(1))(5) '// Stores Player2's Exp (%)
gdGameStats1(1) = gdPlayer1(2) * 10 '// Stores InGame HP
gdGameStats1(2) = gdPlayer1(3) '// Stores InGame Attack
gdGameStats1(3) = gdPlayer1(4) '// Stores InGame Accurcy
gdGameStats1(4) = gdPlayer1(5) '// Stores InGame Evasion
gdGameStats2(1) = gdPlayer1(2) * 10 '// Stores InGame HP
gdGameStats2(2) = gdPlayer1(3) '// Stores InGame Attack
gdGameStats2(3) = gdPlayer1(4) '// Stores InGame Accurcy
gdGameStats2(4) = gdPlayer1(5) '// Stores InGame Evasion
AddQ "A Duel Has Started Between " & gdPlayer1(1) & "(Level " & gdPlayer1(2) & ") And " & gdPlayer2(1) & "(Level " & gdPlayer2(2) & ")"
ElseIf gdChallenge = "True" And Username = msgUsername And LCase(Message) = "no" Then
AddQ Username & " has refused the Duel Challenge."
End If
End Sub

Sub gd_Event_WhisperFromUser(Username, Flags, Message, Ping)
Call gd_event_UserTalk(Username, Flags, Message, Ping)
End Sub

Sub gd_Event_Close()
Dim TempStr

Set gdsaved = gdfso.OpenTextFile(gdFilePath, 2, False)
For Each Key In gdstats.Keys '// Puts All info into a file
TempStr = Key & " " & gdstats.Item(Key)(0) & " " & gdstats.Item(Key)(1) & " " & gdstats.Item(Key)(2) & " " & gdstats.Item(Key)(3) & " " & gdstats.Item(Key)(4)
gdsaved.WriteLine TempStr
Next
gdsaved.Close
Set gdsaved = Nothing
End Sub

Sub gdDuel(Username, Message)

If gdGameOn = "True" Then '// Checks for current duels
AddQ "/whisper " & psd2 & Username & " a duel is currently in progress. Please wait for this duel to end."
Exit Sub
End If

User = Split(Message, " ")
msgUsername = User(1)

If GetPositionByName(msgUsername) = -1 Then '// Checks for user in channel
AddQ "/whisper " & psd2 & Username & " " & msgUsername & " is not currently in the channel."
Exit Sub
Else
AddQ "/whisper " & psd2 & msgUsername & " " & Username & " has challenged you to a duel."
AddQ "/whisper " & psd2 & msgUsername & "Whisper me 'Yes' or 'NO'."
gdChallenge = "True"
gdPlayer1(1) = Username
gdPlayer2(1) = msgUsername
End If
End Sub

Sub gdStatReturn(Username, Message)

User = Split(Message, " ")
msgUsername = User(1)

If LCase(msgUsername) = "me" Then '// Change Username Incase of "me"
msgUsername = Username
End If

If Not gdstats.Exists(msgUsername) Then '// Checks for user in dictionary
AddQ "/whisper " & psd2 & Username & " This Player does not exist."
Exit Sub
Else
gdStatsLookup(0) = gdstats.Item(msgUsername)(0)
gdStatsLookup(1) = gdstats.Item(msgUsername)(1)
gdStatsLookup(2) = gdstats.Item(msgUsername)(2)
gdStatsLookup(3) = gdstats.Item(msgUsername)(3)
gdStatsLookup(4) = gdstats.Item(msgUsername)(4)
AddQ "/whisper " & psd2 & Username & " " & msgUsername & " Level:" & gdStatsLookup(0) & " Attack:" & gdStatsLookup(1) & " Accurcy:" & gdStatsLookup(2) & " Evasion:" & gdStatsLookup(3) & " Experience(%):" & gdStatsLookup(4)
End If
End Sub


Sub gdFire(Username, Message)

If gdstats.Item(Username)(1) < gdFire_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1 And gdDonePlayer1 = False Then
gdDonePlayer1 = True
gdActionPlayer1 = 1
ElseIf Username = gdPlayer2 And gdDonePlayer2 = False Then
gdDonePlayer2 = True
gdActionPlayer2 = 1
Else: ExitSub
End If

If gdDonePlayer1 = True And gdDonePlayer2 = True Then
Call gdActionChosen
End If
End Sub

Sub gdAim(Username, Message)

If gdstats.Item(Username)(1) < gdAim_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1 And gdDonePlayer1 = False Then
gdDonePlayer1 = True
gdActionPlayer1 = 2
ElseIf Username = gdPlayer2 And gdDonePlayer2 = False Then
gdDonePlayer2 = True
gdActionPlayer2 = 2
Else: ExitSub
End If

If gdDonePlayer1 = True And gdDonePlayer2 = True Then
Call gdActionChosen
End If
End Sub

Sub gdCover(Username, Message)

If gdstats.Item(Username)(1) < gdCover_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1 And gdDonePlayer1 = False Then
gdDonePlayer1 = True
gdActionPlayer1 = 3
ElseIf Username = gdPlayer2 And gdDonePlayer2 = False Then
gdDonePlayer2 = True
gdActionPlayer2 = 3
Else: ExitSub
End If

If gdDonePlayer1 = True And gdDonePlayer2 = True Then
Call gdActionChosen
End If
End Sub

Sub gdHeal(Username, Message)

If gdstats.Item(Username)(1) < gdHeal_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1 And gdDonePlayer1 = False Then
gdDonePlayer1 = True
gdActionPlayer1 = 4
ElseIf Username = gdPlayer2 And gdDonePlayer2 = False Then
gdDonePlayer2 = True
gdActionPlayer2 = 4
Else: ExitSub
End If

If gdDonePlayer1 = True And gdDonePlayer2 = True Then
Call gdActionChosen
End If
End Sub

Sub gdStim(Username, Message)

If gdstats.Item(Username)(1) < gdStim_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1 And gdDonePlayer1 = False Then
gdDonePlayer1 = True
gdActionPlayer1 = 5
ElseIf Username = gdPlayer2 And gdDonePlayer2 = False Then
gdDonePlayer2 = True
gdActionPlayer2 = 5
Else: ExitSub
End If

If gdDonePlayer1 = True And gdDonePlayer2 = True Then
Call gdActionChosen
End If
End Sub

Sub gdCloak(Username, Message)

If gdstats.Item(Username)(1) < gdCloak_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1 And gdDonePlayer1 = False Then
gdDonePlayer1 = True
gdActionPlayer1 = 6
ElseIf Username = gdPlayer2 And gdDonePlayer2 = False Then
gdDonePlayer2 = True
gdActionPlayer2 = 6
Else: ExitSub
End If

If gdDonePlayer1 = True And gdDonePlayer2 = True Then
Call gdActionChosen
End If
End Sub

Sub gdActionChosen()
Dim P1msg, P2msg, a

If gdActionPlayer1 = 1 Then '// Action: Fire
P1msg = gdPlayer1 & " Fires One Round At " & gdPlayer2
a = (gdGameStats1(3) + randint(1, 5)) - gdGameStats2(4)
If a >= 5 Then
P1msg = P1msg & " And Hits For Critical!!"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(3, 5))
ElseIf a >= 1 Then
P1msg = P1msg & " And Hits"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(0, 3))
ElseIf a = 0 Then
P1msg = P1msg & " And Almost Missed"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2))
ElseIf a <= -1 Then
P1msg = P1msg & " And Misses"
gdGameStats2(1) = gdGameStats2(1)
End If
gdGameStats1(3) = gdPlayer1(4)
gdGameStats1(4) = gdPlayer1(5)
ElseIf gdActionPlayer1 = 2 Then '// Action: Aim
P1msg = gdPlayer1 & " Takes Aim At " & gdPlayer2
gdGameStats1(3) = 999
gdGameStats1(4) = gdPlayer1(5)
ElseIf gdActionPlayer1 = 3 Then '// Action: Cover
P1msg = gdPlayer1 & " Takes Cover And Fires At " & gdPlayer2
gdGameStats1(3) = gdPlayer1(4) - 1
gdGameStats1(4) = gdPlayer1(5) + 1
a = (gdGameStats1(3) + randint(1, 5)) - gdGameStats2(4)
If a >= 5 Then
P1msg = P1msg & " And Hits For Critical!!"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(3, 5))
ElseIf a >= 1 Then
P1msg = P1msg & " And Hits"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(0, 3))
ElseIf a = 0 Then
P1msg = P1msg & " And Almost Missed"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2))
ElseIf a <= -1 Then
P1msg = P1msg & " And Misses"
gdGameStats2(1) = gdGameStats2(1)
End If
ElseIf gdActionPlayer1 = 4 Then '// Action: Heal
P1msg = gdPlayer1 & " Heals"
gdGameStats1(1) = gdGameStats1(1) + randint(1, 5)
gdGameStats1(3) = gdPlayer1(4)
gdGameStats1(4) = gdPlayer1(5)
ElseIf gdActionPlayer1 = 5 Then '// Action: Stim
P1msg = gdPlayer1 & " Fires Two Rounds At " & gdPlayer2
gdGameStats1(1) = gdGameStats1(1) - 4
a = (gdGameStats1(3) + randint(1, 5)) - gdGameStats2(4)
If a >= 5 Then
P1msg = P1msg & " 1:Critical!!"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(3, 5))
ElseIf a >= 1 Then
P1msg = P1msg & " 1:Hits"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(0, 3))
ElseIf a = 0 Then
P1msg = P1msg & " 1:Almost Missed"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2))
ElseIf a <= -1 Then
P1msg = P1msg & " 1:Misses"
gdGameStats2(1) = gdGameStats2(1)
End If
a = (gdGameStats1(3) + randint(1, 5)) - gdGameStats2(4)
If a >= 5 Then
P1msg = P1msg & " 2:Critical!!"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(3, 5))
ElseIf a >= 1 Then
P1msg = P1msg & " 2:Hits"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(0, 3))
ElseIf a = 0 Then
P1msg = P1msg & " 2:Almost Missed"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2))
ElseIf a <= -1 Then
P1msg = P1msg & " 2:Misses"
gdGameStats2(1) = gdGameStats2(1)
End If
gdGameStats1(3) = gdPlayer1(4)
gdGameStats1(4) = gdPlayer1(5)
ElseIf gdActionPlayer1 = 6 Then '// Action: Cloak
P1msg = gdPlayer1 & " Cloaks And Fires At " & gdPlayer2
gdGameStats1(4) = 999
a = (gdGameStats1(3) + randint(1, 5)) - gdGameStats2(4)
If a >= 5 Then
P1msg = P1msg & " 2:Critical!!"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(3, 5))
ElseIf a >= 1 Then
P1msg = P1msg & " 2:Hits"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2) + randint(0, 3))
ElseIf a = 0 Then
P1msg = P1msg & " 2:Almost Missed"
gdGameStats2(1) = gdGameStats2(1) - (gdGameStats1(2))
ElseIf a <= -1 Then
P1msg = P1msg & " 2:Misses"
gdGameStats2(1) = gdGameStats2(1)
End If
gdGameStats1(3) = gdPlayer1(4)
Else '// All Possible Options Are Depleted, Show Error
P1msg = gdPlayer1 & " :gdActionChosen Error"
AddChat vbRed, "P1 gdActionPlayer1 is Incorrect --> ", vbBlue, gdActionPlayer1
End If


If gdActionPlayer2 = 1 Then '// Action: Fire
P2msg = gdPlayer2 & " Fires One Round At " & gdPlayer1
a = (gdGameStats2(3) + randint(1, 5)) - gdGameStats1(4)
If a >= 5 Then
P2msg = P2msg & " And Hits For Critical!!"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(3, 5))
ElseIf a >= 1 Then
P2msg = P2msg & " And Hits"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(0, 3))
ElseIf a = 0 Then
P2msg = P2msg & " And Almost Missed"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2))
ElseIf a <= -1 Then
P2msg = P2msg & " And Misses"
gdGameStats1(1) = gdGameStats1(1)
End If
gdGameStats2(3) = gdPlayer2(4)
gdGameStats2(4) = gdPlayer2(5)
ElseIf gdActionPlayer2 = 2 Then '// Action: Aim
P1msg = gdPlayer2 & " Takes Aim At " & gdPlayer1
gdGameStats2(3) = 999
gdGameStats2(4) = gdPlayer2(5)
ElseIf gdActionPlayer2 = 3 Then '// Action: Cover
P1msg = gdPlayer2 & " Takes Cover And Fires At " & gdPlayer1
gdGameStats2(3) = gdPlayer2(4) - 1
gdGameStats2(4) = gdPlayer2(5) + 1
a = (gdGameStats1(3) + randint(1, 5)) - gdGameStats2(4)
If a >= 5 Then
P2msg = P2msg & " And Hits For Critical!!"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(3, 5))
ElseIf a >= 1 Then
P2msg = P2msg & " And Hits"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(0, 3))
ElseIf a = 0 Then
P2msg = P2msg & " And Almost Missed"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2))
ElseIf a <= -1 Then
P2msg = P2msg & " And Misses"
gdGameStats1(1) = gdGameStats1(1)
End If
ElseIf gdActionPlayer2 = 4 Then '// Action: Heal
P2msg = gdPlayer2 & " Heals"
gdGameStats1(1) = gdGameStats1(1) + randint(1, 5)
gdGameStats2(3) = gdPlayer2(4)
gdGameStats2(4) = gdPlayer2(5)
ElseIf gdActionPlayer2 = 5 Then '// Action: Stim
P2msg = gdPlayer2 & " Fires Two Rounds At " & gdPlayer1
gdGameStats2(1) = gdGameStats2(1) - 4
a = (gdGameStats2(3) + randint(1, 5)) - gdGameStats1(4)
If a >= 5 Then
P2msg = P2msg & " 1:Critical!!"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(3, 5))
ElseIf a >= 1 Then
P2msg = P2msg & " 1:Hits"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(0, 3))
ElseIf a = 0 Then
P2msg = P2msg & " 1:Almost Missed"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2))
ElseIf a <= -1 Then
P2msg = P2msg & " 1:Misses"
gdGameStats1(1) = gdGameStats1(1)
End If
a = (gdGameStats2(3) + randint(1, 5)) - gdGameStats1(4)
If a >= 5 Then
P2msg = P2msg & " 2:Critical!!"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(3, 5))
ElseIf a >= 1 Then
P2msg = P2msg & " 2:Hits"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(0, 3))
ElseIf a = 0 Then
P2msg = P2msg & " 2:Almost Missed"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2))
ElseIf a <= -1 Then
P2msg = P2msg & " 2:Misses"
gdGameStats1(1) = gdGameStats1(1)
End If
gdGameStats2(3) = gdPlayer2(4)
gdGameStats2(4) = gdPlayer2(5)
ElseIf gdActionPlayer2 = 6 Then '// Action: Cloak
P2msg = gdPlayer2 & " Cloaks And Fires At " & gdPlayer1
gdGameStats2(4) = 999
a = (gdGameStats2(3) + randint(1, 5)) - gdGameStats1(4)
If a >= 5 Then
P2msg = P2msg & " 2:Critical!!"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(3, 5))
ElseIf a >= 1 Then
P2msg = P2msg & " 2:Hits"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2) + randint(0, 3))
ElseIf a = 0 Then
P2msg = P2msg & " 2:Almost Missed"
gdGameStats1(1) = gdGameStats1(1) - (gdGameStats2(2))
ElseIf a <= -1 Then
P2msg = P2msg & " 2:Misses"
gdGameStats1(1) = gdGameStats1(1)
End If
gdGameStats2(3) = gdPlayer2(4)
Else '// All Possible Options Are Depleted, Show Error
P2msg = gdPlayer2 & " :gdActionChosen Error"
AddChat vbRed, "P2 gdActionPlayer2 is Incorrect --> ", vbBlue, gdActionPlayer2
End If
AddQ P1msg
AddQ P2msg

If gdGameStats2(1) <= 0 And gdGameStats1(1) > 0 Then '// Player 1 Wins
gdPlayer1(6) = gdPlayer1(6) + gdPointsPerKill
AddChat gdPlayer1(1) & " Has Killed " & gdPlayer2(1)
gdGameOn = False
gdChallenge = False
If gdPlayer1(6) >= 100 Then Call gdLevelUp
Call gd_Event_Close
ElseIf gdGameStats1(1) <= 0 And gdGameStats2(1) > 0 Then '// Player 2 Wins
gdPlayer2(6) = gdPlayer2(6) + gdPointsPerKill
AddChat gdPlayer2(1) & " Has Killed " & gdPlayer1(1)
gdGameOn = False
gdChallenge = False
If gdPlayer2(6) >= 100 Then Call gdLevelUp
Call gd_Event_Close
ElseIf gdGameStats1(1) <= 0 And gdGameStats2(1) <= 0 Then '// Tie
gdPlayer2(6) = gdPlayer2(6) + gdPointsPerTie
gdPlayer1(6) = gdPlayer1(6) + gdPointsPerTie
AddChat gdPlayer2(1) & " And " & gdPlayer1(1) & " Have Killed Eachother!!!"
gdGameOn = False
gdChallenge = False
If gdPlayer1(6) >= 100 Then Call gdLevelUp
If gdPlayer2(6) >= 100 Then Call gdLevelUp
Call gd_Event_Close
End If
End Sub

Sub gdLevelUp(Message)

gdPlayer1(2) = gdstats.Item(gdPlayer1(1))(1) '// Stores Player1's Level
gdPlayer1(6) = gdstats.Item(gdPlayer1(1))(5) '// Stores Player1's Exp (%)
gdPlayer2(2) = gdstats.Item(gdPlayer2(1))(1) '// Stores Player2's Level
gdPlayer2(6) = gdstats.Item(gdPlayer2(1))(5) '// Stores Player2's Exp (%)

If gdPlayer1(6) >= 100 Then
gdPlayer1(2) = gdPlayer1(2) + 1
gdPlayer1(6) = gdPlayer1(6) - 100
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Have Leveled, Please tell me which stat you would like to upgrade. Atk, Acc, Eva"
gdLeveling = True
gdLvlingPlayer = gdPlayer1(1)
Exit Sub '// Wait For User Input
ElseIf gdPlayer2(6) >= 100 Then
gdPlayer2(2) = gdPlayer2(2) + 1
gdPlayer2(6) = gdPlayer2(6) - 100
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Have Leveled, Please tell me which stat you would like to upgrade. Atk, Acc, Eva"
gdLeveling = True
gdLvlingPlayer = gdPlayer2(1)
Exit Sub '// Wait For User Input
End If

If gdLeveling = False Then Exit Sub

If gdLeveling = True And Message = Atk Then
gdstats.Item(gdLvlingPlayer)(2) = gdstats.Item(gdLvlingPlayer)(2) + 1
gdLeveling = False
AddQ "/whisper " & psd2 & gdLvlingPlayer & " Thank You For Making Your Selection. Succesfully Increased Atk By ONE."
Exit Sub
ElseIf gdLeveling = True And Message = Acc Then
gdstats.Item(gdLvlingPlayer)(3) = gdstats.Item(gdLvlingPlayer)(3) + 1
gdLeveling = False
AddQ "/whisper " & psd2 & gdLvlingPlayer & " Thank You For Making Your Selection. Succesfully Increased Acc By ONE."
Exit Sub
ElseIf gdLeveling = True And Message = Eva Then
gdstats.Item(gdLvlingPlayer)(4) = gdstats.Item(gdLvlingPlayer)(4) + 1
gdLeveling = False
AddQ "/whisper " & psd2 & gdLvlingPlayer & " Thank You For Making Your Selection. Succesfully Increased Eva By ONE."
Exit Sub
ElseIf gdLeveling = True Then
AddQ "/whisper " & psd2 & gdLvlingPlayer & " Your Selection is Incorrect: " & Message & ". Please Try Again."
Exit Sub
End If
End Sub


[codebox]'gd
'1.2
'&Gun Duel:Cyber_Hunter
'&Duel <username>:Stats <Username>:Fire:Aim:Cover:Heal:Stim:Cloak
'&
'&Gun Dueling Game:Lvl your Character:Increase your stats:Battle Other Players in 1vs1 Duels

'*****UPDATE*****
'Finally found the time to test this game. Stats Command Works And Player will be recorded
'in your plugins folder in gdStats.txt. You can play around with the levels and Stats of all
'Players, but only modify the file when the bot if shutdonw, outherwise your changes will be
'lost.
'Ver: 1.2
'Ok, at least now the script doesn't give error messages, but the problem is it won't
'do much at all. The commands dont't work but I know that the bot is going through the
'subs. Need to figure out what stoping the commands from being executed.


'Ver: 1.1
'First Basic Script. Still Many bugs to work out, Won't work yet because of a
'loading error that i can't seem to fix. After I finally fix this the script will
'be workable. Hope that will happen soon.

Public gdstats '// Holds All Player Stats
Public gdfso '// Holds fso
Public gdsaved '// Save Info On Shutdown
Public gdGameOn '// Holds the Game Status (Game On/Off)
Public gdChallenge '// Holds Challenge Status
Public gdDonePlayer1 '// Holds Turn Information
Public gdDonePlayer2 '// Holds Turn Information
Public gdLeveling '// Sends messages directly to gdLevelUp
Public gdLvlingPlayer '// Holds Leveling Players Name
Public gdActionPlayer1 '// Holds Player Action
Public gdActionPlayer2 '// Holds Player Action
Private gdPlayer1(6) '// Holds Challengers Stats
Private gdPlayer2(6) '// Holds Other Players Stats
Private gdGameStats1(4) '// Holds InGame Stats
Private gdGameStats2(4) '// Holds InGame Stats
Private gdStatsLookup(4) '// Holds Stats for gdStats Commands
Public gdFilePath '// Stat File FilePath

'//ACCESS (This will later be changed for use in the pluginsettings.txt file)

Const gdDuel_Access = -1 '// Default -> -1 (No Access)

'//COMMAND NAMES (These will later be changed for use in the pluginsettings.txt file)

Const gdDuel_Command = "duel" '// Used To Challange Player.
Const gdStats_Command = "stats" '// Used to check stats.
Const gdFire_Command = "fire" '// Simple Attack Command.
Const
cyber_hunter
I figured i'd stop using the codebox, cause i seem to be doing somthing wrong with it to many times, so here is the file. I will post the current date anytime this link is updated. I still have a lot of testing and tweaking to do before it's good to use, but it's most basic function, saving the players, works better then i thought it would.

Gun Duel Plugin (Right-Click>Save As)


Saturday, December 15th, 2007
cyber_hunter
Friday, December 21st, 2007
Lil tech guy
wow u worked on that for 5 years. i hope it works and will be a successful "gun duel" in the future
cyber_hunter
You Dont Understand. I've been working on this script for a few months now, but before that, i didn't make any scripts for 5 years. Anyways, I thought i'd update it again, the indenting was removed when i copied it from notepad, so now it's updated with the indenting, much easyer to read.

Gun Duel Plugin (Right-Click>Save As)
Friday December 21st, 2007
cyber_hunter
Thursday December 27th, 2007
raylu
CODE
Const gdFire_Command = "Ffre" '// Simple Attack Command.
...
ElseIf LCase(massage) = BotVars.Trigger & gdFire_Command And myAccess >= gdDuel_Access Then

That should be lower-case, I believe.
cyber_hunter
CODE
Const gdFire_Command = "fire" '// Simple Attack Command.

Select Case Split(LCase(Message), " ")(0)
    Case LCase(gdDuel_Command): gdDuel Username, Message
    Case LCase(gdStats_Command): gdStatReturn Username, Message
    Case LCase(gdFire_Command): gdFire Username, Message
    Case LCase(gdgdAim_Command): gdAim Username, Message
    Case LCase(gdgdCover_Command): gdCover Username, Message
    Case LCase(gdgdHeal_Command): gdgdHeal Username, Message
    Case LCase(gdgdStim_Command): gdgdStim Username, Message
    Case LCase(gdgdCloak_Command): gdCloak Username, Message
End Select


Covered on both ends in 1.3
Thx for testing
raylu
Oops. I relied on Firefox's find...sorry.
I didn't actually test it either tongue.gif. I'm too lazy for that.

CODE
Function doShot(ByVal a, ByRef gdGS1, ByVal gdGS2)
If a >= 5 Then
   doShot = "hits for critical!!"
   gdGS1 = gdGS1 - (gdGS2 + randint(3, 5))
ElseIf a >= 1 Then
   doShot = "hits."
   gdGS1 = gdGS1 - (gdGS2 + randint(0, 3))
ElseIf a = 0 Then
   doShot = "barely hit."
   gdGS1 = gdGS1 - gdGS2
ElseIf a <= -1 Then
   doShot = "misses."
End If
End Function

I hope this makes up for it.
cyber_hunter
CODE

Function doShot(ByVal a, ByRef gdGS1, ByVal gdGS2)
If a >= 5 Then
   doShot = "hits for critical!!"
   gdGS1 = gdGS1 - (gdGS2 + randint(3, 5))
ElseIf a >= 1 Then
   doShot = "hits."
   gdGS1 = gdGS1 - (gdGS2 + randint(0, 3))
ElseIf a = 0 Then
   doShot = "barely hit."
   gdGS1 = gdGS1 - gdGS2
ElseIf a <= -1 Then
   doShot = "misses."
End If
End Function

I'm not really good with functions, so I have one question. I understand that with ByRef, I can modify the stat, but will it modify the stat for the game (the original stat sent to the function)
raylu
ByVal means the function gets a copy of the value of the argument.
ByRef means the function gets the actual variable.

CODE
a = 0
b = 1
assign a, b

Sub assign(ByVal x, ByRef y)
x = 10
y = 11
End Sub

a will be 0, b will be 11
cyber_hunter
I wish I had known of those earlyer. This will reduce the size of the script by at least a few dozen lines. thanx raylu

Also, testing is going REALLY slow. Testers are hard to find, and the ones i was "using" to test are not very active. I'll still be testing and doing all i can to get this fully operational, but it might take a while for the next updates.
cyber_hunter
Ok, I've been trying to test the changes i made using raylu's code, modified a little bit to work with the rest of the plugin, but i can't find any testers (My clan is kinda going under fast). If anyone wants to help me test, I would love to load my bot to your channel. I will only accept invitations from either clan leaders or somone that can speak for them, I don't feel like causing trouble in a channel i'm not welcomed too.

Thanx to anyone willing to put up with me and my bot. Plz send the invitation in a msg and please include a clan Name and Channel with leader\founder username. I will then confirm with the Founder\Leader. Thx again if your willing to help with the testing.

Btw, My current bot's name is Mist[Vlidor]@lordaeron if you wish to talk to me, I can also load bots in any of the realms (East, West, Europe and Asia)

Thx again for all your help.
cyber_hunter
CODE

'gd
'1.4
'&Gun Duel:Cyber_Hunter
'&Duel <username>:Stats <Username>:Fire:Aim:Cover:Heal:Stim:Cloak
'&
'&Gun Dueling Game:Lvl your Character:Increase your stats:Battle Other Players in 1vs1 Duels

'Ver: 1.4
'All shots taken have been made into a function (Thanks To: raylu)
'This version should not have errors, although i have only tested it the way it should be used
'Anyone who tests this version should try everything to create an error
'This will be the final version unless errors are found or new ideas can be added

'Ver: 1.3
'Finally, a working version. This one will work well, probably has an error here or there.
'-Removed All Instances of the command "Call". Doesn't seem to work well with Sb
'-Fixed Some Variables That Where Spelled Wrong. sad.gif
'-Replaced All Random Numbers With One Function (Thanks To: Jack)
'-Added An Hp Reply After Both Players Have Finished Their Turn
'-COMPLETLY Diablo2 COMPATIBLE (Has Been Tested with a D2 Bot)
'-If you find any errors or wish to give an idea, just message me in the forums

'*****UPDATE*****
'Still needs more testing, but im getting some progress with most errors. I haven't tested
'it completly yet so i'm still working on it.
'-Fixed an error that caused every attack command to cause an internal error
'-Fixed a few bugs involving the usernames (Now all in Lower Case)
'-Changed from using "Call" to using "Select Case", looks alot nicer biggrin.gif
'-Fixed an error with the Stat check before a duel.
'-Added Reply For In-Game Commands. (Fire, Aim, ect...)

'*****UPDATE*****
'Finally found the time to test this game. Stats Command Works And Player will be recorded
'in your plugins folder in gdStats.txt. You can play around with the levels and Stats of all
'Players, but only modify the file when the bot if shutdonw, outherwise your changes will be
'lost.

'Ver: 1.2
'Ok, at least now the script doesn't give error messages, but the problem is it won't
'do much at all. The commands dont't work but I know that the bot is going through the
'subs. Need to figure out what stoping the commands from being executed.


'Ver: 1.1
'First Basic Script. Still Many bugs to work out, Won't work yet because of a
'loading error that i can't seem to fix. After I finally fix this the script will
'be workable. Hope that will happen soon.

Public gdstats '// Holds All Player Stats
Public gdfso '// Holds fso
Public gdsaved '// Save Info On Shutdown
Public gdGameOn '// Holds the Game Status (Game On/Off)
Public gdChallenge '// Holds Challenge Status
Public gdDonePlayer1 '// Holds Turn Information
Public gdDonePlayer2 '// Holds Turn Information
Public gdLeveling '// Sends messages directly to gdLevelUp
Public gdLvlingPlayer '// Holds Leveling Players Name
Public gdActionPlayer1 '// Holds Player Action
Public gdActionPlayer2 '// Holds Player Action
Public gdPlayer1(6) '// Holds Challengers Stats
Public gdPlayer2(6) '// Holds Other Players Stats
Public gdGameStats1(4) '// Holds InGame Stats
Public gdGameStats2(4) '// Holds InGame Stats
Public gdStatsLookup(4) '// Holds Stats for gdStats Commands
Public gdFilePath '// Stat File FilePath
Public gdTest '// Used To Workout Errors

'//ACCESS (This will later be changed for use in the pluginsettings.txt file)

Const gdDuel_Access = -1 '// Default -> -1 (No Access)

'//COMMAND NAMES (These will later be changed for use in the pluginsettings.txt file)

Const gdDuel_Command = "duel" '// Used To Challange Player.
Const gdStats_Command = "stats" '// Used to check stats.
Const gdFire_Command = "fire" '// Simple Attack Command.
Const gdAim_Command = "aim" '// Skip a turn for 100% Accurcy.
Const gdCover_Command = "cover" '// Increase you Evasion, Decrease your Accurcy.
Const gdHeal_Command = "heal" '// Used to heal yourself.
Const gdStim_Command = "stim" '// Used to attack twice while losing 5hp.
Const gdCloak_Command = "cloak" '// Increase your evasion for one attack.


'//LEVEL REQUIREMENT (These will later be changed for use in the pluginsettings.txt file)

Const gdFire_Level = 1 '// Default -> 1
Const gdAim_Level = 1 '// Default -> 1
Const gdCover_Level = 1 '// Default -> 1
Const gdHeal_Level = 1 '// Default -> 1
Const gdStim_Level = 5 '// Default -> 5
Const gdCloak_Level = 15 '// Default -> 15

'//OTHER USER-SELECTED VARIABLES (These will later be changed for use in the pluginsettings.txt file)

Const gdUserFilePath = "plugins\gdStats.txt"
Const gdPointsPerKill = 5 '// Experience per Kill (%)
Const gdPointsPerTie = 1 '// Experience per Tie (%)

Sub gd_event_Load()

Dim TempStr
gdFilePath = BotPath & gdUserFilePath
Set gdstats = CreateObject("Scripting.Dictionary")
Set gdfso = CreateObject("Scripting.FileSystemObject")

If gdfso.FileExists(gdFilePath) Then '// If File Exists, Retrieves Information
Set gdsaved = gdfso.OpenTextFile(gdFilePath, 1, False)
Do While Not gdsaved.AtEndOfStream
TempStr = Split(gdsaved.ReadLine, " ")
gdstats.Add TempStr(0), Array(TempStr(1), TempStr(2), TempStr(3), TempStr(4), TempStr(5))
Loop
gdsaved.Close
Set gdsaved = Nothing
Else '// If File Does Not Exists, Gives a Welcome Msg >>> The File Will Be Created With Other Subs
AddChat vbBlue, "Welcome To Gun Duel. Thank you for testing the script."
AddChat vbCyan, "All the variables for the Duel can be changed in the plugin file."
End If


gdGameOn = "False"
gdChallenge = "False"
End Sub



Sub gd_event_UserTalk(Username, Flags, Message, Ping)

Dim MyAccess, MyFlags
GetDBEntry Username, MyAccess, MyFlags


Message = Trim(Message)
Username = LCase(Username)

If gdstats.Exists(Username) = False Then
gdstats.Add Username, Array("1", "1", "1", "1", "0") '// All Users in channel that talk will be added
AddQ "/whisper " & psd2 & Username & " You have been added to the Gun Duel Player List."
End If

If gdLeveling = "True" And Username = gdLvlingPlayer Then '// Checks to see if a Player Is Leveling
gdLevelUp Message
ElseIf gdLeveling = "True" And Username <> gdLvlingPlayer And Left(Message, Len(BotVars.Trigger)) <> BotVars.Trigger Then '// If A Player Is Leveling, Inform Player That He Has To Wait
AddQ "/whisper " & psd2 & Username & " I'm Helping " & gdLvlingPlayer & ". Please wait while they finish."
End If

If gdChallenge = "True" And Username = gdPlayer2(1) And LCase(Message) = "yes" Then '//Player Has Accepted Challenge, Store All Needed Info For The Match
gdGameOn = "True"
gdPlayer1(2) = gdstats.Item(gdPlayer1(1))(0) '// Stores Player1's Level
gdPlayer1(3) = gdstats.Item(gdPlayer1(1))(1) '// Stores Player1's Attack
gdPlayer1(4) = gdstats.Item(gdPlayer1(1))(2) '// Stores Player1's Accurcy
gdPlayer1(5) = gdstats.Item(gdPlayer1(1))(3) '// Stores Player1's Evasion
gdPlayer1(6) = gdstats.Item(gdPlayer1(1))(4) '// Stores Player1's Exp (%)
gdPlayer2(2) = gdstats.Item(gdPlayer2(1))(0) '// Stores Player2's Level
gdPlayer2(3) = gdstats.Item(gdPlayer2(1))(1) '// Stores Player2's Attack
gdPlayer2(4) = gdstats.Item(gdPlayer2(1))(2) '// Stores Player2's Accurcy
gdPlayer2(5) = gdstats.Item(gdPlayer2(1))(3) '// Stores Player2's Evasion
gdPlayer2(6) = gdstats.Item(gdPlayer2(1))(4) '// Stores Player2's Exp (%)
gdGameStats1(1) = gdPlayer1(2) * 5 '// Stores InGame HP
gdGameStats1(2) = gdPlayer1(3) '// Stores InGame Attack
gdGameStats1(3) = gdPlayer1(4) '// Stores InGame Accurcy
gdGameStats1(4) = gdPlayer1(5) '// Stores InGame Evasion
gdGameStats2(1) = gdPlayer1(2) * 5 '// Stores InGame HP
gdGameStats2(2) = gdPlayer1(3) '// Stores InGame Attack
gdGameStats2(3) = gdPlayer1(4) '// Stores InGame Accurcy
gdGameStats2(4) = gdPlayer1(5) '// Stores InGame Evasion
gdDonePlayer1 = "False"
gdDonePlayer2 = "False"
AddQ "A Duel Has Started Between " & gdPlayer1(1) & "(Level " & gdPlayer1(2) & ") And " & gdPlayer2(1) & "(Level " & gdPlayer2(2) & ")"
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You can now attack."
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You can now attack."
ElseIf gdChallenge = "True" And Username = msgUsername And LCase(Message) = "no" Then
AddQ Username & " has refused the Duel Challenge."
Exit Sub
End If

If Left(Message, Len(BotVars.Trigger)) <> BotVars.Trigger Then
Exit Sub
Else
Message = Replace(Message, BotVars.Trigger, "", 1, 1) '// Remove The Trigger From Message
End If

If gdDuel_Access > MyAccess Then Exit Sub

Select Case Split(LCase(Message), " ")(0)
Case LCase(gdDuel_Command): gdDuel Username, Message
Case LCase(gdStats_Command): gdStatReturn Username, Message
Case LCase(gdFire_Command): gdFire Username, Message
Case LCase(gdAim_Command): gdAim Username, Message
Case LCase(gdCover_Command): gdCover Username, Message
Case LCase(gdHeal_Command): gdHeal Username, Message
Case LCase(gdStim_Command): gdStim Username, Message
Case LCase(gdCloak_Command): gdCloak Username, Message
End Select

End Sub

Sub gd_Event_WhisperFromUser(Username, Flags, Message)

gd_event_UserTalk Username, Flags, Message, 1

End Sub

Sub gd_Event_Close()
Dim TempStr

Set gdsaved = gdfso.OpenTextFile(gdFilePath, 2, True)
For Each Key In gdstats.Keys '// Puts All info into a file
TempStr = Key & " " & gdstats.Item(Key)(0) & " " & gdstats.Item(Key)(1) & " " & gdstats.Item(Key)(2) & " " & gdstats.Item(Key)(3) & " " & gdstats.Item(Key)(4)
gdsaved.WriteLine TempStr
Next
gdsaved.Close
Set gdsaved = Nothing
End Sub

Sub gdDuel(Username, Message)

If gdGameOn = "True" Then '// Checks for current duels
AddQ "/whisper " & psd2 & Username & " a duel is currently in progress. Please wait for this duel to end."
Exit Sub
End If

User = Split(Message, " ")
msgUsername = LCase(User(1))

If GetPositionByName(msgUsername) = -1 Then '// Checks for user in channel
AddQ "/whisper " & psd2 & Username & " " & msgUsername & " is not currently in the channel."
Exit Sub
Else
AddQ "/whisper " & psd2 & msgUsername & " " & Username & " has challenged you to a duel."
AddQ "/whisper " & psd2 & msgUsername & " Whisper me 'Yes' or 'NO'."
gdChallenge = "True"
gdPlayer1(1) = Username
gdPlayer2(1) = msgUsername
End If
End Sub

Sub gdStatReturn(Username, Message)

User = Split(Message, " ")
msgUsername = User(1)

If LCase(msgUsername) = "me" Then '// Change Username Incase of "me"
msgUsername = Username
End If

If Not gdstats.Exists(msgUsername) Then '// Checks for user in dictionary
AddQ "/whisper " & psd2 & Username & " This Player does not exist."
Exit Sub
Else
gdStatsLookup(0) = gdstats.Item(msgUsername)(0)
gdStatsLookup(1) = gdstats.Item(msgUsername)(1)
gdStatsLookup(2) = gdstats.Item(msgUsername)(2)
gdStatsLookup(3) = gdstats.Item(msgUsername)(3)
gdStatsLookup(4) = gdstats.Item(msgUsername)(4)
AddQ "/whisper " & psd2 & Username & " " & msgUsername & " Level:" & gdStatsLookup(0) & " Attack:" & gdStatsLookup(1) & " Accurcy:" & gdStatsLookup(2) & " Evasion:" & gdStatsLookup(3) & " Experience(%):" & gdStatsLookup(4)
End If
End Sub


Sub gdFire(Username, Message)

If gdstats.Item(Username)(1) < gdFire_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1(1) And gdDonePlayer1 = "False" Then
gdDonePlayer1 = "True"
gdActionPlayer1 = 1
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Have Fired One Shoot."
ElseIf Username = gdPlayer2(1) And gdDonePlayer2 = "False" Then
gdDonePlayer2 = "True"
gdActionPlayer2 = 1
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Have Fired One Shoot."
End If

AddChat vbBlue, Username & " " & gdPlayer1(1) & " " & gdPlayer2(1) & " " & gdDonePlayer1 & " " & gdDonePlayer2

If gdDonePlayer1 = "True" And gdDonePlayer2 = "True" Then
gdActionChosen
End If
End Sub

Sub gdAim(Username, Message)

If gdstats.Item(Username)(1) < gdAim_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1 And gdDonePlayer1 = "False" Then
gdDonePlayer1 = "True"
gdActionPlayer1 = 2
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Aim Your Next Shoot."
ElseIf Username = gdPlayer2 And gdDonePlayer2 = "False" Then
gdDonePlayer2 = "True"
gdActionPlayer2 = 2
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Aim Your Next Shoot."
End If

If gdDonePlayer1 = "True" And gdDonePlayer2 = "True" Then
gdActionChosen
End If
End Sub

Sub gdCover(Username, Message)

If gdstats.Item(Username)(1) < gdCover_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1 And gdDonePlayer1 = "False" Then
gdDonePlayer1 = "True"
gdActionPlayer1 = 3
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Take Cover And Shoot."
ElseIf Username = gdPlayer2 And gdDonePlayer2 = "False" Then
gdDonePlayer2 = "True"
gdActionPlayer2 = 3
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Take Cover And Shoot."
End If

If gdDonePlayer1 = "True" And gdDonePlayer2 = "True" Then
gdActionChosen
End If
End Sub

Sub gdHeal(Username, Message)

If gdstats.Item(Username)(1) < gdHeal_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1 And gdDonePlayer1 = "False" Then
gdDonePlayer1 = "True"
gdActionPlayer1 = 4
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Heal Yourself."
ElseIf Username = gdPlayer2 And gdDonePlayer2 = "False" Then
gdDonePlayer2 = "True"
gdActionPlayer2 = 4
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Heal Yourself."
End If

If gdDonePlayer1 = "True" And gdDonePlayer2 = "True" Then
gdActionChosen
End If
End Sub

Sub gdStim(Username, Message)

If gdstats.Item(Username)(1) < gdStim_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1 And gdDonePlayer1 = "False" Then
gdDonePlayer1 = "True"
gdActionPlayer1 = 5
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Fire Two Shoots."
ElseIf Username = gdPlayer2 And gdDonePlayer2 = "False" Then
gdDonePlayer2 = "True"
gdActionPlayer2 = 5
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Fire Two Shoots."
End If

If gdDonePlayer1 = "True" And gdDonePlayer2 = "True" Then
gdActionChosen
End If
End Sub

Sub gdCloak(Username, Message)

If gdstats.Item(Username)(1) < gdCloak_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1 And gdDonePlayer1 = "False" Then
gdDonePlayer1 = "True"
gdActionPlayer1 = 6
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Cloak And Shoot."
ElseIf Username = gdPlayer2 And gdDonePlayer2 = "False" Then
gdDonePlayer2 = "True"
gdActionPlayer2 = 6
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Cloak And Shoot."
End If

If gdDonePlayer1 = "True" And gdDonePlayer2 = "True" Then
gdActionChosen
End If
End Sub

Sub gdActionChosen()

gdDonePlayer1 = "False"
gdDonePlayer2 = "False"

If gdActionPlayer1 = 1 Then '// Action: Fire
P1msg = gdPlayer1(1) & " Fires One Round At " & gdPlayer2(1)
a = (gdGameStats1(3) + (RanNum(1, 6) - 3)) - gdGameStats2(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

gdGameStats1(3) = gdPlayer1(4)
gdGameStats1(4) = gdPlayer1(5)
ElseIf gdActionPlayer1 = 2 Then '// Action: Aim
P1msg = gdPlayer1(1) & " Takes Aim At " & gdPlayer2(1)
gdGameStats1(3) = 999
gdGameStats1(4) = gdPlayer1(5)
ElseIf gdActionPlayer1 = 3 Then '// Action: Cover
P1msg = gdPlayer1(1) & " Takes Cover And Fires At " & gdPlayer2(1)
gdGameStats1(3) = gdPlayer1(4) - 1
gdGameStats1(4) = gdPlayer1(5) + 1
a = (gdGameStats1(3) + (RanNum(1, 6) - 3)) - gdGameStats2(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

ElseIf gdActionPlayer1 = 4 Then '// Action: Heal
P1msg = gdPlayer1(1) & " Heals"
gdGameStats1(1) = gdGameStats1(1) + RanNum(1, 5)
gdGameStats1(3) = gdPlayer1(4)
gdGameStats1(4) = gdPlayer1(5)
ElseIf gdActionPlayer1 = 5 Then '// Action: Stim
P1msg = gdPlayer1(1) & " Fires Two Rounds At " & gdPlayer2(1)
gdGameStats1(1) = gdGameStats1(1) - 4
a = (gdGameStats1(3) + (RanNum(1, 6) - 3)) - gdGameStats2(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

a = (gdGameStats1(3) + (RanNum(1, 6) - 3)) - gdGameStats2(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

gdGameStats1(3) = gdPlayer1(4)
gdGameStats1(4) = gdPlayer1(5)
ElseIf gdActionPlayer1 = 6 Then '// Action: Cloak
P1msg = gdPlayer1(1) & " Cloaks And Fires At " & gdPlayer2(1)
gdGameStats1(4) = 999
a = (gdGameStats1(3) + (RanNum(1, 6) - 3)) - gdGameStats2(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

gdGameStats1(3) = gdPlayer1(4)
Else '// All Possible Options Are Depleted, Show Error
P1msg = gdPlayer1(1) & " :gdActionChosen Error"
AddChat vbRed, "P1 gdActionPlayer1 is Incorrect --> ", vbBlue, gdActionPlayer1
End If


If gdActionPlayer2 = 1 Then '// Action: Fire
P2msg = gdPlayer2(1) & " Fires One Round At " & gdPlayer1(1)
a = (gdGameStats2(3) + (RanNum(1, 6) - 3)) - gdGameStats1(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

gdGameStats2(3) = gdPlayer2(4)
gdGameStats2(4) = gdPlayer2(5)
ElseIf gdActionPlayer2 = 2 Then '// Action: Aim
P1msg = gdPlayer2(1) & " Takes Aim At " & gdPlayer1(1)
gdGameStats2(3) = 999
gdGameStats2(4) = gdPlayer2(5)
ElseIf gdActionPlayer2 = 3 Then '// Action: Cover
P1msg = gdPlayer2(1) & " Takes Cover And Fires At " & gdPlayer1(1)
gdGameStats2(3) = gdPlayer2(4) - 1
gdGameStats2(4) = gdPlayer2(5) + 1
a = (gdGameStats1(3) + (RanNum(1, 6) - 3)) - gdGameStats2(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

ElseIf gdActionPlayer2 = 4 Then '// Action: Heal
P2msg = gdPlayer2(1) & " Heals"
gdGameStats1(1) = gdGameStats1(1) + RanNum(1, 5)
gdGameStats2(3) = gdPlayer2(4)
gdGameStats2(4) = gdPlayer2(5)
ElseIf gdActionPlayer2 = 5 Then '// Action: Stim
P2msg = gdPlayer2(1) & " Fires Two Rounds At " & gdPlayer1(1)
gdGameStats2(1) = gdGameStats2(1) - 4
a = (gdGameStats2(3) + (RanNum(1, 6) - 3)) - gdGameStats1(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

a = (gdGameStats2(3) + (RanNum(1, 6) - 3)) - gdGameStats1(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

gdGameStats2(3) = gdPlayer2(4)
gdGameStats2(4) = gdPlayer2(5)
ElseIf gdActionPlayer2 = 6 Then '// Action: Cloak
P2msg = gdPlayer2(1) & " Cloaks And Fires At " & gdPlayer1(1)
gdGameStats2(4) = 999
a = (gdGameStats2(3) + (RanNum(1, 6) - 3)) - gdGameStats1(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

gdGameStats2(3) = gdPlayer2(4)
Else '// All Possible Options Are Depleted, Show Error
P2msg = gdPlayer2(1) & " :gdActionChosen Error"
AddChat vbRed, "P2 gdActionPlayer2 is Incorrect --> ", vbBlue, gdActionPlayer2
End If

AddChat vbBlue, "checkpoint"

AddQ P1msg
AddQ P2msg
AddQ gdPlayer1(1) & " Hp: " & gdGameStats1(1) & " || " & gdPlayer2(1) & " Hp: " & gdGameStats2(1)
AddChat vbRed, "checkpoint"

If gdGameStats2(1) < 1 And gdGameStats1(1) > 0 Then '// Player 1 Wins
gdPlayer1(6) = gdPlayer1(6) + gdPointsPerKill
AddChat gdPlayer1(1) & " Has Killed " & gdPlayer2(1)
gdGameOn = "False"
gdChallenge = "False"
If gdPlayer1(6) >= 100 Then gdLevelUp
gd_Event_Close
ElseIf gdGameStats1(1) < 1 And gdGameStats2(1) > 0 Then '// Player 2 Wins
gdPlayer2(6) = gdPlayer2(6) + gdPointsPerKill
AddChat gdPlayer2(1) & " Has Killed " & gdPlayer1(1)
gdGameOn = "False"
gdChallenge = "False"
If gdPlayer2(6) >= 100 Then gdLevelUp
gd_Event_Close
ElseIf gdGameStats1(1) < 1 And gdGameStats2(1) < 1 Then '// Tie
gdPlayer2(6) = gdPlayer2(6) + gdPointsPerTie
gdPlayer1(6) = gdPlayer1(6) + gdPointsPerTie
AddChat gdPlayer2(1) & " And " & gdPlayer1(1) & " Have Killed Eachother!!!"
gdGameOn = "False"
gdChallenge = "False"
If gdPlayer1(6) >= 100 Then gdLevelUp
If gdPlayer2(6) >= 100 Then gdLevelUp
gd_Event_Close
End If

AddChat vbBlue, "checkpoint"

End Sub

Sub gdLevelUp(Message)

gdPlayer1(2) = gdstats.Item(gdPlayer1(1))(1) '// Stores Player1's Level
gdPlayer1(6) = gdstats.Item(gdPlayer1(1))(5) '// Stores Player1's Exp (%)
gdPlayer2(2) = gdstats.Item(gdPlayer2(1))(1) '// Stores Player2's Level
gdPlayer2(6) = gdstats.Item(gdPlayer2(1))(5) '// Stores Player2's Exp (%)

If gdPlayer1(6) >= 100 Then
gdPlayer1(2) = gdPlayer1(2) + 1
gdPlayer1(6) = gdPlayer1(6) - 100
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Have Leveled, Please tell me which stat you would like to upgrade. Atk, Acc, Eva"
gdLeveling = True
gdLvlingPlayer = gdPlayer1(1)
Exit Sub '// Wait For User Input
ElseIf gdPlayer2(6) >= 100 Then
gdPlayer2(2) = gdPlayer2(2) + 1
gdPlayer2(6) = gdPlayer2(6) - 100
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Have Leveled, Please tell me which stat you would like to upgrade. Atk, Acc, Eva"
gdLeveling = True
gdLvlingPlayer = gdPlayer2(1)
Exit Sub '// Wait For User Input
End If

If gdLeveling = False Then Exit Sub

If gdLeveling = True And Message = Atk Then
gdstats.Item(gdLvlingPlayer)(2) = gdstats.Item(gdLvlingPlayer)(2) + 1
gdLeveling = False
AddQ "/whisper " & psd2 & gdLvlingPlayer & " Thank You For Making Your Selection. Succesfully Increased Atk By ONE."
Exit Sub
ElseIf gdLeveling = True And Message = Acc Then
gdstats.Item(gdLvlingPlayer)(3) = gdstats.Item(gdLvlingPlayer)(3) + 1
gdLeveling = False
AddQ "/whisper " & psd2 & gdLvlingPlayer & " Thank You For Making Your Selection. Succesfully Increased Acc By ONE."
Exit Sub
ElseIf gdLeveling = True And Message = Eva Then
gdstats.Item(gdLvlingPlayer)(4) = gdstats.Item(gdLvlingPlayer)(4) + 1
gdLeveling = False
AddQ "/whisper " & psd2 & gdLvlingPlayer & " Thank You For Making Your Selection. Succesfully Increased Eva By ONE."
Exit Sub
ElseIf gdLeveling = True Then
AddQ "/whisper " & psd2 & gdLvlingPlayer & " Your Selection is Incorrect: " & Message & ". Please Try Again."
Exit Sub
End If
End Sub

Private Function DoShot(ByRef Pmsg, ByVal a, ByVal gdAtk, ByRef gdHP)
If a >= 5 Then
Pmsg = Pmsg & " Critical!! "
gdHP = gdHP - (gdAtk + RanNum(1, 5))
ElseIf a >= 1 Then
Pmsg = Pmsg & " Hits "
gdHP = gdHP - (gdAtk + RanNum(0, 3))
ElseIf a = 0 Then
Pmsg = Pmsg & " Almost Missed "
gdHP = gdHP - (gdAtk)
ElseIf a <= -1 Then
Pmsg = Pmsg & " Misses "
gdHP = gdGameStats1(1)
End If

DoShot = "Shot Fired"
End Function

Private Function RanNum(minimum, maximum)
RanNum = Int(((maximum + 1) - (minimum)) * Rnd + (minimum))
End Function
HearthCore
QUOTE(cyber_hunter @ Jan 8 2008, 05:23 PM) *

Ok, I've been trying to test the changes i made using raylu's code, modified a little bit to work with the rest of the plugin, but i can't find any testers (My clan is kinda going under fast). If anyone wants to help me test, I would love to load my bot to your channel. I will only accept invitations from either clan leaders or somone that can speak for them, I don't feel like causing trouble in a channel i'm not welcomed too.

Thanx to anyone willing to put up with me and my bot. Plz send the invitation in a msg and please include a clan Name and Channel with leader\founder username. I will then confirm with the Founder\Leader. Thx again if your willing to help with the testing.

Btw, My current bot's name is Mist[Vlidor]@lordaeron if you wish to talk to me, I can also load bots in any of the realms (East, West, Europe and Asia)

Thx again for all your help.


Hey Cyber - i'd like to test it all with you.
Since i am on Northrend and 2nd Leader of Clan WnD i'd welcome you there!
If you enter the channel you'll notice 4 other bots :>
2 StealthBot
2 Self Customized LainEth
(All running on my Root Server)

So.. i'd offer BOT help aswell if you need some more to speak with you :3
cyber_hunter
CODE

'gd
'1.4
'&Gun Duel:Cyber_Hunter
'&Duel <username>:Stats <Username>:Fire:Aim:Cover:Heal:Stim:Cloak:Delete
'&
'&Gun Dueling Game:Lvl your Character:Increase your stats:Battle Other Players in 1vs1 Duels

'******UPDATE******
'Added a delete command, use "\delete me" to reset your own char

'Ver: 1.4
'All shots taken have been made into a function (Thanks To: raylu)
'This version should not have errors, although i have only tested it the way it should be used
'Anyone who tests this version should try everything to create an error
'This will be the final version unless errors are found or new ideas can be added

'Ver: 1.3
'Finally, a working version. This one will work well, probably has an error here or there.
'-Removed All Instances of the command "Call". Doesn't seem to work well with Sb
'-Fixed Some Variables That Where Spelled Wrong. sad.gif
'-Replaced All Random Numbers With One Function (Thanks To: Jack)
'-Added An Hp Reply After Both Players Have Finished Their Turn
'-COMPLETLY Diablo2 COMPATIBLE (Has Been Tested with a D2 Bot)
'-If you find any errors or wish to give an idea, just message me in the forums

'*****UPDATE*****
'Still needs more testing, but im getting some progress with most errors. I haven't tested
'it completly yet so i'm still working on it.
'-Fixed an error that caused every attack command to cause an internal error
'-Fixed a few bugs involving the usernames (Now all in Lower Case)
'-Changed from using "Call" to using "Select Case", looks alot nicer biggrin.gif
'-Fixed an error with the Stat check before a duel.
'-Added Reply For In-Game Commands. (Fire, Aim, ect...)

'*****UPDATE*****
'Finally found the time to test this game. Stats Command Works And Player will be recorded
'in your plugins folder in gdStats.txt. You can play around with the levels and Stats of all
'Players, but only modify the file when the bot if shutdonw, outherwise your changes will be
'lost.

'Ver: 1.2
'Ok, at least now the script doesn't give error messages, but the problem is it won't
'do much at all. The commands dont't work but I know that the bot is going through the
'subs. Need to figure out what stoping the commands from being executed.


'Ver: 1.1
'First Basic Script. Still Many bugs to work out, Won't work yet because of a
'loading error that i can't seem to fix. After I finally fix this the script will
'be workable. Hope that will happen soon.

Public gdstats '// Holds All Player Stats
Public gdfso '// Holds fso
Public gdsaved '// Save Info On Shutdown
Public gdGameOn '// Holds the Game Status (Game On/Off)
Public gdChallenge '// Holds Challenge Status
Public gdDonePlayer1 '// Holds Turn Information
Public gdDonePlayer2 '// Holds Turn Information
Public gdLeveling '// Sends messages directly to gdLevelUp
Public gdLvlingPlayer '// Holds Leveling Players Name
Public gdActionPlayer1 '// Holds Player Action
Public gdActionPlayer2 '// Holds Player Action
Public gdPlayer1(6) '// Holds Challengers Stats
Public gdPlayer2(6) '// Holds Other Players Stats
Public gdGameStats1(4) '// Holds InGame Stats
Public gdGameStats2(4) '// Holds InGame Stats
Public gdStatsLookup(4) '// Holds Stats for gdStats Commands
Public gdFilePath '// Stat File FilePath
Public gdTest '// Used To Workout Errors

'//ACCESS (This will later be changed for use in the pluginsettings.txt file)

Const gdDuel_Access = -1 '// Default -> -1 (No Access)
Const gdDel_Access = 50 '// Default -> 50 (Users with this access can delete ANY player)

'//COMMAND NAMES (These will later be changed for use in the pluginsettings.txt file)

Const gdDuel_Command = "duel" '// Used To Challange Player.
Const gdStats_Command = "stats" '// Used to check stats.
Const gdFire_Command = "fire" '// Simple Attack Command.
Const gdAim_Command = "aim" '// Skip a turn for 100% Accurcy.
Const gdCover_Command = "cover" '// Increase you Evasion, Decrease your Accurcy.
Const gdHeal_Command = "heal" '// Used to heal yourself.
Const gdStim_Command = "stim" '// Used to attack twice while losing 5hp.
Const gdCloak_Command = "cloak" '// Increase your evasion for one attack.
Const gdDelete_Command = "delete" '// Used to delete characters

'//LEVEL REQUIREMENT (These will later be changed for use in the pluginsettings.txt file)

Const gdFire_Level = 1 '// Default -> 1
Const gdAim_Level = 1 '// Default -> 1
Const gdCover_Level = 1 '// Default -> 1
Const gdHeal_Level = 1 '// Default -> 1
Const gdStim_Level = 5 '// Default -> 5
Const gdCloak_Level = 15 '// Default -> 15

'//OTHER USER-SELECTED VARIABLES (These will later be changed for use in the pluginsettings.txt file)

Const gdUserFilePath = "plugins\gdStats.txt"
Const gdPointsPerKill = 5 '// Experience per Kill (%)
Const gdPointsPerTie = 1 '// Experience per Tie (%)

Sub gd_event_Load()

Dim TempStr
gdFilePath = BotPath & gdUserFilePath
Set gdstats = CreateObject("Scripting.Dictionary")
Set gdfso = CreateObject("Scripting.FileSystemObject")

If gdfso.FileExists(gdFilePath) Then '// If File Exists, Retrieves Information
Set gdsaved = gdfso.OpenTextFile(gdFilePath, 1, False)
Do While Not gdsaved.AtEndOfStream
TempStr = Split(gdsaved.ReadLine, " ")
gdstats.Add TempStr(0), Array(TempStr(1), TempStr(2), TempStr(3), TempStr(4), TempStr(5))
Loop
gdsaved.Close
Set gdsaved = Nothing
Else '// If File Does Not Exists, Gives a Welcome Msg >>> The File Will Be Created With Other Subs
AddChat vbBlue, "Welcome To Gun Duel. Thank you for testing the script."
AddChat vbCyan, "All the variables for the Duel can be changed in the plugin file."
End If


gdGameOn = "False"
gdChallenge = "False"
End Sub



Sub gd_event_UserTalk(Username, Flags, Message, Ping)

Dim MyAccess, MyFlags
GetDBEntry Username, MyAccess, MyFlags


Message = Trim(Message)
Username = LCase(Username)

If gdstats.Exists(Username) = False Then
gdstats.Add Username, Array("1", "1", "1", "1", "0") '// All Users in channel that talk will be added
AddQ "/whisper " & psd2 & Username & " You have been added to the Gun Duel Player List."
End If

If gdLeveling = "True" And Username = gdLvlingPlayer Then '// Checks to see if a Player Is Leveling
gdLevelUp Message
ElseIf gdLeveling = "True" And Username <> gdLvlingPlayer And Left(Message, Len(BotVars.Trigger)) <> BotVars.Trigger Then '// If A Player Is Leveling, Inform Player That He Has To Wait
AddQ "/whisper " & psd2 & Username & " I'm Helping " & gdLvlingPlayer & ". Please wait while they finish."
End If

If gdChallenge = "True" And Username = gdPlayer2(1) And LCase(Message) = "yes" Then '//Player Has Accepted Challenge, Store All Needed Info For The Match
gdGameOn = "True"
gdPlayer1(2) = gdstats.Item(gdPlayer1(1))(0) '// Stores Player1's Level
gdPlayer1(3) = gdstats.Item(gdPlayer1(1))(1) '// Stores Player1's Attack
gdPlayer1(4) = gdstats.Item(gdPlayer1(1))(2) '// Stores Player1's Accurcy
gdPlayer1(5) = gdstats.Item(gdPlayer1(1))(3) '// Stores Player1's Evasion
gdPlayer1(6) = gdstats.Item(gdPlayer1(1))(4) '// Stores Player1's Exp (%)
gdPlayer2(2) = gdstats.Item(gdPlayer2(1))(0) '// Stores Player2's Level
gdPlayer2(3) = gdstats.Item(gdPlayer2(1))(1) '// Stores Player2's Attack
gdPlayer2(4) = gdstats.Item(gdPlayer2(1))(2) '// Stores Player2's Accurcy
gdPlayer2(5) = gdstats.Item(gdPlayer2(1))(3) '// Stores Player2's Evasion
gdPlayer2(6) = gdstats.Item(gdPlayer2(1))(4) '// Stores Player2's Exp (%)
gdGameStats1(1) = gdPlayer1(2) * 5 '// Stores InGame HP
gdGameStats1(2) = gdPlayer1(3) '// Stores InGame Attack
gdGameStats1(3) = gdPlayer1(4) '// Stores InGame Accurcy
gdGameStats1(4) = gdPlayer1(5) '// Stores InGame Evasion
gdGameStats2(1) = gdPlayer1(2) * 5 '// Stores InGame HP
gdGameStats2(2) = gdPlayer1(3) '// Stores InGame Attack
gdGameStats2(3) = gdPlayer1(4) '// Stores InGame Accurcy
gdGameStats2(4) = gdPlayer1(5) '// Stores InGame Evasion
gdDonePlayer1 = "False"
gdDonePlayer2 = "False"
AddQ "A Duel Has Started Between " & gdPlayer1(1) & "(Level " & gdPlayer1(2) & ") And " & gdPlayer2(1) & "(Level " & gdPlayer2(2) & ")"
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You can now attack."
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You can now attack."
ElseIf gdChallenge = "True" And Username = msgUsername And LCase(Message) = "no" Then
AddQ Username & " has refused the Duel Challenge."
Exit Sub
End If

If Left(Message, Len(BotVars.Trigger)) <> BotVars.Trigger Then
Exit Sub
Else
Message = Replace(Message, BotVars.Trigger, "", 1, 1) '// Remove The Trigger From Message
End If

If gdDuel_Access > MyAccess Then Exit Sub

Select Case Split(LCase(Message), " ")(0)
Case LCase(gdDuel_Command): gdDuel Username, Message
Case LCase(gdStats_Command): gdStatReturn Username, Message
Case LCase(gdFire_Command): gdFire Username, Message
Case LCase(gdAim_Command): gdAim Username, Message
Case LCase(gdCover_Command): gdCover Username, Message
Case LCase(gdHeal_Command): gdHeal Username, Message
Case LCase(gdStim_Command): gdStim Username, Message
Case LCase(gdCloak_Command): gdCloak Username, Message
Case LCase(gdDelete_Command): gdDel Username, Message
End Select

End Sub

Sub gd_Event_WhisperFromUser(Username, Flags, Message)

gd_event_UserTalk Username, Flags, Message, 1

End Sub

Sub gd_Event_Close()
Dim TempStr

Set gdsaved = gdfso.OpenTextFile(gdFilePath, 2, True)
For Each Key In gdstats.Keys '// Puts All info into a file
TempStr = Key & " " & gdstats.Item(Key)(0) & " " & gdstats.Item(Key)(1) & " " & gdstats.Item(Key)(2) & " " & gdstats.Item(Key)(3) & " " & gdstats.Item(Key)(4)
gdsaved.WriteLine TempStr
Next
gdsaved.Close
Set gdsaved = Nothing
End Sub

Sub gdDel(Username, Message)

GetDBEntry Username, MyAccess, MyFlags

User = Split(Message, " ")
msgUsername = User(1)

If LCase(msgUsername) = "me" Then '// Change Username Incase of "me"
msgUsername = Username
ElseIf gdDel_Access > MyAccess Then '// Checks For User Access To This Command, Unless Deleting Themselfs (Reset Char)
AddQ "/whisper " & psd2 & Username & " Your access is to low to delete other players."
Exit Sub
End If

If gdGameOn = "True" Then '// Checks for current duels
AddQ "/whisper " & psd2 & Username & " a duel is currently in progress. Please wait for this duel to end."
Exit Sub
End If

If gdstats.Exists(msgUsername) = False Then
AddQ "/whisper " & psd2 & Username & " Player does not exist."
Exit Sub
Else
gdstats.Remove msgUsername
AddQ "/whisper " & psd2 & Username & " " & msgUsername & " has been deleted."
End If

End Sub

Sub gdDuel(Username, Message)

If gdGameOn = "True" Then '// Checks for current duels
AddQ "/whisper " & psd2 & Username & " a duel is currently in progress. Please wait for this duel to end."
Exit Sub
End If

User = Split(Message, " ")
msgUsername = LCase(User(1))

If GetPositionByName(msgUsername) = -1 Then '// Checks for user in channel
AddQ "/whisper " & psd2 & Username & " " & msgUsername & " is not currently in the channel."
Exit Sub
Else
AddQ "/whisper " & psd2 & msgUsername & " " & Username & " has challenged you to a duel."
AddQ "/whisper " & psd2 & msgUsername & " Whisper me 'Yes' or 'NO'."
gdChallenge = "True"
gdPlayer1(1) = Username
gdPlayer2(1) = msgUsername
End If
End Sub

Sub gdStatReturn(Username, Message)

User = Split(Message, " ")
msgUsername = User(1)

If LCase(msgUsername) = "me" Then '// Change Username Incase of "me"
msgUsername = Username
End If

If Not gdstats.Exists(msgUsername) Then '// Checks for user in dictionary
AddQ "/whisper " & psd2 & Username & " This Player does not exist."
Exit Sub
Else
gdStatsLookup(0) = gdstats.Item(msgUsername)(0)
gdStatsLookup(1) = gdstats.Item(msgUsername)(1)
gdStatsLookup(2) = gdstats.Item(msgUsername)(2)
gdStatsLookup(3) = gdstats.Item(msgUsername)(3)
gdStatsLookup(4) = gdstats.Item(msgUsername)(4)
AddQ "/whisper " & psd2 & Username & " " & msgUsername & " Level:" & gdStatsLookup(0) & " Attack:" & gdStatsLookup(1) & " Accurcy:" & gdStatsLookup(2) & " Evasion:" & gdStatsLookup(3) & " Experience(%):" & gdStatsLookup(4)
End If
End Sub


Sub gdFire(Username, Message)

If gdstats.Item(Username)(1) < gdFire_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1(1) And gdDonePlayer1 = "False" Then
gdDonePlayer1 = "True"
gdActionPlayer1 = 1
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Have Fired One Shoot."
ElseIf Username = gdPlayer2(1) And gdDonePlayer2 = "False" Then
gdDonePlayer2 = "True"
gdActionPlayer2 = 1
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Have Fired One Shoot."
End If

AddChat vbBlue, Username & " " & gdPlayer1(1) & " " & gdPlayer2(1) & " " & gdDonePlayer1 & " " & gdDonePlayer2

If gdDonePlayer1 = "True" And gdDonePlayer2 = "True" Then
gdActionChosen
End If
End Sub

Sub gdAim(Username, Message)

If gdstats.Item(Username)(1) < gdAim_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1 And gdDonePlayer1 = "False" Then
gdDonePlayer1 = "True"
gdActionPlayer1 = 2
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Aim Your Next Shoot."
ElseIf Username = gdPlayer2 And gdDonePlayer2 = "False" Then
gdDonePlayer2 = "True"
gdActionPlayer2 = 2
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Aim Your Next Shoot."
End If

If gdDonePlayer1 = "True" And gdDonePlayer2 = "True" Then
gdActionChosen
End If
End Sub

Sub gdCover(Username, Message)

If gdstats.Item(Username)(1) < gdCover_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1 And gdDonePlayer1 = "False" Then
gdDonePlayer1 = "True"
gdActionPlayer1 = 3
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Take Cover And Shoot."
ElseIf Username = gdPlayer2 And gdDonePlayer2 = "False" Then
gdDonePlayer2 = "True"
gdActionPlayer2 = 3
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Take Cover And Shoot."
End If

If gdDonePlayer1 = "True" And gdDonePlayer2 = "True" Then
gdActionChosen
End If
End Sub

Sub gdHeal(Username, Message)

If gdstats.Item(Username)(1) < gdHeal_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1 And gdDonePlayer1 = "False" Then
gdDonePlayer1 = "True"
gdActionPlayer1 = 4
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Heal Yourself."
ElseIf Username = gdPlayer2 And gdDonePlayer2 = "False" Then
gdDonePlayer2 = "True"
gdActionPlayer2 = 4
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Heal Yourself."
End If

If gdDonePlayer1 = "True" And gdDonePlayer2 = "True" Then
gdActionChosen
End If
End Sub

Sub gdStim(Username, Message)

If gdstats.Item(Username)(1) < gdStim_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1 And gdDonePlayer1 = "False" Then
gdDonePlayer1 = "True"
gdActionPlayer1 = 5
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Fire Two Shoots."
ElseIf Username = gdPlayer2 And gdDonePlayer2 = "False" Then
gdDonePlayer2 = "True"
gdActionPlayer2 = 5
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Fire Two Shoots."
End If

If gdDonePlayer1 = "True" And gdDonePlayer2 = "True" Then
gdActionChosen
End If
End Sub

Sub gdCloak(Username, Message)

If gdstats.Item(Username)(1) < gdCloak_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1 And gdDonePlayer1 = "False" Then
gdDonePlayer1 = "True"
gdActionPlayer1 = 6
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Cloak And Shoot."
ElseIf Username = gdPlayer2 And gdDonePlayer2 = "False" Then
gdDonePlayer2 = "True"
gdActionPlayer2 = 6
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Cloak And Shoot."
End If

If gdDonePlayer1 = "True" And gdDonePlayer2 = "True" Then
gdActionChosen
End If
End Sub

Sub gdActionChosen()

gdDonePlayer1 = "False"
gdDonePlayer2 = "False"

If gdActionPlayer1 = 1 Then '// Action: Fire
P1msg = gdPlayer1(1) & " Fires One Round At " & gdPlayer2(1)
a = (gdGameStats1(3) + (RanNum(1, 6) - 3)) - gdGameStats2(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

gdGameStats1(3) = gdPlayer1(4)
gdGameStats1(4) = gdPlayer1(5)
ElseIf gdActionPlayer1 = 2 Then '// Action: Aim
P1msg = gdPlayer1(1) & " Takes Aim At " & gdPlayer2(1)
gdGameStats1(3) = 999
gdGameStats1(4) = gdPlayer1(5)
ElseIf gdActionPlayer1 = 3 Then '// Action: Cover
P1msg = gdPlayer1(1) & " Takes Cover And Fires At " & gdPlayer2(1)
gdGameStats1(3) = gdPlayer1(4) - 1
gdGameStats1(4) = gdPlayer1(5) + 1
a = (gdGameStats1(3) + (RanNum(1, 6) - 3)) - gdGameStats2(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

ElseIf gdActionPlayer1 = 4 Then '// Action: Heal
P1msg = gdPlayer1(1) & " Heals"
gdGameStats1(1) = gdGameStats1(1) + RanNum(1, 5)
gdGameStats1(3) = gdPlayer1(4)
gdGameStats1(4) = gdPlayer1(5)
ElseIf gdActionPlayer1 = 5 Then '// Action: Stim
P1msg = gdPlayer1(1) & " Fires Two Rounds At " & gdPlayer2(1)
gdGameStats1(1) = gdGameStats1(1) - 4
a = (gdGameStats1(3) + (RanNum(1, 6) - 3)) - gdGameStats2(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

a = (gdGameStats1(3) + (RanNum(1, 6) - 3)) - gdGameStats2(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

gdGameStats1(3) = gdPlayer1(4)
gdGameStats1(4) = gdPlayer1(5)
ElseIf gdActionPlayer1 = 6 Then '// Action: Cloak
P1msg = gdPlayer1(1) & " Cloaks And Fires At " & gdPlayer2(1)
gdGameStats1(4) = 999
a = (gdGameStats1(3) + (RanNum(1, 6) - 3)) - gdGameStats2(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

gdGameStats1(3) = gdPlayer1(4)
Else '// All Possible Options Are Depleted, Show Error
P1msg = gdPlayer1(1) & " :gdActionChosen Error"
AddChat vbRed, "P1 gdActionPlayer1 is Incorrect --> ", vbBlue, gdActionPlayer1
End If


If gdActionPlayer2 = 1 Then '// Action: Fire
P2msg = gdPlayer2(1) & " Fires One Round At " & gdPlayer1(1)
a = (gdGameStats2(3) + (RanNum(1, 6) - 3)) - gdGameStats1(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

gdGameStats2(3) = gdPlayer2(4)
gdGameStats2(4) = gdPlayer2(5)
ElseIf gdActionPlayer2 = 2 Then '// Action: Aim
P1msg = gdPlayer2(1) & " Takes Aim At " & gdPlayer1(1)
gdGameStats2(3) = 999
gdGameStats2(4) = gdPlayer2(5)
ElseIf gdActionPlayer2 = 3 Then '// Action: Cover
P1msg = gdPlayer2(1) & " Takes Cover And Fires At " & gdPlayer1(1)
gdGameStats2(3) = gdPlayer2(4) - 1
gdGameStats2(4) = gdPlayer2(5) + 1
a = (gdGameStats1(3) + (RanNum(1, 6) - 3)) - gdGameStats2(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

ElseIf gdActionPlayer2 = 4 Then '// Action: Heal
P2msg = gdPlayer2(1) & " Heals"
gdGameStats1(1) = gdGameStats1(1) + RanNum(1, 5)
gdGameStats2(3) = gdPlayer2(4)
gdGameStats2(4) = gdPlayer2(5)
ElseIf gdActionPlayer2 = 5 Then '// Action: Stim
P2msg = gdPlayer2(1) & " Fires Two Rounds At " & gdPlayer1(1)
gdGameStats2(1) = gdGameStats2(1) - 4
a = (gdGameStats2(3) + (RanNum(1, 6) - 3)) - gdGameStats1(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

a = (gdGameStats2(3) + (RanNum(1, 6) - 3)) - gdGameStats1(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

gdGameStats2(3) = gdPlayer2(4)
gdGameStats2(4) = gdPlayer2(5)
ElseIf gdActionPlayer2 = 6 Then '// Action: Cloak
P2msg = gdPlayer2(1) & " Cloaks And Fires At " & gdPlayer1(1)
gdGameStats2(4) = 999
a = (gdGameStats2(3) + (RanNum(1, 6) - 3)) - gdGameStats1(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

gdGameStats2(3) = gdPlayer2(4)
Else '// All Possible Options Are Depleted, Show Error
P2msg = gdPlayer2(1) & " :gdActionChosen Error"
AddChat vbRed, "P2 gdActionPlayer2 is Incorrect --> ", vbBlue, gdActionPlayer2
End If

AddChat vbBlue, "checkpoint"

AddQ P1msg
AddQ P2msg
AddQ gdPlayer1(1) & " Hp: " & gdGameStats1(1) & " || " & gdPlayer2(1) & " Hp: " & gdGameStats2(1)
AddChat vbRed, "checkpoint"

If gdGameStats2(1) < 1 And gdGameStats1(1) > 0 Then '// Player 1 Wins
gdPlayer1(6) = gdPlayer1(6) + gdPointsPerKill
AddChat gdPlayer1(1) & " Has Killed " & gdPlayer2(1)
gdGameOn = "False"
gdChallenge = "False"
If gdPlayer1(6) >= 100 Then gdLevelUp
gd_Event_Close
ElseIf gdGameStats1(1) < 1 And gdGameStats2(1) > 0 Then '// Player 2 Wins
gdPlayer2(6) = gdPlayer2(6) + gdPointsPerKill
AddChat gdPlayer2(1) & " Has Killed " & gdPlayer1(1)
gdGameOn = "False"
gdChallenge = "False"
If gdPlayer2(6) >= 100 Then gdLevelUp
gd_Event_Close
ElseIf gdGameStats1(1) < 1 And gdGameStats2(1) < 1 Then '// Tie
gdPlayer2(6) = gdPlayer2(6) + gdPointsPerTie
gdPlayer1(6) = gdPlayer1(6) + gdPointsPerTie
AddChat gdPlayer2(1) & " And " & gdPlayer1(1) & " Have Killed Eachother!!!"
gdGameOn = "False"
gdChallenge = "False"
If gdPlayer1(6) >= 100 Then gdLevelUp
If gdPlayer2(6) >= 100 Then gdLevelUp
gd_Event_Close
End If

AddChat vbBlue, "checkpoint"

End Sub

Sub gdLevelUp(Message)

gdPlayer1(2) = gdstats.Item(gdPlayer1(1))(1) '// Stores Player1's Level
gdPlayer1(6) = gdstats.Item(gdPlayer1(1))(5) '// Stores Player1's Exp (%)
gdPlayer2(2) = gdstats.Item(gdPlayer2(1))(1) '// Stores Player2's Level
gdPlayer2(6) = gdstats.Item(gdPlayer2(1))(5) '// Stores Player2's Exp (%)

If gdPlayer1(6) >= 100 Then
gdPlayer1(2) = gdPlayer1(2) + 1
gdPlayer1(6) = gdPlayer1(6) - 100
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Have Leveled, Please tell me which stat you would like to upgrade. Atk, Acc, Eva"
gdLeveling = True
gdLvlingPlayer = gdPlayer1(1)
Exit Sub '// Wait For User Input
ElseIf gdPlayer2(6) >= 100 Then
gdPlayer2(2) = gdPlayer2(2) + 1
gdPlayer2(6) = gdPlayer2(6) - 100
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Have Leveled, Please tell me which stat you would like to upgrade. Atk, Acc, Eva"
gdLeveling = True
gdLvlingPlayer = gdPlayer2(1)
Exit Sub '// Wait For User Input
End If

If gdLeveling = False Then Exit Sub

If gdLeveling = True And Message = Atk Then
gdstats.Item(gdLvlingPlayer)(2) = gdstats.Item(gdLvlingPlayer)(2) + 1
gdLeveling = False
AddQ "/whisper " & psd2 & gdLvlingPlayer & " Thank You For Making Your Selection. Succesfully Increased Atk By ONE."
Exit Sub
ElseIf gdLeveling = True And Message = Acc Then
gdstats.Item(gdLvlingPlayer)(3) = gdstats.Item(gdLvlingPlayer)(3) + 1
gdLeveling = False
AddQ "/whisper " & psd2 & gdLvlingPlayer & " Thank You For Making Your Selection. Succesfully Increased Acc By ONE."
Exit Sub
ElseIf gdLeveling = True And Message = Eva Then
gdstats.Item(gdLvlingPlayer)(4) = gdstats.Item(gdLvlingPlayer)(4) + 1
gdLeveling = False
AddQ "/whisper " & psd2 & gdLvlingPlayer & " Thank You For Making Your Selection. Succesfully Increased Eva By ONE."
Exit Sub
ElseIf gdLeveling = True Then
AddQ "/whisper " & psd2 & gdLvlingPlayer & " Your Selection is Incorrect: " & Message & ". Please Try Again."
Exit Sub
End If
End Sub

Private Function DoShot(ByRef Pmsg, ByVal a, ByVal gdAtk, ByRef gdHP)
If a >= 5 Then
Pmsg = Pmsg & " Critical!! "
gdHP = gdHP - (gdAtk + RanNum(1, 5))
ElseIf a >= 1 Then
Pmsg = Pmsg & " Hits "
gdHP = gdHP - (gdAtk + RanNum(0, 3))
ElseIf a = 0 Then
Pmsg = Pmsg & " Almost Missed "
gdHP = gdHP - (gdAtk)
ElseIf a <= -1 Then
Pmsg = Pmsg & " Misses "
gdHP = gdGameStats1(1)
End If

DoShot = "Shot Fired"
End Function

Private Function RanNum(minimum, maximum)
RanNum = Int(((maximum + 1) - (minimum)) * Rnd + (minimum))
End Function


Added a delete command, at the request of some testers
HearthCore
Made a little test with me and a bot of mine
QUOTE

[15:09:00] <HearthCore> .duel WnD[Vouch
[15:09:00] <To HearthCore> You have been added to the Gun Duel Player List.
[15:09:00] <To WnD[Vouch> hearthcore has challenged you to a duel.
[15:09:01] <To WnD[Vouch> Whisper me 'Yes' or 'NO'.
[15:09:12] <HearthCore> .say .duel HearthCore
[15:09:12] <WnD[Ops> .duel HearthCore
[15:09:12] <WnD[Vouch> .duel HearthCore
[15:09:12] <To WnD[Vouch> You have been added to the Gun Duel Player List.
[15:09:13] <To HearthCore> wnd[vouch has challenged you to a duel.
[15:09:15] <To HearthCore> Whisper me 'Yes' or 'NO'.
[15:09:20] <From HearthCore> Yes
[15:09:20] <WnD[Ops> A Duel Has Started Between wnd[vouch(Level 1) And hearthcore(Level 1)
[15:09:22] <To WnD[Vouch> You can now attack.
[15:09:23] <To HearthCore> You can now attack.
[15:09:29] <HearthCore> .fire
[15:09:29] hearthcore wnd[vouch hearthcore False True
[15:09:30] <To HearthCore> You Have Fired One Shoot.
[15:09:47] <HearthCore> .heal
[15:09:47] UserTalk Call Error On File> C:\Program Files\StealthBot\plugins\gd.plug
[15:09:47] Error Number: 13 Description: Type mismatch
[15:09:49] <HearthCore> .aim
[15:09:49] UserTalk Call Error On File> C:\Program Files\StealthBot\plugins\gd.plug
[15:09:49] Error Number: 13 Description: Type mismatch
[15:09:52] <HearthCore> .fire
[15:09:52] hearthcore wnd[vouch hearthcore False True
[15:10:24] <WnD[Vouch> .aim
[15:10:24] UserTalk Call Error On File> C:\Program Files\StealthBot\plugins\gd.plug
[15:10:24] Error Number: 13 Description: Type mismatch
[15:10:37] <HearthCore> .aim
[15:10:37] UserTalk Call Error On File> C:\Program Files\StealthBot\plugins\gd.plug
[15:10:37] Error Number: 13 Description: Type mismatch
[15:10:44] <WnD[Ops> .heal
[15:10:49] <WnD[Vouch> .stats
[15:10:50] UserTalk Call Error On File> C:\Program Files\StealthBot\plugins\gd.plug
[15:10:50] Error Number: 9 Description: Subscript out of range
[15:10:51] <WnD[Vouch> .heal
[15:10:51] UserTalk Call Error On File> C:\Program Files\StealthBot\plugins\gd.plug
[15:10:51] Error Number: 13 Description: Type mismatch
[15:10:54] <WnD[Vouch> .fire
[15:10:54] wnd[vouch wnd[vouch hearthcore True True
[15:10:54] Shot Fired
[15:10:54] Shot Fired
[15:10:54] checkpoint
[15:10:54] checkpoint
[15:10:54] UserTalk Call Error On File> C:\Program Files\StealthBot\plugins\gd.plug
[15:10:54] Error Number: 9 Description: Subscript out of range
[15:10:54] <To WnD[Vouch> You Have Fired One Shoot.
[15:10:54] <WnD[Ops> wnd[vouch Fires One Round At hearthcore Hits Hits
[15:10:55] <WnD[Ops> hearthcore Fires One Round At wnd[vouch
[15:10:57] <WnD[Ops> wnd[vouch Hp: 5 || hearthcore Hp: 0
[15:11:13] <WnD[Vouch> .heal
[15:11:13] UserTalk Call Error On File> C:\Program Files\StealthBot\plugins\gd.plug
[15:11:13] Error Number: 13 Description: Type mismatch
[15:11:23] <HearthCore> .fire
[15:11:23] hearthcore wnd[vouch hearthcore False True
[15:11:23] <To HearthCore> You Have Fired One Shoot.
[15:11:28] <WnD[Vouch> .fire
[15:11:28] wnd[vouch wnd[vouch hearthcore True True
[15:11:28] Shot Fired
[15:11:28] Shot Fired
[15:11:28] checkpoint
[15:11:28] checkpoint
[15:11:28] checkpoint
[15:11:28] <To WnD[Vouch> You Have Fired One Shoot.
[15:11:29] <WnD[Ops> wnd[vouch Fires One Round At hearthcore Misses Hits
[15:11:30] <WnD[Ops> hearthcore Fires One Round At wnd[vouch
[15:11:31] <WnD[Ops> wnd[vouch Hp: 5 || hearthcore Hp: 4
cyber_hunter
Damn, i forgot to remove to addchat from those, and i will fix that error

QUOTE
[15:09:47] UserTalk Call Error On File> C:\Program Files\StealthBot\plugins\gd.plug
[15:09:47] Error Number: 13 Description: Type mismatch


CODE
'gd
'gd
'1.4
'&Gun Duel:Cyber_Hunter
'&Duel <username>:Stats <Username>:Fire:Aim:Cover:Heal:Stim:Cloak:Delete
'&
'&Gun Dueling Game:Lvl your Character:Increase your stats:Battle Other Players in 1vs1 Duels

'******UPDATE******
'Added a delete command, use "\delete me" to reset your own char

'Ver: 1.4
'All shots taken have been made into a function (Thanks To: raylu)
'This version should not have errors, although i have only tested it the way it should be used
'Anyone who tests this version should try everything to create an error
'This will be the final version unless errors are found or new ideas can be added

'Ver: 1.3
'Finally, a working version. This one will work well, probably has an error here or there.
'-Removed All Instances of the command "Call". Doesn't seem to work well with Sb
'-Fixed Some Variables That Where Spelled Wrong. sad.gif
'-Replaced All Random Numbers With One Function (Thanks To: Jack)
'-Added An Hp Reply After Both Players Have Finished Their Turn
'-COMPLETLY Diablo2 COMPATIBLE (Has Been Tested with a D2 Bot)
'-If you find any errors or wish to give an idea, just message me in the forums

'*****UPDATE*****
'Still needs more testing, but im getting some progress with most errors. I haven't tested
'it completly yet so i'm still working on it.
'-Fixed an error that caused every attack command to cause an internal error
'-Fixed a few bugs involving the usernames (Now all in Lower Case)
'-Changed from using "Call" to using "Select Case", looks alot nicer biggrin.gif
'-Fixed an error with the Stat check before a duel.
'-Added Reply For In-Game Commands. (Fire, Aim, ect...)

'*****UPDATE*****
'Finally found the time to test this game. Stats Command Works And Player will be recorded
'in your plugins folder in gdStats.txt. You can play around with the levels and Stats of all
'Players, but only modify the file when the bot if shutdonw, outherwise your changes will be
'lost.

'Ver: 1.2
'Ok, at least now the script doesn't give error messages, but the problem is it won't
'do much at all. The commands dont't work but I know that the bot is going through the
'subs. Need to figure out what stoping the commands from being executed.


'Ver: 1.1
'First Basic Script. Still Many bugs to work out, Won't work yet because of a
'loading error that i can't seem to fix. After I finally fix this the script will
'be workable. Hope that will happen soon.

Public gdstats '// Holds All Player Stats
Public gdfso '// Holds fso
Public gdsaved '// Save Info On Shutdown
Public gdGameOn '// Holds the Game Status (Game On/Off)
Public gdChallenge '// Holds Challenge Status
Public gdDonePlayer1 '// Holds Turn Information
Public gdDonePlayer2 '// Holds Turn Information
Public gdLeveling '// Sends messages directly to gdLevelUp
Public gdLvlingPlayer '// Holds Leveling Players Name
Public gdActionPlayer1 '// Holds Player Action
Public gdActionPlayer2 '// Holds Player Action
Public gdPlayer1(6) '// Holds Challengers Stats
Public gdPlayer2(6) '// Holds Other Players Stats
Public gdGameStats1(4) '// Holds InGame Stats
Public gdGameStats2(4) '// Holds InGame Stats
Public gdStatsLookup(4) '// Holds Stats for gdStats Commands
Public gdFilePath '// Stat File FilePath
Public gdTest '// Used To Workout Errors

'//ACCESS (This will later be changed for use in the pluginsettings.txt file)

Const gdDuel_Access = -1 '// Default -> -1 (No Access)
Const gdDel_Access = 50 '// Default -> 50 (Users with this access can delete ANY player)

'//COMMAND NAMES (These will later be changed for use in the pluginsettings.txt file)

Const gdDuel_Command = "duel" '// Used To Challange Player.
Const gdStats_Command = "stats" '// Used to check stats.
Const gdFire_Command = "fire" '// Simple Attack Command.
Const gdAim_Command = "aim" '// Skip a turn for 100% Accurcy.
Const gdCover_Command = "cover" '// Increase you Evasion, Decrease your Accurcy.
Const gdHeal_Command = "heal" '// Used to heal yourself.
Const gdStim_Command = "stim" '// Used to attack twice while losing 5hp.
Const gdCloak_Command = "cloak" '// Increase your evasion for one attack.
Const gdDelete_Command = "delete" '// Used to delete characters

'//LEVEL REQUIREMENT (These will later be changed for use in the pluginsettings.txt file)

Const gdFire_Level = 1 '// Default -> 1
Const gdAim_Level = 1 '// Default -> 1
Const gdCover_Level = 1 '// Default -> 1
Const gdHeal_Level = 1 '// Default -> 1
Const gdStim_Level = 5 '// Default -> 5
Const gdCloak_Level = 15 '// Default -> 15

'//OTHER USER-SELECTED VARIABLES (These will later be changed for use in the pluginsettings.txt file)

Const gdUserFilePath = "plugins\gdStats.txt"
Const gdPointsPerKill = 5 '// Experience per Kill (%)
Const gdPointsPerTie = 1 '// Experience per Tie (%)

Sub gd_event_Load()

Dim TempStr
gdFilePath = BotPath & gdUserFilePath
Set gdstats = CreateObject("Scripting.Dictionary")
Set gdfso = CreateObject("Scripting.FileSystemObject")

If gdfso.FileExists(gdFilePath) Then '// If File Exists, Retrieves Information
Set gdsaved = gdfso.OpenTextFile(gdFilePath, 1, False)
Do While Not gdsaved.AtEndOfStream
TempStr = Split(gdsaved.ReadLine, " ")
gdstats.Add TempStr(0), Array(TempStr(1), TempStr(2), TempStr(3), TempStr(4), TempStr(5))
Loop
gdsaved.Close
Set gdsaved = Nothing
Else '// If File Does Not Exists, Gives a Welcome Msg >>> The File Will Be Created With Other Subs
AddChat vbBlue, "Welcome To Gun Duel. Thank you for testing the script."
AddChat vbCyan, "All the variables for the Duel can be changed in the plugin file."
End If


gdGameOn = "False"
gdChallenge = "False"
End Sub



Sub gd_event_UserTalk(Username, Flags, Message, Ping)

Dim MyAccess, MyFlags
GetDBEntry Username, MyAccess, MyFlags

Message = Trim(Message)
Username = LCase(Username)

If gdstats.Exists(Username) = False Then
gdstats.Add Username, Array("1", "1", "1", "1", "0") '// All Users in channel that talk will be added
AddQ "/whisper " & psd2 & Username & " You have been added to the Gun Duel Player List."
End If

If gdLeveling = "True" And Username = gdLvlingPlayer Then '// Checks to see if a Player Is Leveling
gdLevelUp Message
ElseIf gdLeveling = "True" And Username <> gdLvlingPlayer And Left(Message, Len(BotVars.Trigger)) <> BotVars.Trigger Then '// If A Player Is Leveling, Inform Player That He Has To Wait
AddQ "/whisper " & psd2 & Username & " I'm Helping " & gdLvlingPlayer & ". Please wait while they finish."
End If

If gdChallenge = "True" And Username = gdPlayer2(1) And LCase(Message) = "yes" Then '//Player Has Accepted Challenge, Store All Needed Info For The Match
gdGameOn = "True"
gdPlayer1(2) = gdstats.Item(gdPlayer1(1))(0) '// Stores Player1's Level
gdPlayer1(3) = gdstats.Item(gdPlayer1(1))(1) '// Stores Player1's Attack
gdPlayer1(4) = gdstats.Item(gdPlayer1(1))(2) '// Stores Player1's Accurcy
gdPlayer1(5) = gdstats.Item(gdPlayer1(1))(3) '// Stores Player1's Evasion
gdPlayer1(6) = gdstats.Item(gdPlayer1(1))(4) '// Stores Player1's Exp (%)
gdPlayer2(2) = gdstats.Item(gdPlayer2(1))(0) '// Stores Player2's Level
gdPlayer2(3) = gdstats.Item(gdPlayer2(1))(1) '// Stores Player2's Attack
gdPlayer2(4) = gdstats.Item(gdPlayer2(1))(2) '// Stores Player2's Accurcy
gdPlayer2(5) = gdstats.Item(gdPlayer2(1))(3) '// Stores Player2's Evasion
gdPlayer2(6) = gdstats.Item(gdPlayer2(1))(4) '// Stores Player2's Exp (%)
gdGameStats1(1) = gdPlayer1(2) * 10 '// Stores InGame HP
gdGameStats1(2) = gdPlayer1(3) '// Stores InGame Attack
gdGameStats1(3) = gdPlayer1(4) '// Stores InGame Accurcy
gdGameStats1(4) = gdPlayer1(5) '// Stores InGame Evasion
gdGameStats2(1) = gdPlayer1(2) * 10 '// Stores InGame HP
gdGameStats2(2) = gdPlayer1(3) '// Stores InGame Attack
gdGameStats2(3) = gdPlayer1(4) '// Stores InGame Accurcy
gdGameStats2(4) = gdPlayer1(5) '// Stores InGame Evasion
gdDonePlayer1 = "False"
gdDonePlayer2 = "False"
AddQ "A Duel Has Started Between " & gdPlayer1(1) & "(Level " & gdPlayer1(2) & ") And " & gdPlayer2(1) & "(Level " & gdPlayer2(2) & ")"
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You can now attack."
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You can now attack."
ElseIf gdChallenge = "True" And Username = msgUsername And LCase(Message) = "no" Then
AddQ Username & " has refused the Duel Challenge."
Exit Sub
End If

If Left(Message, Len(BotVars.Trigger)) <> BotVars.Trigger Then
Exit Sub
Else
Message = Replace(Message, BotVars.Trigger, "", 1, 1) '// Remove The Trigger From Message
End If

If gdDuel_Access > MyAccess Then Exit Sub

Select Case Split(LCase(Message), " ")(0)
Case LCase(gdDuel_Command): gdDuel Username, Message
Case LCase(gdStats_Command): gdStatReturn Username, Message
Case LCase(gdFire_Command): gdFire Username, Message
Case LCase(gdAim_Command): gdAim Username, Message
Case LCase(gdCover_Command): gdCover Username, Message
Case LCase(gdHeal_Command): gdHeal Username, Message
Case LCase(gdStim_Command): gdStim Username, Message
Case LCase(gdCloak_Command): gdCloak Username, Message
Case LCase(gdDelete_Command): gdDel Username, Message
End Select

End Sub

Sub gd_Event_WhisperFromUser(Username, Flags, Message)

gd_event_UserTalk Username, Flags, Message, 1

End Sub

Sub gd_Event_Close()
Dim TempStr

Set gdsaved = gdfso.OpenTextFile(gdFilePath, 2, True)
For Each Key In gdstats.Keys '// Puts All info into a file
TempStr = Key & " " & gdstats.Item(Key)(0) & " " & gdstats.Item(Key)(1) & " " & gdstats.Item(Key)(2) & " " & gdstats.Item(Key)(3) & " " & gdstats.Item(Key)(4)
gdsaved.WriteLine TempStr
Next
gdsaved.Close
Set gdsaved = Nothing
End Sub

Sub gdDel(Username, Message)

GetDBEntry Username, MyAccess, MyFlags

User = Split(Message, " ")
msgUsername = User(1)

If LCase(msgUsername) = "me" Then '// Change Username Incase of "me"
msgUsername = Username
ElseIf gdDel_Access > MyAccess Then '// Checks For User Access To This Command, Unless Deleting Themselfs (Reset Char)
AddQ "/whisper " & psd2 & Username & " Your access is to low to delete other players."
Exit Sub
End If

If gdGameOn = "True" Then '// Checks for current duels
AddQ "/whisper " & psd2 & Username & " a duel is currently in progress. Please wait for this duel to end."
Exit Sub
End If

If gdstats.Exists(msgUsername) = False Then
AddQ "/whisper " & psd2 & Username & " Player does not exist."
Exit Sub
Else
gdstats.Remove msgUsername
AddQ "/whisper " & psd2 & Username & " " & msgUsername & " has been deleted."
End If

End Sub

Sub gdDuel(Username, Message)

If gdGameOn = "True" Then '// Checks for current duels
AddQ "/whisper " & psd2 & Username & " a duel is currently in progress. Please wait for this duel to end."
Exit Sub
End If

User = Split(Message, " ")
msgUsername = LCase(User(1))

If GetPositionByName(msgUsername) = -1 Then '// Checks for user in channel
AddQ "/whisper " & psd2 & Username & " " & msgUsername & " is not currently in the channel."
Exit Sub
Else
AddQ "/whisper " & psd2 & msgUsername & " " & Username & " has challenged you to a duel."
AddQ "/whisper " & psd2 & msgUsername & " Whisper me 'Yes' or 'NO'."
gdChallenge = "True"
gdPlayer1(1) = Username
gdPlayer2(1) = msgUsername
End If
End Sub

Sub gdStatReturn(Username, Message)

User = Split(Message, " ")
msgUsername = User(1)

If LCase(msgUsername) = "me" Then '// Change Username Incase of "me"
msgUsername = Username
End If

If Not gdstats.Exists(msgUsername) Then '// Checks for user in dictionary
AddQ "/whisper " & psd2 & Username & " This Player does not exist."
Exit Sub
Else
gdStatsLookup(0) = gdstats.Item(msgUsername)(0)
gdStatsLookup(1) = gdstats.Item(msgUsername)(1)
gdStatsLookup(2) = gdstats.Item(msgUsername)(2)
gdStatsLookup(3) = gdstats.Item(msgUsername)(3)
gdStatsLookup(4) = gdstats.Item(msgUsername)(4)
AddQ "/whisper " & psd2 & Username & " " & msgUsername & " Level:" & gdStatsLookup(0) & " Attack:" & gdStatsLookup(1) & " Accurcy:" & gdStatsLookup(2) & " Evasion:" & gdStatsLookup(3) & " Experience(%):" & gdStatsLookup(4)
End If
End Sub


Sub gdFire(Username, Message)

If gdstats.Item(Username)(1) < gdFire_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1(1) And gdDonePlayer1 = "False" Then
gdDonePlayer1 = "True"
gdActionPlayer1 = 1
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Have Fired One Shoot."
ElseIf Username = gdPlayer2(1) And gdDonePlayer2 = "False" Then
gdDonePlayer2 = "True"
gdActionPlayer2 = 1
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Have Fired One Shoot."
End If

If gdDonePlayer1 = "True" And gdDonePlayer2 = "True" Then
gdActionChosen
End If
End Sub

Sub gdAim(Username, Message)

If gdstats.Item(Username)(1) < gdAim_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1 And gdDonePlayer1 = "False" Then
gdDonePlayer1 = "True"
gdActionPlayer1 = 2
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Aim Your Next Shoot."
ElseIf Username = gdPlayer2 And gdDonePlayer2 = "False" Then
gdDonePlayer2 = "True"
gdActionPlayer2 = 2
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Aim Your Next Shoot."
End If

If gdDonePlayer1 = "True" And gdDonePlayer2 = "True" Then
gdActionChosen
End If
End Sub

Sub gdCover(Username, Message)

If gdstats.Item(Username)(1) < gdCover_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1 And gdDonePlayer1 = "False" Then
gdDonePlayer1 = "True"
gdActionPlayer1 = 3
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Take Cover And Shoot."
ElseIf Username = gdPlayer2 And gdDonePlayer2 = "False" Then
gdDonePlayer2 = "True"
gdActionPlayer2 = 3
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Take Cover And Shoot."
End If

If gdDonePlayer1 = "True" And gdDonePlayer2 = "True" Then
gdActionChosen
End If
End Sub

Sub gdHeal(Username, Message)

If gdstats.Item(Username)(1) < gdHeal_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1 And gdDonePlayer1 = "False" Then
gdDonePlayer1 = "True"
gdActionPlayer1 = 4
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Heal Yourself."
ElseIf Username = gdPlayer2 And gdDonePlayer2 = "False" Then
gdDonePlayer2 = "True"
gdActionPlayer2 = 4
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Heal Yourself."
End If

If gdDonePlayer1 = "True" And gdDonePlayer2 = "True" Then
gdActionChosen
End If
End Sub

Sub gdStim(Username, Message)

If gdstats.Item(Username)(1) < gdStim_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1 And gdDonePlayer1 = "False" Then
gdDonePlayer1 = "True"
gdActionPlayer1 = 5
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Fire Two Shoots."
ElseIf Username = gdPlayer2 And gdDonePlayer2 = "False" Then
gdDonePlayer2 = "True"
gdActionPlayer2 = 5
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Fire Two Shoots."
End If

If gdDonePlayer1 = "True" And gdDonePlayer2 = "True" Then
gdActionChosen
End If
End Sub

Sub gdCloak(Username, Message)

If gdstats.Item(Username)(1) < gdCloak_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1 And gdDonePlayer1 = "False" Then
gdDonePlayer1 = "True"
gdActionPlayer1 = 6
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Cloak And Shoot."
ElseIf Username = gdPlayer2 And gdDonePlayer2 = "False" Then
gdDonePlayer2 = "True"
gdActionPlayer2 = 6
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Cloak And Shoot."
End If

If gdDonePlayer1 = "True" And gdDonePlayer2 = "True" Then
gdActionChosen
End If
End Sub

Sub gdActionChosen()

gdDonePlayer1 = "False"
gdDonePlayer2 = "False"

If gdActionPlayer1 = 1 Then '// Action: Fire
P1msg = gdPlayer1(1) & " Fires One Round At " & gdPlayer2(1)
a = (gdGameStats1(3) + (RanNum(1, 6) - 3)) - gdGameStats2(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

gdGameStats1(3) = gdPlayer1(4)
gdGameStats1(4) = gdPlayer1(5)
ElseIf gdActionPlayer1 = 2 Then '// Action: Aim
P1msg = gdPlayer1(1) & " Takes Aim At " & gdPlayer2(1)
gdGameStats1(3) = 999
gdGameStats1(4) = gdPlayer1(5)
ElseIf gdActionPlayer1 = 3 Then '// Action: Cover
P1msg = gdPlayer1(1) & " Takes Cover And Fires At " & gdPlayer2(1)
gdGameStats1(3) = gdPlayer1(4) - 1
gdGameStats1(4) = gdPlayer1(5) + 1
a = (gdGameStats1(3) + (RanNum(1, 6) - 3)) - gdGameStats2(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

ElseIf gdActionPlayer1 = 4 Then '// Action: Heal
P1msg = gdPlayer1(1) & " Heals"
gdGameStats1(1) = gdGameStats1(1) + RanNum(1, 5)
gdGameStats1(3) = gdPlayer1(4)
gdGameStats1(4) = gdPlayer1(5)
ElseIf gdActionPlayer1 = 5 Then '// Action: Stim
P1msg = gdPlayer1(1) & " Fires Two Rounds At " & gdPlayer2(1)
gdGameStats1(1) = gdGameStats1(1) - 4
a = (gdGameStats1(3) + (RanNum(1, 6) - 3)) - gdGameStats2(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

a = (gdGameStats1(3) + (RanNum(1, 6) - 3)) - gdGameStats2(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

gdGameStats1(3) = gdPlayer1(4)
gdGameStats1(4) = gdPlayer1(5)
ElseIf gdActionPlayer1 = 6 Then '// Action: Cloak
P1msg = gdPlayer1(1) & " Cloaks And Fires At " & gdPlayer2(1)
gdGameStats1(4) = 999
a = (gdGameStats1(3) + (RanNum(1, 6) - 3)) - gdGameStats2(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

gdGameStats1(3) = gdPlayer1(4)
Else '// All Possible Options Are Depleted, Show Error
P1msg = gdPlayer1(1) & " :gdActionChosen Error"
AddChat vbRed, "P1 gdActionPlayer1 is Incorrect --> ", vbBlue, gdActionPlayer1
End If


If gdActionPlayer2 = 1 Then '// Action: Fire
P2msg = gdPlayer2(1) & " Fires One Round At " & gdPlayer1(1)
a = (gdGameStats2(3) + (RanNum(1, 6) - 3)) - gdGameStats1(4)

AddChat vbBlue, DoShot(P2msg, a, gdGameStats2(2), gdGameStats1(1))

gdGameStats2(3) = gdPlayer2(4)
gdGameStats2(4) = gdPlayer2(5)
ElseIf gdActionPlayer2 = 2 Then '// Action: Aim
P1msg = gdPlayer2(1) & " Takes Aim At " & gdPlayer1(1)
gdGameStats2(3) = 999
gdGameStats2(4) = gdPlayer2(5)
ElseIf gdActionPlayer2 = 3 Then '// Action: Cover
P1msg = gdPlayer2(1) & " Takes Cover And Fires At " & gdPlayer1(1)
gdGameStats2(3) = gdPlayer2(4) - 1
gdGameStats2(4) = gdPlayer2(5) + 1
a = (gdGameStats1(3) + (RanNum(1, 6) - 3)) - gdGameStats2(4)

AddChat vbBlue, DoShot(P2msg, a, gdGameStats2(2), gdGameStats1(1))

ElseIf gdActionPlayer2 = 4 Then '// Action: Heal
P2msg = gdPlayer2(1) & " Heals"
gdGameStats1(1) = gdGameStats1(1) + RanNum(1, 5)
gdGameStats2(3) = gdPlayer2(4)
gdGameStats2(4) = gdPlayer2(5)
ElseIf gdActionPlayer2 = 5 Then '// Action: Stim
P2msg = gdPlayer2(1) & " Fires Two Rounds At " & gdPlayer1(1)
gdGameStats2(1) = gdGameStats2(1) - 4
a = (gdGameStats2(3) + (RanNum(1, 6) - 3)) - gdGameStats1(4)

AddChat vbBlue, DoShot(P2msg, a, gdGameStats2(2), gdGameStats1(1))

a = (gdGameStats2(3) + (RanNum(1, 6) - 3)) - gdGameStats1(4)

AddChat vbBlue, DoShot(P2msg, a, gdGameStats2(2), gdGameStats1(1))

gdGameStats2(3) = gdPlayer2(4)
gdGameStats2(4) = gdPlayer2(5)
ElseIf gdActionPlayer2 = 6 Then '// Action: Cloak
P2msg = gdPlayer2(1) & " Cloaks And Fires At " & gdPlayer1(1)
gdGameStats2(4) = 999
a = (gdGameStats2(3) + (RanNum(1, 6) - 3)) - gdGameStats1(4)

AddChat vbBlue, DoShot(P2msg, a, gdGameStats2(2), gdGameStats1(1))

gdGameStats2(3) = gdPlayer2(4)
Else '// All Possible Options Are Depleted, Show Error
P2msg = gdPlayer2(1) & " :gdActionChosen Error"
AddChat vbRed, "P2 gdActionPlayer2 is Incorrect --> ", vbBlue, gdActionPlayer2
End If

AddQ P1msg
AddQ P2msg
AddQ gdPlayer1(1) & " Hp: " & gdGameStats1(1) & " || " & gdPlayer2(1) & " Hp: " & gdGameStats2(1)

If gdGameStats2(1) = 0 And gdGameStats1(1) > 0 Then '// Player 1 Wins
gdPlayer1(6) = gdPlayer1(6) + gdPointsPerKill
AddChat gdPlayer1(1) & " Has Killed " & gdPlayer2(1)
gdGameOn = "False"
gdChallenge = "False"
If gdPlayer1(6) >= 100 Then gdLevelUp
gd_Event_Close
ElseIf gdGameStats1(1) = 0 And gdGameStats2(1) > 0 Then '// Player 2 Wins
gdPlayer2(6) = gdPlayer2(6) + gdPointsPerKill
AddChat gdPlayer2(1) & " Has Killed " & gdPlayer1(1)
gdGameOn = "False"
gdChallenge = "False"
If gdPlayer2(6) >= 100 Then gdLevelUp
gd_Event_Close
ElseIf gdGameStats1(1) = 0 And gdGameStats2(1) = 0 Then '// Tie
gdPlayer2(6) = gdPlayer2(6) + gdPointsPerTie
gdPlayer1(6) = gdPlayer1(6) + gdPointsPerTie
AddChat gdPlayer2(1) & " And " & gdPlayer1(1) & " Have Killed Eachother!!!"
gdGameOn = "False"
gdChallenge = "False"
If gdPlayer1(6) >= 100 Then gdLevelUp
If gdPlayer2(6) >= 100 Then gdLevelUp
gd_Event_Close
End If
End Sub

Sub gdLevelUp(Message)

gdPlayer1(2) = gdstats.Item(gdPlayer1(1))(1) '// Stores Player1's Level
gdPlayer1(6) = gdstats.Item(gdPlayer1(1))(5) '// Stores Player1's Exp (%)
gdPlayer2(2) = gdstats.Item(gdPlayer2(1))(1) '// Stores Player2's Level
gdPlayer2(6) = gdstats.Item(gdPlayer2(1))(5) '// Stores Player2's Exp (%)

If gdPlayer1(6) >= 100 Then
gdPlayer1(2) = gdPlayer1(2) + 1
gdPlayer1(6) = gdPlayer1(6) - 100
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Have Leveled, Please tell me which stat you would like to upgrade. Atk, Acc, Eva"
gdLeveling = True
gdLvlingPlayer = gdPlayer1(1)
Exit Sub '// Wait For User Input
ElseIf gdPlayer2(6) >= 100 Then
gdPlayer2(2) = gdPlayer2(2) + 1
gdPlayer2(6) = gdPlayer2(6) - 100
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Have Leveled, Please tell me which stat you would like to upgrade. Atk, Acc, Eva"
gdLeveling = True
gdLvlingPlayer = gdPlayer2(1)
Exit Sub '// Wait For User Input
End If

If gdLeveling = False Then Exit Sub

If gdLeveling = True And Message = Atk Then
gdstats.Item(gdLvlingPlayer)(2) = gdstats.Item(gdLvlingPlayer)(2) + 1
gdLeveling = False
AddQ "/whisper " & psd2 & gdLvlingPlayer & " Thank You For Making Your Selection. Succesfully Increased Atk By ONE."
Exit Sub
ElseIf gdLeveling = True And Message = Acc Then
gdstats.Item(gdLvlingPlayer)(3) = gdstats.Item(gdLvlingPlayer)(3) + 1
gdLeveling = False
AddQ "/whisper " & psd2 & gdLvlingPlayer & " Thank You For Making Your Selection. Succesfully Increased Acc By ONE."
Exit Sub
ElseIf gdLeveling = True And Message = Eva Then
gdstats.Item(gdLvlingPlayer)(4) = gdstats.Item(gdLvlingPlayer)(4) + 1
gdLeveling = False
AddQ "/whisper " & psd2 & gdLvlingPlayer & " Thank You For Making Your Selection. Succesfully Increased Eva By ONE."
Exit Sub
ElseIf gdLeveling = True Then
AddQ "/whisper " & psd2 & gdLvlingPlayer & " Your Selection is Incorrect: " & Message & ". Please Try Again."
Exit Sub
End If
End Sub

Private Function DoShot(ByRef Pmsg, ByVal a, ByVal gdAtk, ByRef gdHP)
If a >= 5 Then
Pmsg = Pmsg & " Critical!! "
gdHP = gdHP - (gdAtk + RanNum(1, 5))
ElseIf a >= 1 Then
Pmsg = Pmsg & " Hits "
gdHP = gdHP - (gdAtk + RanNum(0, 3))
ElseIf a = 0 Then
Pmsg = Pmsg & " Almost Missed "
gdHP = gdHP - (gdAtk)
ElseIf a <= -1 Then
Pmsg = Pmsg & " Misses "
gdHP = gdGameStats1(1)
End If

DoShot = "Shot Fired"
End Function

Private Function RanNum(minimum, maximum)
RanNum = Int(((maximum + 1) - (minimum)) * Rnd + (minimum))
End Function


Ok, first of all, the players health has been increased (Instead of Level*5 it's Level*10). It might be to much and create a huge gap between levels, but that will be selectable in a later release.

Second, I removed all AddChat that where not needed (I found it the easiest way to call the DoShot Funtion)

Thirdly, I had pasted the DoShot call to many times and forgot to modify it for player 2, so instead of player 2 dealing damage to player 1, he was shooting himself (or herself)

Fourth, And lastly, the check use to find out if a player is dead now checks if the Hp = 0 and not if the Hp < 1. I found out that the Hp can't go in the negative numbers for some unknown reason.

Once this is tested and working fully, I will make all the modifiable stats be modifiable in the PluginSettings file. Until then, the stats can be modified directly in the plugin.
HearthCore
Okay. I just updated my Bot with the Fixed Plugin and will test it now.

CODE
[20:44:30] <HearthCore> .duel WnD[Incubus
[20:44:30] <To WnD[Incubus> hearthcore has challenged you to a duel.
[20:44:31] <To WnD[Incubus> Whisper me 'Yes' or 'NO'.
[20:45:09] <From WnD[Incubus> yes
[20:45:09] <To WnD[Incubus> You have been added to the Gun Duel Player List.
[20:45:10] <WnD[Ops> A Duel Has Started Between hearthcore(Level 1) And wnd[incubus(Level 1)
[20:45:12] <To HearthCore> You can now attack.
[20:45:16] <To WnD[Incubus> You can now attack.
[20:45:20] <HearthCore> .fire
[20:45:21] <To HearthCore> You Have Fired One Shoot.
[20:45:24] <WnD[Incubus> .fire
[20:45:24] Shot Fired
[20:45:24] Shot Fired
[20:45:24] <To WnD[Incubus> You Have Fired One Shoot.
[20:45:25] <WnD[Ops> hearthcore Fires One Round At wnd[incubus Hits
[20:45:28] <WnD[Ops> wnd[incubus Fires One Round At hearthcore Hits
[20:45:31] <WnD[Ops> hearthcore Hp: 8 || wnd[incubus Hp: 7
[20:45:39] <HearthCore> .aim
[20:45:39] UserTalk Call Error On File> C:\Program Files\StealthBot\plugins\gd.plug
[20:45:39] Error Number: 13 Description: Type mismatch
[20:45:41] <HearthCore> .fire
[20:45:41] <To HearthCore> You Have Fired One Shoot.
[20:45:46] <WnD[Incubus> .aim
[20:45:46] UserTalk Call Error On File> C:\Program Files\StealthBot\plugins\gd.plug
[20:45:46] Error Number: 13 Description: Type mismatch
[20:45:51] <WnD[Incubus> .fire
[20:45:51] Shot Fired
[20:45:51] Shot Fired
[20:45:52] <WnD[Ops> hearthcore Fires One Round At wnd[incubus Misses
[20:45:52] <To WnD[Incubus> You Have Fired One Shoot.
[20:45:53] <WnD[Ops> wnd[incubus Fires One Round At hearthcore Hits
[20:45:54] <WnD[Ops> hearthcore Hp: 7 || wnd[incubus Hp: 8
[20:46:01] <HearthCore> .heal
[20:46:01] UserTalk Call Error On File> C:\Program Files\StealthBot\plugins\gd.plug
[20:46:01] Error Number: 13 Description: Type mismatch
[20:46:08] <WnD[Incubus> .heal
[20:46:08] UserTalk Call Error On File> C:\Program Files\StealthBot\plugins\gd.plug
[20:46:08] Error Number: 13 Description: Type mismatch
[20:46:51] <HearthCore> .cover
[20:46:51] UserTalk Call Error On File> C:\Program Files\StealthBot\plugins\gd.plug
[20:46:51] Error Number: 13 Description: Type mismatch
[20:46:53] <HearthCore> .aim
[20:46:53] UserTalk Call Error On File> C:\Program Files\StealthBot\plugins\gd.plug
[20:46:53] Error Number: 13 Description: Type mismatch
[20:46:55] <HearthCore> .heal
[20:46:55] UserTalk Call Error On File> C:\Program Files\StealthBot\plugins\gd.plug
[20:46:55] Error Number: 13 Description: Type mismatch
[20:46:55] <WnD[Incubus> .fire
[20:46:55] <To WnD[Incubus> You Have Fired One Shoot.
[20:46:56] <HearthCore> .fire
[20:46:56] Shot Fired
[20:46:56] Shot Fired
[20:46:56] <To HearthCore> You Have Fired One Shoot.
[20:46:57] <WnD[Ops> hearthcore Fires One Round At wnd[incubus Hits
[20:46:57] <WnD[Incubus> .fire
[20:46:58] <WnD[Ops> wnd[incubus Fires One Round At hearthcore Hits
[20:46:59] <WnD[Ops> hearthcore Hp: 6 || wnd[incubus Hp: 4
[20:47:02] <WnD[Incubus> .fire
[20:47:03] <To WnD[Incubus> You Have Fired One Shoot.
[20:47:08] <HearthCore> .fire
[20:47:08] Shot Fired
[20:47:08] Shot Fired
[20:47:09] <To HearthCore> You Have Fired One Shoot.
[20:47:10] <WnD[Ops> hearthcore Fires One Round At wnd[incubus Almost Missed
[20:47:12] <WnD[Ops> wnd[incubus Fires One Round At hearthcore Hits
[20:47:16] <WnD[Ops> hearthcore Hp: 2 || wnd[incubus Hp: 3
[20:47:18] <HearthCore> .fire
[20:47:19] <To HearthCore> You Have Fired One Shoot.
[20:47:20] <WnD[Incubus> .heal
[20:47:20] UserTalk Call Error On File> C:\Program Files\StealthBot\plugins\gd.plug
[20:47:20] Error Number: 13 Description: Type mismatch
[20:47:22] <WnD[Incubus> .fire
[20:47:22] Shot Fired
[20:47:22] Shot Fired
[20:47:23] <To WnD[Incubus> You Have Fired One Shoot.
[20:47:25] <WnD[Ops> hearthcore Fires One Round At wnd[incubus Almost Missed
[20:47:28] <WnD[Ops> wnd[incubus Fires One Round At hearthcore Hits
[20:47:31] <WnD[Ops> hearthcore Hp: -2 || wnd[incubus Hp: 2
[20:47:32] <WnD[Incubus> .fire
[20:47:34] <To WnD[Incubus> You Have Fired One Shoot.
[20:47:36] <HearthCore> .fire
[20:47:36] Shot Fired
[20:47:36] Shot Fired
[20:47:41] <To HearthCore> You Have Fired One Shoot.
[20:47:43] <WnD[Ops> hearthcore Fires One Round At wnd[incubus Misses
[20:47:47] <WnD[Incubus> .fire
[20:47:50] <WnD[Ops> wnd[incubus Fires One Round At hearthcore Hits
[20:47:53] <WnD[Ops> hearthcore Hp: -4 || wnd[incubus Hp: -2
[20:47:54] <WnD[Incubus> .kill
[20:48:00] <HearthCore> .stats
[20:48:00] UserTalk Call Error On File> C:\Program Files\StealthBot\plugins\gd.plug
[20:48:00] Error Number: 9 Description: Subscript out of range
[20:48:00] <To WnD[Incubus> You Have Fired One Shoot.
[20:48:02] <WnD[Incubus> .fire
[20:48:04] <HearthCore> .fire
[20:48:04] Shot Fired
[20:48:04] Shot Fired
[20:48:04] <To HearthCore> You Have Fired One Shoot.
[20:48:04] <HearthCore> .fire
[20:48:05] <WnD[Ops> hearthcore Fires One Round At wnd[incubus Hits
[20:48:05] <HearthCore> .fire
[20:48:06] <HearthCore> .fire
[20:48:08] <HearthCore> .fire
[20:48:10] <WnD[Ops> wnd[incubus Fires One Round At hearthcore Misses
[20:48:12] <WnD[Ops> hearthcore Hp: -4 || wnd[incubus Hp: -6
[20:48:14] <WnD[Incubus> .fire
[20:48:14] Shot Fired
[20:48:14] Shot Fired
[20:48:15] <WnD[Incubus> .fire
[20:48:15] <To WnD[Incubus> You Have Fired One Shoot.
[20:48:18] <To HearthCore> You Have Fired One Shoot.
[20:48:21] <To WnD[Incubus> You Have Fired One Shoot.
[20:48:27] <WnD[Ops> hearthcore Fires One Round At wnd[incubus Hits
[20:48:31] <WnD[Ops> wnd[incubus Fires One Round At hearthcore Misses
[20:48:37] <WnD[Ops> hearthcore Hp: -4 || wnd[incubus Hp: -8


I guess you should figure out whats wrong. Neither me or my opponend can die / aim / heal / cover - Access and Level is granted to lvl 1.

cyber_hunter
CODE
'gd
'1.4
'&Gun Duel:Cyber_Hunter
'&Duel <username>:Stats <Username>:Fire:Aim:Cover:Heal:Stim:Cloak:Delete
'&
'&Gun Dueling Game:Lvl your Character:Increase your stats:Battle Other Players in 1vs1 Duels

'*****UPDATE*****
'Added a delete command, use "\delete me" to reset your own char
'Modified Health to make the Duel last a bit longer
'Removed all un-needed AddChat
'Fixed DoShot calls for player 2
'Fixed Hp Check after every move
'>>>>> All Attack Commands Now Check For Game In Progress <<<<<<
'>>>>> Fixed One More Stupid Mistake Involving The Check To Find Who Was Using The Commands <<<<<

'Ver: 1.4
'All shots taken have been made into a function (Thanks To: raylu)
'This version should not have errors, although i have only tested it the way it should be used
'Anyone who tests this version should try everything to create an error
'This will be the final version unless errors are found or new ideas can be added

'Ver: 1.3
'Finally, a working version. This one will work well, probably has an error here or there.
'-Removed All Instances of the command "Call". Doesn't seem to work well with Sb
'-Fixed Some Variables That Where Spelled Wrong. sad.gif
'-Replaced All Random Numbers With One Function (Thanks To: Jack)
'-Added An Hp Reply After Both Players Have Finished Their Turn
'-COMPLETLY Diablo2 COMPATIBLE (Has Been Tested with a D2 Bot)
'-If you find any errors or wish to give an idea, just message me in the forums

'*****UPDATE*****
'Still needs more testing, but im getting some progress with most errors. I haven't tested
'it completly yet so i'm still working on it.
'-Fixed an error that caused every attack command to cause an internal error
'-Fixed a few bugs involving the usernames (Now all in Lower Case)
'-Changed from using "Call" to using "Select Case", looks alot nicer biggrin.gif
'-Fixed an error with the Stat check before a duel.
'-Added Reply For In-Game Commands. (Fire, Aim, ect...)

'*****UPDATE*****
'Finally found the time to test this game. Stats Command Works And Player will be recorded
'in your plugins folder in gdStats.txt. You can play around with the levels and Stats of all
'Players, but only modify the file when the bot if shutdonw, outherwise your changes will be
'lost.

'Ver: 1.2
'Ok, at least now the script doesn't give error messages, but the problem is it won't
'do much at all. The commands dont't work but I know that the bot is going through the
'subs. Need to figure out what stoping the commands from being executed.


'Ver: 1.1
'First Basic Script. Still Many bugs to work out, Won't work yet because of a
'loading error that i can't seem to fix. After I finally fix this the script will
'be workable. Hope that will happen soon.

Public gdstats '// Holds All Player Stats
Public gdfso '// Holds fso
Public gdsaved '// Save Info On Shutdown
Public gdGameOn '// Holds the Game Status (Game On/Off)
Public gdChallenge '// Holds Challenge Status
Public gdDonePlayer1 '// Holds Turn Information
Public gdDonePlayer2 '// Holds Turn Information
Public gdLeveling '// Sends messages directly to gdLevelUp
Public gdLvlingPlayer '// Holds Leveling Players Name
Public gdActionPlayer1 '// Holds Player Action
Public gdActionPlayer2 '// Holds Player Action
Public gdPlayer1(6) '// Holds Challengers Stats
Public gdPlayer2(6) '// Holds Other Players Stats
Public gdGameStats1(4) '// Holds InGame Stats
Public gdGameStats2(4) '// Holds InGame Stats
Public gdStatsLookup(4) '// Holds Stats for gdStats Commands
Public gdFilePath '// Stat File FilePath
Public gdTest '// Used To Workout Errors

'//ACCESS (This will later be changed for use in the pluginsettings.txt file)

Const gdDuel_Access = -1 '// Default -> -1 (No Access)
Const gdDel_Access = 50 '// Default -> 50 (Users with this access can delete ANY player)

'//COMMAND NAMES (These will later be changed for use in the pluginsettings.txt file)

Const gdDuel_Command = "duel" '// Used To Challange Player.
Const gdStats_Command = "stats" '// Used to check stats.
Const gdFire_Command = "fire" '// Simple Attack Command.
Const gdAim_Command = "aim" '// Skip a turn for 100% Accurcy.
Const gdCover_Command = "cover" '// Increase you Evasion, Decrease your Accurcy.
Const gdHeal_Command = "heal" '// Used to heal yourself.
Const gdStim_Command = "stim" '// Used to attack twice while losing 5hp.
Const gdCloak_Command = "cloak" '// Increase your evasion for one attack.
Const gdDelete_Command = "delete" '// Used to delete characters

'//LEVEL REQUIREMENT (These will later be changed for use in the pluginsettings.txt file)

Const gdFire_Level = 1 '// Default -> 1
Const gdAim_Level = 1 '// Default -> 1
Const gdCover_Level = 1 '// Default -> 1
Const gdHeal_Level = 1 '// Default -> 1
Const gdStim_Level = 5 '// Default -> 5
Const gdCloak_Level = 15 '// Default -> 15

'//OTHER USER-SELECTED VARIABLES (These will later be changed for use in the pluginsettings.txt file)

Const gdUserFilePath = "plugins\gdStats.txt"
Const gdPointsPerKill = 5 '// Experience per Kill (%)
Const gdPointsPerTie = 1 '// Experience per Tie (%)

Sub gd_event_Load()

Dim TempStr
gdFilePath = BotPath & gdUserFilePath
Set gdstats = CreateObject("Scripting.Dictionary")
Set gdfso = CreateObject("Scripting.FileSystemObject")

If gdfso.FileExists(gdFilePath) Then '// If File Exists, Retrieves Information
Set gdsaved = gdfso.OpenTextFile(gdFilePath, 1, False)
Do While Not gdsaved.AtEndOfStream
TempStr = Split(gdsaved.ReadLine, " ")
gdstats.Add TempStr(0), Array(TempStr(1), TempStr(2), TempStr(3), TempStr(4), TempStr(5))
Loop
gdsaved.Close
Set gdsaved = Nothing
Else '// If File Does Not Exists, Gives a Welcome Msg >>> The File Will Be Created With Other Subs
AddChat vbBlue, "Welcome To Gun Duel. Thank you for testing the script."
AddChat vbCyan, "All the variables for the Duel can be changed in the plugin file."
End If


gdGameOn = "False"
gdChallenge = "False"
End Sub

Sub gd_event_UserTalk(Username, Flags, Message, Ping)

Dim MyAccess, MyFlags
GetDBEntry Username, MyAccess, MyFlags

Message = Trim(Message)
Username = LCase(Username)

If gdstats.Exists(Username) = False Then
gdstats.Add Username, Array("1", "1", "1", "1", "0") '// All Users in channel that talk will be added
AddQ "/whisper " & psd2 & Username & " You have been added to the Gun Duel Player List."
End If

If gdLeveling = "True" And Username = gdLvlingPlayer Then '// Checks to see if a Player Is Leveling
gdLevelUp Message
ElseIf gdLeveling = "True" And Username <> gdLvlingPlayer And Left(Message, Len(BotVars.Trigger)) <> BotVars.Trigger Then '// If A Player Is Leveling, Inform Player That He Has To Wait
AddQ "/whisper " & psd2 & Username & " I'm Helping " & gdLvlingPlayer & ". Please wait while they finish."
End If

If gdChallenge = "True" And Username = gdPlayer2(1) And LCase(Message) = "yes" Then '//Player Has Accepted Challenge, Store All Needed Info For The Match
gdGameOn = "True"
gdPlayer1(2) = gdstats.Item(gdPlayer1(1))(0) '// Stores Player1's Level
gdPlayer1(3) = gdstats.Item(gdPlayer1(1))(1) '// Stores Player1's Attack
gdPlayer1(4) = gdstats.Item(gdPlayer1(1))(2) '// Stores Player1's Accurcy
gdPlayer1(5) = gdstats.Item(gdPlayer1(1))(3) '// Stores Player1's Evasion
gdPlayer1(6) = gdstats.Item(gdPlayer1(1))(4) '// Stores Player1's Exp (%)
gdPlayer2(2) = gdstats.Item(gdPlayer2(1))(0) '// Stores Player2's Level
gdPlayer2(3) = gdstats.Item(gdPlayer2(1))(1) '// Stores Player2's Attack
gdPlayer2(4) = gdstats.Item(gdPlayer2(1))(2) '// Stores Player2's Accurcy
gdPlayer2(5) = gdstats.Item(gdPlayer2(1))(3) '// Stores Player2's Evasion
gdPlayer2(6) = gdstats.Item(gdPlayer2(1))(4) '// Stores Player2's Exp (%)
gdGameStats1(1) = gdPlayer1(2) * 10 '// Stores InGame HP
gdGameStats1(2) = gdPlayer1(3) '// Stores InGame Attack
gdGameStats1(3) = gdPlayer1(4) '// Stores InGame Accurcy
gdGameStats1(4) = gdPlayer1(5) '// Stores InGame Evasion
gdGameStats2(1) = gdPlayer1(2) * 10 '// Stores InGame HP
gdGameStats2(2) = gdPlayer1(3) '// Stores InGame Attack
gdGameStats2(3) = gdPlayer1(4) '// Stores InGame Accurcy
gdGameStats2(4) = gdPlayer1(5) '// Stores InGame Evasion
gdDonePlayer1 = "False"
gdDonePlayer2 = "False"
AddQ "A Duel Has Started Between " & gdPlayer1(1) & "(Level " & gdPlayer1(2) & ") And " & gdPlayer2(1) & "(Level " & gdPlayer2(2) & ")"
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You can now attack."
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You can now attack."
ElseIf gdChallenge = "True" And Username = msgUsername And LCase(Message) = "no" Then
AddQ Username & " has refused the Duel Challenge."
Exit Sub
End If

If Left(Message, Len(BotVars.Trigger)) <> BotVars.Trigger Then
Exit Sub
Else
Message = Replace(Message, BotVars.Trigger, "", 1, 1) '// Remove The Trigger From Message
End If

If gdDuel_Access > MyAccess Then Exit Sub

Select Case Split(LCase(Message), " ")(0)
Case LCase(gdDuel_Command): gdDuel Username, Message
Case LCase(gdStats_Command): gdStatReturn Username, Message
Case LCase(gdDelete_Command): gdDel Username, Message
Case LCase(gdFire_Command): gdFire Username, Message
Case LCase(gdAim_Command): gdAim Username, Message
Case LCase(gdCover_Command): gdCover Username, Message
Case LCase(gdHeal_Command): gdHeal Username, Message
Case LCase(gdStim_Command): gdStim Username, Message
Case LCase(gdCloak_Command): gdCloak Username, Message
End Select

End Sub

Sub gd_Event_WhisperFromUser(Username, Flags, Message)

gd_event_UserTalk Username, Flags, Message, 1

End Sub

Sub gd_Event_Close()
Dim TempStr

Set gdsaved = gdfso.OpenTextFile(gdFilePath, 2, True)
For Each Key In gdstats.Keys '// Puts All info into a file
TempStr = Key & " " & gdstats.Item(Key)(0) & " " & gdstats.Item(Key)(1) & " " & gdstats.Item(Key)(2) & " " & gdstats.Item(Key)(3) & " " & gdstats.Item(Key)(4)
gdsaved.WriteLine TempStr
Next
gdsaved.Close
Set gdsaved = Nothing
End Sub

Sub gdDel(Username, Message)

GetDBEntry Username, MyAccess, MyFlags

User = Split(Message, " ")
msgUsername = User(1)

If LCase(msgUsername) = "me" Then '// Change Username Incase of "me"
msgUsername = Username
ElseIf gdDel_Access > MyAccess Then '// Checks For User Access To This Command, Unless Deleting Themselfs (Reset Char)
AddQ "/whisper " & psd2 & Username & " Your access is to low to delete other players."
Exit Sub
End If

If gdGameOn = "True" Then '// Checks for current duels
AddQ "/whisper " & psd2 & Username & " a duel is currently in progress. Please wait for this duel to end."
Exit Sub
End If

If gdstats.Exists(msgUsername) = False Then
AddQ "/whisper " & psd2 & Username & " Player does not exist."
Exit Sub
Else
gdstats.Remove msgUsername
AddQ "/whisper " & psd2 & Username & " " & msgUsername & " has been deleted."
End If

End Sub

Sub gdDuel(Username, Message)

If gdGameOn = "True" Then '// Checks for current duels
AddQ "/whisper " & psd2 & Username & " a duel is currently in progress. Please wait for this duel to end."
Exit Sub
End If

User = Split(Message, " ")
msgUsername = LCase(User(1))

If GetPositionByName(msgUsername) = -1 Then '// Checks for user in channel
AddQ "/whisper " & psd2 & Username & " " & msgUsername & " is not currently in the channel."
Exit Sub
Else
AddQ "/whisper " & psd2 & msgUsername & " " & Username & " has challenged you to a duel."
AddQ "/whisper " & psd2 & msgUsername & " Whisper me 'Yes' or 'NO'."
gdChallenge = "True"
gdPlayer1(1) = Username
gdPlayer2(1) = msgUsername
End If
End Sub

Sub gdStatReturn(Username, Message)

User = Split(Message, " ")
msgUsername = User(1)

If LCase(msgUsername) = "me" Then '// Change Username Incase of "me"
msgUsername = Username
End If

If Not gdstats.Exists(msgUsername) Then '// Checks for user in dictionary
AddQ "/whisper " & psd2 & Username & " This Player does not exist."
Exit Sub
Else
gdStatsLookup(0) = gdstats.Item(msgUsername)(0)
gdStatsLookup(1) = gdstats.Item(msgUsername)(1)
gdStatsLookup(2) = gdstats.Item(msgUsername)(2)
gdStatsLookup(3) = gdstats.Item(msgUsername)(3)
gdStatsLookup(4) = gdstats.Item(msgUsername)(4)
AddQ "/whisper " & psd2 & Username & " " & msgUsername & " Level:" & gdStatsLookup(0) & " Attack:" & gdStatsLookup(1) & " Accurcy:" & gdStatsLookup(2) & " Evasion:" & gdStatsLookup(3) & " Experience(%):" & gdStatsLookup(4)
End If
End Sub


Sub gdFire(Username, Message)

If gdGameOn = "False" Then
Exit Sub
End If

If gdstats.Item(Username)(0) < gdFire_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1(1) And gdDonePlayer1 = "False" Then
gdDonePlayer1 = "True"
gdActionPlayer1 = 1
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Have Fired One Shoot."
ElseIf Username = gdPlayer2(1) And gdDonePlayer2 = "False" Then
gdDonePlayer2 = "True"
gdActionPlayer2 = 1
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Have Fired One Shoot."
End If

If gdDonePlayer1 = "True" And gdDonePlayer2 = "True" Then
gdActionChosen
End If
End Sub

Sub gdAim(Username, Message)

If gdGameOn = "False" Then
Exit Sub
End If

If gdstats.Item(Username)(0) < gdAim_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

AddChat vbBlue, "Checkpoint"

If Username = gdPlayer1(1) And gdDonePlayer1 = "False" Then
gdDonePlayer1 = "True"
gdActionPlayer1 = 2
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Aim Your Next Shoot."
ElseIf Username = gdPlayer2(1) And gdDonePlayer2 = "False" Then
gdDonePlayer2 = "True"
gdActionPlayer2 = 2
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Aim Your Next Shoot."
End If

AddChat vbBlue, "Checkpoint"

If gdDonePlayer1 = "True" And gdDonePlayer2 = "True" Then
gdActionChosen
End If
End Sub

Sub gdCover(Username, Message)

If gdGameOn = "False" Then
Exit Sub
End If

If gdstats.Item(Username)(0) < gdCover_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1(1) And gdDonePlayer1 = "False" Then
gdDonePlayer1 = "True"
gdActionPlayer1 = 3
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Take Cover And Shoot."
ElseIf Username = gdPlayer2(1) And gdDonePlayer2 = "False" Then
gdDonePlayer2 = "True"
gdActionPlayer2 = 3
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Take Cover And Shoot."
End If

If gdDonePlayer1 = "True" And gdDonePlayer2 = "True" Then
gdActionChosen
End If
End Sub

Sub gdHeal(Username, Message)

If gdGameOn = "False" Then
Exit Sub
End If

If gdstats.Item(Username)(0) < gdHeal_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1(1) And gdDonePlayer1 = "False" Then
gdDonePlayer1 = "True"
gdActionPlayer1 = 4
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Heal Yourself."
ElseIf Username = gdPlayer2(1) And gdDonePlayer2 = "False" Then
gdDonePlayer2 = "True"
gdActionPlayer2 = 4
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Heal Yourself."
End If

If gdDonePlayer1 = "True" And gdDonePlayer2 = "True" Then
gdActionChosen
End If
End Sub

Sub gdStim(Username, Message)

If gdGameOn = "False" Then
Exit Sub
End If

If gdstats.Item(Username)(0) < gdStim_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1(1) And gdDonePlayer1 = "False" Then
gdDonePlayer1 = "True"
gdActionPlayer1 = 5
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Fire Two Shoots."
ElseIf Username = gdPlayer2(1) And gdDonePlayer2 = "False" Then
gdDonePlayer2 = "True"
gdActionPlayer2 = 5
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Fire Two Shoots."
End If

If gdDonePlayer1 = "True" And gdDonePlayer2 = "True" Then
gdActionChosen
End If
End Sub

Sub gdCloak(Username, Message)

If gdGameOn = "False" Then
Exit Sub
End If

If gdstats.Item(Username)(0) < gdCloak_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1(1) And gdDonePlayer1 = "False" Then
gdDonePlayer1 = "True"
gdActionPlayer1 = 6
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Cloak And Shoot."
ElseIf Username = gdPlayer2(1) And gdDonePlayer2 = "False" Then
gdDonePlayer2 = "True"
gdActionPlayer2 = 6
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Cloak And Shoot."
End If

If gdDonePlayer1 = "True" And gdDonePlayer2 = "True" Then
gdActionChosen
End If
End Sub

Sub gdActionChosen()

gdDonePlayer1 = "False"
gdDonePlayer2 = "False"

If gdActionPlayer1 = 1 Then '// Action: Fire
P1msg = gdPlayer1(1) & " Fires One Round At " & gdPlayer2(1)
a = (gdGameStats1(3) + (RanNum(1, 6) - 3)) - gdGameStats2(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

gdGameStats1(3) = gdPlayer1(4)
gdGameStats1(4) = gdPlayer1(5)
ElseIf gdActionPlayer1 = 2 Then '// Action: Aim
P1msg = gdPlayer1(1) & " Takes Aim At " & gdPlayer2(1)
gdGameStats1(3) = 999
gdGameStats1(4) = gdPlayer1(5)
ElseIf gdActionPlayer1 = 3 Then '// Action: Cover
P1msg = gdPlayer1(1) & " Takes Cover And Fires At " & gdPlayer2(1)
gdGameStats1(3) = gdPlayer1(4) - 1
gdGameStats1(4) = gdPlayer1(5) + 1
a = (gdGameStats1(3) + (RanNum(1, 6) - 3)) - gdGameStats2(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

ElseIf gdActionPlayer1 = 4 Then '// Action: Heal
P1msg = gdPlayer1(1) & " Heals"
gdGameStats1(1) = gdGameStats1(1) + RanNum(1, 5)
gdGameStats1(3) = gdPlayer1(4)
gdGameStats1(4) = gdPlayer1(5)
ElseIf gdActionPlayer1 = 5 Then '// Action: Stim
P1msg = gdPlayer1(1) & " Fires Two Rounds At " & gdPlayer2(1)
gdGameStats1(1) = gdGameStats1(1) - 4
a = (gdGameStats1(3) + (RanNum(1, 6) - 3)) - gdGameStats2(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

a = (gdGameStats1(3) + (RanNum(1, 6) - 3)) - gdGameStats2(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

gdGameStats1(3) = gdPlayer1(4)
gdGameStats1(4) = gdPlayer1(5)
ElseIf gdActionPlayer1 = 6 Then '// Action: Cloak
P1msg = gdPlayer1(1) & " Cloaks And Fires At " & gdPlayer2(1)
gdGameStats1(4) = 999
a = (gdGameStats1(3) + (RanNum(1, 6) - 3)) - gdGameStats2(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

gdGameStats1(3) = gdPlayer1(4)
Else '// All Possible Options Are Depleted, Show Error
P1msg = gdPlayer1(1) & " :gdActionChosen Error"
AddChat vbRed, "P1 gdActionPlayer1 is Incorrect --> ", vbBlue, gdActionPlayer1
End If


If gdActionPlayer2 = 1 Then '// Action: Fire
P2msg = gdPlayer2(1) & " Fires One Round At " & gdPlayer1(1)
a = (gdGameStats2(3) + (RanNum(1, 6) - 3)) - gdGameStats1(4)

AddChat vbBlue, DoShot(P2msg, a, gdGameStats2(2), gdGameStats1(1))

gdGameStats2(3) = gdPlayer2(4)
gdGameStats2(4) = gdPlayer2(5)
ElseIf gdActionPlayer2 = 2 Then '// Action: Aim
P1msg = gdPlayer2(1) & " Takes Aim At " & gdPlayer1(1)
gdGameStats2(3) = 999
gdGameStats2(4) = gdPlayer2(5)
ElseIf gdActionPlayer2 = 3 Then '// Action: Cover
P1msg = gdPlayer2(1) & " Takes Cover And Fires At " & gdPlayer1(1)
gdGameStats2(3) = gdPlayer2(4) - 1
gdGameStats2(4) = gdPlayer2(5) + 1
a = (gdGameStats1(3) + (RanNum(1, 6) - 3)) - gdGameStats2(4)

AddChat vbBlue, DoShot(P2msg, a, gdGameStats2(2), gdGameStats1(1))

ElseIf gdActionPlayer2 = 4 Then '// Action: Heal
P2msg = gdPlayer2(1) & " Heals"
gdGameStats1(1) = gdGameStats1(1) + RanNum(1, 5)
gdGameStats2(3) = gdPlayer2(4)
gdGameStats2(4) = gdPlayer2(5)
ElseIf gdActionPlayer2 = 5 Then '// Action: Stim
P2msg = gdPlayer2(1) & " Fires Two Rounds At " & gdPlayer1(1)
gdGameStats2(1) = gdGameStats2(1) - 4
a = (gdGameStats2(3) + (RanNum(1, 6) - 3)) - gdGameStats1(4)

AddChat vbBlue, DoShot(P2msg, a, gdGameStats2(2), gdGameStats1(1))

a = (gdGameStats2(3) + (RanNum(1, 6) - 3)) - gdGameStats1(4)

AddChat vbBlue, DoShot(P2msg, a, gdGameStats2(2), gdGameStats1(1))

gdGameStats2(3) = gdPlayer2(4)
gdGameStats2(4) = gdPlayer2(5)
ElseIf gdActionPlayer2 = 6 Then '// Action: Cloak
P2msg = gdPlayer2(1) & " Cloaks And Fires At " & gdPlayer1(1)
gdGameStats2(4) = 999
a = (gdGameStats2(3) + (RanNum(1, 6) - 3)) - gdGameStats1(4)

AddChat vbBlue, DoShot(P2msg, a, gdGameStats2(2), gdGameStats1(1))

gdGameStats2(3) = gdPlayer2(4)
Else '// All Possible Options Are Depleted, Show Error
P2msg = gdPlayer2(1) & " :gdActionChosen Error"
AddChat vbRed, "P2 gdActionPlayer2 is Incorrect --> ", vbBlue, gdActionPlayer2
End If

AddQ P1msg
AddQ P2msg
AddQ gdPlayer1(1) & " Hp: " & gdGameStats1(1) & " || " & gdPlayer2(1) & " Hp: " & gdGameStats2(1)

If gdGameStats2(1) = 0 And gdGameStats1(1) > 0 Then '// Player 1 Wins
gdPlayer1(6) = gdPlayer1(6) + gdPointsPerKill
AddChat gdPlayer1(1) & " Has Killed " & gdPlayer2(1)
gdGameOn = "False"
gdChallenge = "False"
If gdPlayer1(6) >= 100 Then gdLevelUp
gd_Event_Close
ElseIf gdGameStats1(1) = 0 And gdGameStats2(1) > 0 Then '// Player 2 Wins
gdPlayer2(6) = gdPlayer2(6) + gdPointsPerKill
AddChat gdPlayer2(1) & " Has Killed " & gdPlayer1(1)
gdGameOn = "False"
gdChallenge = "False"
If gdPlayer2(6) >= 100 Then gdLevelUp
gd_Event_Close
ElseIf gdGameStats1(1) = 0 And gdGameStats2(1) = 0 Then '// Tie
gdPlayer2(6) = gdPlayer2(6) + gdPointsPerTie
gdPlayer1(6) = gdPlayer1(6) + gdPointsPerTie
AddChat gdPlayer2(1) & " And " & gdPlayer1(1) & " Have Killed Eachother!!!"
gdGameOn = "False"
gdChallenge = "False"
If gdPlayer1(6) >= 100 Then gdLevelUp
If gdPlayer2(6) >= 100 Then gdLevelUp
gd_Event_Close
End If
End Sub

Sub gdLevelUp(Message)

gdPlayer1(2) = gdstats.Item(gdPlayer1(1))(1) '// Stores Player1's Level
gdPlayer1(6) = gdstats.Item(gdPlayer1(1))(5) '// Stores Player1's Exp (%)
gdPlayer2(2) = gdstats.Item(gdPlayer2(1))(1) '// Stores Player2's Level
gdPlayer2(6) = gdstats.Item(gdPlayer2(1))(5) '// Stores Player2's Exp (%)

If gdPlayer1(6) >= 100 Then
gdPlayer1(2) = gdPlayer1(2) + 1
gdPlayer1(6) = gdPlayer1(6) - 100
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Have Leveled, Please tell me which stat you would like to upgrade. Atk, Acc, Eva"
gdLeveling = True
gdLvlingPlayer = gdPlayer1(1)
Exit Sub '// Wait For User Input
ElseIf gdPlayer2(6) >= 100 Then
gdPlayer2(2) = gdPlayer2(2) + 1
gdPlayer2(6) = gdPlayer2(6) - 100
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Have Leveled, Please tell me which stat you would like to upgrade. Atk, Acc, Eva"
gdLeveling = True
gdLvlingPlayer = gdPlayer2(1)
Exit Sub '// Wait For User Input
End If

If gdLeveling = False Then Exit Sub

If gdLeveling = True And Message = Atk Then
gdstats.Item(gdLvlingPlayer)(2) = gdstats.Item(gdLvlingPlayer)(2) + 1
gdLeveling = False
AddQ "/whisper " & psd2 & gdLvlingPlayer & " Thank You For Making Your Selection. Succesfully Increased Atk By ONE."
Exit Sub
ElseIf gdLeveling = True And Message = Acc Then
gdstats.Item(gdLvlingPlayer)(3) = gdstats.Item(gdLvlingPlayer)(3) + 1
gdLeveling = False
AddQ "/whisper " & psd2 & gdLvlingPlayer & " Thank You For Making Your Selection. Succesfully Increased Acc By ONE."
Exit Sub
ElseIf gdLeveling = True And Message = Eva Then
gdstats.Item(gdLvlingPlayer)(4) = gdstats.Item(gdLvlingPlayer)(4) + 1
gdLeveling = False
AddQ "/whisper " & psd2 & gdLvlingPlayer & " Thank You For Making Your Selection. Succesfully Increased Eva By ONE."
Exit Sub
ElseIf gdLeveling = True Then
AddQ "/whisper " & psd2 & gdLvlingPlayer & " Your Selection is Incorrect: " & Message & ". Please Try Again."
Exit Sub
End If
End Sub

Private Function DoShot(ByRef Pmsg, ByVal a, ByVal gdAtk, ByRef gdHP)
If a >= 5 Then
Pmsg = Pmsg & " Critical!! "
gdHP = gdHP - (gdAtk + RanNum(1, 5))
ElseIf a >= 1 Then
Pmsg = Pmsg & " Hits "
gdHP = gdHP - (gdAtk + RanNum(0, 3))
ElseIf a = 0 Then
Pmsg = Pmsg & " Almost Missed "
gdHP = gdHP - (gdAtk)
ElseIf a <= -1 Then
Pmsg = Pmsg & " Misses "
gdHP = gdGameStats1(1)
End If

DoShot = "Shot Fired"
End Function

Private Function RanNum(minimum, maximum)
RanNum = Int(((maximum + 1) - (minimum)) * Rnd + (minimum))
End Function


The Error doesn't show anymore, Although i'm having trouble with the Level check
This is how I do it, and it's not working,
CODE
If gdstats.Item(Username)(0) < gdFire_Level Then
    AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
    Exit Sub
End If

I have no clue where to start on fixing this because, as far as i can tell, it should work. Otherwise, all attacks work, except for the level check. At least this little update here will fix the problem where a user could attack while no duel was in progress and cause an error message.

Another problem was i used "If Username = gdPlayer1" when i should have been using "If Username = gdPlayer1(1)". That has been fixed as well. Now i need some rest from this plugin, I just can't think strait anymore after 4-5 hours of check and rechecking it. Hopfully I'll find a fix later.

Thx again HearthCore, your my hero biggrin.gif
HearthCore
I'll anyway have a longer look at it in the next few days :>..
Maybe i can think your work through ( as i am a Programmer i should be able to learn VBs quite fast.. and i will try it :>.. )
cyber_hunter
CODE
'gd
'1.4
'&Gun Duel:Cyber_Hunter
'&Duel <username>:Stats <Username>:Fire:Aim:Cover:Heal:Stim:Cloak:Delete
'&
'&Gun Dueling Game:Lvl your Character:Increase your stats:Battle Other Players in 1vs1 Duels

'*****UPDATE*****
'Added a delete command, use "\delete me" to reset your own char
'Modified Health to make the Duel last a bit longer
'Removed all un-needed AddChat
'Fixed DoShot calls for player 2
'Fixed Hp Check after every move
'All Attack Commands Now Check For Game In Progress
'Fixed One More Stupid Mistake Involving The Check To Find Who Was Using The Commands
'Fixed more spelling mistakes that would have caused the game to error

'Ver: 1.4
'All shots taken have been made into a function (Thanks To: raylu)
'This version should not have errors, although i have only tested it the way it should be used
'Anyone who tests this version should try everything to create an error
'This will be the final version unless errors are found or new ideas can be added

'Ver: 1.3
'Finally, a working version. This one will work well, probably has an error here or there.
'-Removed All Instances of the command "Call". Doesn't seem to work well with Sb
'-Fixed Some Variables That Where Spelled Wrong. sad.gif
'-Replaced All Random Numbers With One Function (Thanks To: Jack)
'-Added An Hp Reply After Both Players Have Finished Their Turn
'-COMPLETLY Diablo2 COMPATIBLE (Has Been Tested with a D2 Bot)
'-If you find any errors or wish to give an idea, just message me in the forums

'*****UPDATE*****
'Still needs more testing, but im getting some progress with most errors. I haven't tested
'it completly yet so i'm still working on it.
'-Fixed an error that caused every attack command to cause an internal error
'-Fixed a few bugs involving the usernames (Now all in Lower Case)
'-Changed from using "Call" to using "Select Case", looks alot nicer biggrin.gif
'-Fixed an error with the Stat check before a duel.
'-Added Reply For In-Game Commands. (Fire, Aim, ect...)

'*****UPDATE*****
'Finally found the time to test this game. Stats Command Works And Player will be recorded
'in your plugins folder in gdStats.txt. You can play around with the levels and Stats of all
'Players, but only modify the file when the bot if shutdonw, outherwise your changes will be
'lost.

'Ver: 1.2
'Ok, at least now the script doesn't give error messages, but the problem is it won't
'do much at all. The commands dont't work but I know that the bot is going through the
'subs. Need to figure out what stoping the commands from being executed.


'Ver: 1.1
'First Basic Script. Still Many bugs to work out, Won't work yet because of a
'loading error that i can't seem to fix. After I finally fix this the script will
'be workable. Hope that will happen soon.




Public gdstats '// Holds All Player Stats
Public gdfso '// Holds fso
Public gdsaved '// Save Info On Shutdown
Public gdGameOn '// Holds the Game Status (Game On/Off)
Public gdChallenge '// Holds Challenge Status
Public gdDonePlayer1 '// Holds Turn Information
Public gdDonePlayer2 '// Holds Turn Information
Public gdLvlingPlayer '// Holds Leveling Players Name
Public gdActionPlayer1 '// Holds Player Action
Public gdActionPlayer2 '// Holds Player Action
Public gdPlayer1(6) '// Holds Challengers Stats
Public gdPlayer2(6) '// Holds Other Players Stats
Public gdGameStats1(4) '// Holds InGame Stats
Public gdGameStats2(4) '// Holds InGame Stats
Public gdStatsLookup(4) '// Holds Stats for gdStats Commands
Public gdFilePath '// Stat File FilePath
Public gdTest '// Used To Workout Errors
Public gdLeveling = "False" '// Sends messages directly to gdLevelUp

'//ACCESS (This will later be changed for use in the pluginsettings.txt file)

Const gdDuel_Access = -1 '// Default -> -1 (No Access)
Const gdDel_Access = 50 '// Default -> 50 (Users with this access can delete ANY player)

'//COMMAND NAMES (These will later be changed for use in the pluginsettings.txt file)

Const gdDuel_Command = "duel" '// Used To Challange Player.
Const gdStats_Command = "stats" '// Used to check stats.
Const gdFire_Command = "fire" '// Simple Attack Command.
Const gdAim_Command = "aim" '// Skip a turn for 100% Accurcy.
Const gdCover_Command = "cover" '// Increase you Evasion, Decrease your Accurcy.
Const gdHeal_Command = "heal" '// Used to heal yourself.
Const gdStim_Command = "stim" '// Used to attack twice while losing 5hp.
Const gdCloak_Command = "cloak" '// Increase your evasion for one attack.
Const gdDelete_Command = "delete" '// Used to delete characters

'//LEVEL REQUIREMENT (These will later be changed for use in the pluginsettings.txt file)

Const gdFire_Level = 1 '// Default -> 1
Const gdAim_Level = 1 '// Default -> 1
Const gdCover_Level = 1 '// Default -> 1
Const gdHeal_Level = 1 '// Default -> 1
Const gdStim_Level = 5 '// Default -> 5
Const gdCloak_Level = 15 '// Default -> 15

'//OTHER USER-SELECTED VARIABLES (These will later be changed for use in the pluginsettings.txt file)

Const gdUserFilePath = "plugins\gdStats.txt"
Const gdPointsPerKill = 5 '// Experience per Kill (%)
Const gdPointsPerTie = 1 '// Experience per Tie (%)

'*******************************************
'********DO NOT EDIT BELOW THIS LINE********
'*******************************************
'******UNLESS YOU KNOW WHAT YOUR DOING******
'*******************************************


Sub gd_event_Load()

Dim TempStr
gdFilePath = BotPath & gdUserFilePath
Set gdstats = CreateObject("Scripting.Dictionary")
Set gdfso = CreateObject("Scripting.FileSystemObject")

If gdfso.FileExists(gdFilePath) Then '// If File Exists, Retrieves Information
Set gdsaved = gdfso.OpenTextFile(gdFilePath, 1, False)
Do While Not gdsaved.AtEndOfStream
TempStr = Split(gdsaved.ReadLine, " ")
gdstats.Add TempStr(0), Array(TempStr(1), TempStr(2), TempStr(3), TempStr(4), TempStr(5))
Loop
gdsaved.Close
Set gdsaved = Nothing
Else '// If File Does Not Exists, Gives a Welcome Msg >>> The File Will Be Created With Other Subs
AddChat vbBlue, "Welcome To Gun Duel. Thank you for testing the script."
AddChat vbCyan, "All the variables for the Duel can be changed in the plugin file."
End If

gdGameOn = "False"
gdChallenge = "False"
End Sub



Sub gd_event_UserTalk(Username, Flags, Message, Ping)

Dim MyAccess, MyFlags
GetDBEntry Username, MyAccess, MyFlags

Message = Trim(Message)
Username = LCase(Username)

If gdstats.Exists(Username) = False Then
gdstats.Add Username, Array("1", "1", "1", "1", "0") '// All Users in channel that talk will be added
AddQ "/whisper " & psd2 & Username & " You have been added to the Gun Duel Player List."
End If

If gdLeveling = "True" And Username = gdLvlingPlayer Then '// Checks to see if a Player Is Leveling
gdLevelUp Message
ElseIf gdLeveling = "True" And Username <> gdLvlingPlayer And Left(Message, Len(BotVars.Trigger)) <> BotVars.Trigger Then '// If A Player Is Leveling, Inform Player That He Has To Wait
AddQ "/whisper " & psd2 & Username & " I'm Helping " & gdLvlingPlayer & ". Please wait while they finish."
End If

If gdChallenge = "True" And Username = gdPlayer2(1) And LCase(Message) = "yes" Then '//Player Has Accepted Challenge, Store All Needed Info For The Match
gdGameOn = "True"
gdPlayer1(2) = gdstats.Item(gdPlayer1(1))(0) '// Stores Player1's Level
gdPlayer1(3) = gdstats.Item(gdPlayer1(1))(1) '// Stores Player1's Attack
gdPlayer1(4) = gdstats.Item(gdPlayer1(1))(2) '// Stores Player1's Accurcy
gdPlayer1(5) = gdstats.Item(gdPlayer1(1))(3) '// Stores Player1's Evasion
gdPlayer1(6) = gdstats.Item(gdPlayer1(1))(4) '// Stores Player1's Exp (%)
gdPlayer2(2) = gdstats.Item(gdPlayer2(1))(0) '// Stores Player2's Level
gdPlayer2(3) = gdstats.Item(gdPlayer2(1))(1) '// Stores Player2's Attack
gdPlayer2(4) = gdstats.Item(gdPlayer2(1))(2) '// Stores Player2's Accurcy
gdPlayer2(5) = gdstats.Item(gdPlayer2(1))(3) '// Stores Player2's Evasion
gdPlayer2(6) = gdstats.Item(gdPlayer2(1))(4) '// Stores Player2's Exp (%)
gdGameStats1(1) = gdPlayer1(2) * 10 '// Stores InGame HP
gdGameStats1(2) = gdPlayer1(3) '// Stores InGame Attack
gdGameStats1(3) = gdPlayer1(4) '// Stores InGame Accurcy
gdGameStats1(4) = gdPlayer1(5) '// Stores InGame Evasion
gdGameStats2(1) = gdPlayer1(2) * 10 '// Stores InGame HP
gdGameStats2(2) = gdPlayer1(3) '// Stores InGame Attack
gdGameStats2(3) = gdPlayer1(4) '// Stores InGame Accurcy
gdGameStats2(4) = gdPlayer1(5) '// Stores InGame Evasion
gdDonePlayer1 = "False"
gdDonePlayer2 = "False"
AddQ "A Duel Has Started Between " & gdPlayer1(1) & "(Level " & gdPlayer1(2) & ") And " & gdPlayer2(1) & "(Level " & gdPlayer2(2) & ")"
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You can now attack."
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You can now attack."
ElseIf gdChallenge = "True" And Username = msgUsername And LCase(Message) = "no" Then
AddQ Username & " has refused the Duel Challenge."
Exit Sub
End If

If Left(Message, Len(BotVars.Trigger)) <> BotVars.Trigger Then
Exit Sub
Else
Message = Replace(Message, BotVars.Trigger, "", 1, 1) '// Remove The Trigger From Message
End If

If gdDuel_Access > MyAccess Then Exit Sub

Select Case Split(LCase(Message), " ")(0)
Case LCase(gdDuel_Command): gdDuel Username, Message
Case LCase(gdStats_Command): gdStatReturn Username, Message
Case LCase(gdDelete_Command): gdDel Username, Message
Case LCase(gdFire_Command): gdFire Username, Message
Case LCase(gdAim_Command): gdAim Username, Message
Case LCase(gdCover_Command): gdCover Username, Message
Case LCase(gdHeal_Command): gdHeal Username, Message
Case LCase(gdStim_Command): gdStim Username, Message
Case LCase(gdCloak_Command): gdCloak Username, Message
End Select

End Sub



Sub gd_Event_WhisperFromUser(Username, Flags, Message)

gd_event_UserTalk Username, Flags, Message, 1

End Sub



Sub gd_Event_Close()
Dim TempStr

Set gdsaved = gdfso.OpenTextFile(gdFilePath, 2, True)

For Each Key In gdstats.Keys '// Puts All info into a file
TempStr = Key & " " & gdstats.Item(Key)(0) & " " & gdstats.Item(Key)(1) & " " & gdstats.Item(Key)(2) & " " & gdstats.Item(Key)(3) & " " & gdstats.Item(Key)(4)
gdsaved.WriteLine TempStr
Next
gdsaved.Close
Set gdsaved = Nothing
End Sub



Sub gdDel(Username, Message)

GetDBEntry Username, MyAccess, MyFlags

User = Split(Message, " ")
msgUsername = User(1)

If LCase(msgUsername) = "me" Then '// Change Username Incase of "me"
msgUsername = Username
ElseIf gdDel_Access > MyAccess Then '// Checks For User Access To This Command, Unless Deleting Themselfs (Reset Char)
AddQ "/whisper " & psd2 & Username & " Your access is to low to delete other players."
Exit Sub
End If

If gdGameOn = "True" Then '// Checks for current duels
AddQ "/whisper " & psd2 & Username & " a duel is currently in progress. Please wait for this duel to end."
Exit Sub
End If

If gdstats.Exists(msgUsername) = False Then
AddQ "/whisper " & psd2 & Username & " Player does not exist."
Exit Sub
Else
gdstats.Remove msgUsername
AddQ "/whisper " & psd2 & Username & " " & msgUsername & " has been deleted."
End If

End Sub



Sub gdDuel(Username, Message)

If gdGameOn = "True" Then '// Checks for current duels
AddQ "/whisper " & psd2 & Username & " a duel is currently in progress. Please wait for this duel to end."
Exit Sub
End If

User = Split(Message, " ")
msgUsername = LCase(User(1))

If GetPositionByName(msgUsername) = -1 Then '// Checks for user in channel
AddQ "/whisper " & psd2 & Username & " " & msgUsername & " is not currently in the channel."
Exit Sub
Else
AddQ "/whisper " & psd2 & msgUsername & " " & Username & " has challenged you to a duel."
AddQ "/whisper " & psd2 & msgUsername & " Whisper me 'Yes' or 'NO'."
gdChallenge = "True"
gdPlayer1(1) = Username
gdPlayer2(1) = msgUsername
End If
End Sub



Sub gdStatReturn(Username, Message)

User = Split(Message, " ")
msgUsername = User(1)

If LCase(msgUsername) = "me" Then '// Change Username Incase of "me"
msgUsername = Username
End If

If Not gdstats.Exists(msgUsername) Then '// Checks for user in dictionary
AddQ "/whisper " & psd2 & Username & " This Player does not exist."
Exit Sub
Else
gdStatsLookup(0) = gdstats.Item(msgUsername)(0)
gdStatsLookup(1) = gdstats.Item(msgUsername)(1)
gdStatsLookup(2) = gdstats.Item(msgUsername)(2)
gdStatsLookup(3) = gdstats.Item(msgUsername)(3)
gdStatsLookup(4) = gdstats.Item(msgUsername)(4)
AddQ "/whisper " & psd2 & Username & " " & msgUsername & " Level:" & gdStatsLookup(0) & " Attack:" & gdStatsLookup(1) & " Accurcy:" & gdStatsLookup(2) & " Evasion:" & gdStatsLookup(3) & " Experience(%):" & gdStatsLookup(4)
End If
End Sub



Sub gdFire(Username, Message)

If gdGameOn = "False" Then
Exit Sub
End If

If gdstats.Item(Username)(0) < gdFire_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1(1) And gdDonePlayer1 = "False" Then
gdDonePlayer1 = "True"
gdActionPlayer1 = 1
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Have Fired One Shoot."
ElseIf Username = gdPlayer2(1) And gdDonePlayer2 = "False" Then
gdDonePlayer2 = "True"
gdActionPlayer2 = 1
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Have Fired One Shoot."
End If

If gdDonePlayer1 = "True" And gdDonePlayer2 = "True" Then
gdActionChosen
End If
End Sub



Sub gdAim(Username, Message)

If gdGameOn = "False" Then
Exit Sub
End If

If gdstats.Item(Username)(0) < gdAim_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

AddChat vbBlue, "Checkpoint"

If Username = gdPlayer1(1) And gdDonePlayer1 = "False" Then
gdDonePlayer1 = "True"
gdActionPlayer1 = 2
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Aim Your Next Shoot."
ElseIf Username = gdPlayer2(1) And gdDonePlayer2 = "False" Then
gdDonePlayer2 = "True"
gdActionPlayer2 = 2
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Aim Your Next Shoot."
End If

AddChat vbBlue, "Checkpoint"

If gdDonePlayer1 = "True" And gdDonePlayer2 = "True" Then
gdActionChosen
End If
End Sub



Sub gdCover(Username, Message)

If gdGameOn = "False" Then
Exit Sub
End If

If gdstats.Item(Username)(0) < gdCover_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1(1) And gdDonePlayer1 = "False" Then
gdDonePlayer1 = "True"
gdActionPlayer1 = 3
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Take Cover And Shoot."
ElseIf Username = gdPlayer2(1) And gdDonePlayer2 = "False" Then
gdDonePlayer2 = "True"
gdActionPlayer2 = 3
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Take Cover And Shoot."
End If

If gdDonePlayer1 = "True" And gdDonePlayer2 = "True" Then
gdActionChosen
End If
End Sub



Sub gdHeal(Username, Message)

If gdGameOn = "False" Then
Exit Sub
End If

If gdstats.Item(Username)(0) < gdHeal_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1(1) And gdDonePlayer1 = "False" Then
gdDonePlayer1 = "True"
gdActionPlayer1 = 4
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Heal Yourself."
ElseIf Username = gdPlayer2(1) And gdDonePlayer2 = "False" Then
gdDonePlayer2 = "True"
gdActionPlayer2 = 4
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Heal Yourself."
End If

If gdDonePlayer1 = "True" And gdDonePlayer2 = "True" Then
gdActionChosen
End If
End Sub



Sub gdStim(Username, Message)

If gdGameOn = "False" Then
Exit Sub
End If

If gdstats.Item(Username)(0) < gdStim_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1(1) And gdDonePlayer1 = "False" Then
gdDonePlayer1 = "True"
gdActionPlayer1 = 5
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Fire Two Shoots."
ElseIf Username = gdPlayer2(1) And gdDonePlayer2 = "False" Then
gdDonePlayer2 = "True"
gdActionPlayer2 = 5
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Fire Two Shoots."
End If

If gdDonePlayer1 = "True" And gdDonePlayer2 = "True" Then
gdActionChosen
End If
End Sub



Sub gdCloak(Username, Message)

If gdGameOn = "False" Then
Exit Sub
End If

If gdstats.Item(Username)(0) < gdCloak_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1(1) And gdDonePlayer1 = "False" Then
gdDonePlayer1 = "True"
gdActionPlayer1 = 6
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Cloak And Shoot."
ElseIf Username = gdPlayer2(1) And gdDonePlayer2 = "False" Then
gdDonePlayer2 = "True"
gdActionPlayer2 = 6
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Cloak And Shoot."
End If

If gdDonePlayer1 = "True" And gdDonePlayer2 = "True" Then
gdActionChosen
End If
End Sub



Sub gdActionChosen()

gdDonePlayer1 = "False"
gdDonePlayer2 = "False"

If gdActionPlayer1 = 1 Then '// Action: Fire
P1msg = gdPlayer1(1) & " Fires One Round At " & gdPlayer2(1)
a = (gdGameStats1(3) + (RanNum(1, 6) - 3)) - gdGameStats2(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

gdGameStats1(3) = gdPlayer1(4)
gdGameStats1(4) = gdPlayer1(5)
ElseIf gdActionPlayer1 = 2 Then '// Action: Aim
P1msg = gdPlayer1(1) & " Takes Aim At " & gdPlayer2(1)
gdGameStats1(3) = 999
gdGameStats1(4) = gdPlayer1(5)
ElseIf gdActionPlayer1 = 3 Then '// Action: Cover
P1msg = gdPlayer1(1) & " Takes Cover And Fires At " & gdPlayer2(1)
gdGameStats1(3) = gdPlayer1(4) - 1
gdGameStats1(4) = gdPlayer1(5) + 1
a = (gdGameStats1(3) + (RanNum(1, 6) - 3)) - gdGameStats2(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

ElseIf gdActionPlayer1 = 4 Then '// Action: Heal
P1msg = gdPlayer1(1) & " Heals"
gdGameStats1(1) = gdGameStats1(1) + RanNum(1, 5)
gdGameStats1(3) = gdPlayer1(4)
gdGameStats1(4) = gdPlayer1(5)
ElseIf gdActionPlayer1 = 5 Then '// Action: Stim
P1msg = gdPlayer1(1) & " Fires Two Rounds At " & gdPlayer2(1)
gdGameStats1(1) = gdGameStats1(1) - 4
a = (gdGameStats1(3) + (RanNum(1, 6) - 3)) - gdGameStats2(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

a = (gdGameStats1(3) + (RanNum(1, 6) - 3)) - gdGameStats2(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

gdGameStats1(3) = gdPlayer1(4)
gdGameStats1(4) = gdPlayer1(5)
ElseIf gdActionPlayer1 = 6 Then '// Action: Cloak
P1msg = gdPlayer1(1) & " Cloaks And Fires At " & gdPlayer2(1)
gdGameStats1(4) = 999
a = (gdGameStats1(3) + (RanNum(1, 6) - 3)) - gdGameStats2(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

gdGameStats1(3) = gdPlayer1(4)
Else '// All Possible Options Are Depleted, Show Error
P1msg = gdPlayer1(1) & " :gdActionChosen Error"
AddChat vbRed, "P1 gdActionPlayer1 is Incorrect --> ", vbBlue, gdActionPlayer1
End If


If gdActionPlayer2 = 1 Then '// Action: Fire
P2msg = gdPlayer2(1) & " Fires One Round At " & gdPlayer1(1)
a = (gdGameStats2(3) + (RanNum(1, 6) - 3)) - gdGameStats1(4)

AddChat vbBlue, DoShot(P2msg, a, gdGameStats2(2), gdGameStats1(1))

gdGameStats2(3) = gdPlayer2(4)
gdGameStats2(4) = gdPlayer2(5)
ElseIf gdActionPlayer2 = 2 Then '// Action: Aim
P2msg = gdPlayer2(1) & " Takes Aim At " & gdPlayer1(1)
gdGameStats2(3) = 999
gdGameStats2(4) = gdPlayer2(5)
ElseIf gdActionPlayer2 = 3 Then '// Action: Cover
P2msg = gdPlayer2(1) & " Takes Cover And Fires At " & gdPlayer1(1)
gdGameStats2(3) = gdPlayer2(4) - 1
gdGameStats2(4) = gdPlayer2(5) + 1
a = (gdGameStats1(3) + (RanNum(1, 6) - 3)) - gdGameStats2(4)

AddChat vbBlue, DoShot(P2msg, a, gdGameStats2(2), gdGameStats1(1))

ElseIf gdActionPlayer2 = 4 Then '// Action: Heal
P2msg = gdPlayer2(1) & " Heals"
gdGameStats1(1) = gdGameStats1(1) + RanNum(1, 5)
gdGameStats2(3) = gdPlayer2(4)
gdGameStats2(4) = gdPlayer2(5)
ElseIf gdActionPlayer2 = 5 Then '// Action: Stim
P2msg = gdPlayer2(1) & " Fires Two Rounds At " & gdPlayer1(1)
gdGameStats2(1) = gdGameStats2(1) - 4
a = (gdGameStats2(3) + (RanNum(1, 6) - 3)) - gdGameStats1(4)

AddChat vbBlue, DoShot(P2msg, a, gdGameStats2(2), gdGameStats1(1))

a = (gdGameStats2(3) + (RanNum(1, 6) - 3)) - gdGameStats1(4)

AddChat vbBlue, DoShot(P2msg, a, gdGameStats2(2), gdGameStats1(1))

gdGameStats2(3) = gdPlayer2(4)
gdGameStats2(4) = gdPlayer2(5)
ElseIf gdActionPlayer2 = 6 Then '// Action: Cloak
P2msg = gdPlayer2(1) & " Cloaks And Fires At " & gdPlayer1(1)
gdGameStats2(4) = 999
a = (gdGameStats2(3) + (RanNum(1, 6) - 3)) - gdGameStats1(4)

AddChat vbBlue, DoShot(P2msg, a, gdGameStats2(2), gdGameStats1(1))

gdGameStats2(3) = gdPlayer2(4)
Else '// All Possible Options Are Depleted, Show Error
P2msg = gdPlayer2(1) & " :gdActionChosen Error"
AddChat vbRed, "P2 gdActionPlayer2 is Incorrect --> ", vbBlue, gdActionPlayer2
End If

AddQ P1msg
AddQ P2msg
AddQ gdPlayer1(1) & " Hp: " & gdGameStats1(1) & " || " & gdPlayer2(1) & " Hp: " & gdGameStats2(1)

If gdGameStats2(1) < 1 And gdGameStats1(1) > 0 Then '// Player 1 Wins
gdPlayer1(6) = gdPlayer1(6) + gdPointsPerKill
AddQ gdPlayer1(1) & " Has Killed " & gdPlayer2(1)
gdGameOn = "False"
gdChallenge = "False"
If gdPlayer1(6) >= 100 Then gdLevelUp
gd_Event_Close
ElseIf gdGameStats1(1) < 1 And gdGameStats2(1) > 0 Then '// Player 2 Wins
gdPlayer2(6) = gdPlayer2(6) + gdPointsPerKill
AddQ gdPlayer2(1) & " Has Killed " & gdPlayer1(1)
gdGameOn = "False"
gdChallenge = "False"
If gdPlayer2(6) >= 100 Then gdLevelUp
gd_Event_Close
ElseIf gdGameStats1(1) < 1 And gdGameStats2(1) < 1 Then '// Tie
gdPlayer2(6) = gdPlayer2(6) + gdPointsPerTie
gdPlayer1(6) = gdPlayer1(6) + gdPointsPerTie
AddQ gdPlayer2(1) & " And " & gdPlayer1(1) & " Have Killed Eachother!!!"
gdGameOn = "False"
gdChallenge = "False"
If gdPlayer1(6) >= 100 Then gdLevelUp
If gdPlayer2(6) >= 100 Then gdLevelUp
gd_Event_Close
End If
End Sub



Sub gdLevelUp(Message)

gdPlayer1(2) = gdstats.Item(gdPlayer1(1))(1) '// Stores Player1's Level
gdPlayer1(6) = gdstats.Item(gdPlayer1(1))(5) '// Stores Player1's Exp (%)
gdPlayer2(2) = gdstats.Item(gdPlayer2(1))(1) '// Stores Player2's Level
gdPlayer2(6) = gdstats.Item(gdPlayer2(1))(5) '// Stores Player2's Exp (%)

If gdPlayer1(6) >= 100 Then
gdPlayer1(2) = gdPlayer1(2) + 1
gdPlayer1(6) = gdPlayer1(6) - 100
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Have Leveled, Please tell me which stat you would like to upgrade. Atk, Acc, Eva"
gdLeveling = "True"
gdLvlingPlayer = gdPlayer1(1)
Exit Sub '// Wait For User Input
ElseIf gdPlayer2(6) >= 100 Then
gdPlayer2(2) = gdPlayer2(2) + 1
gdPlayer2(6) = gdPlayer2(6) - 100
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Have Leveled, Please tell me which stat you would like to upgrade. Atk, Acc, Eva"
gdLeveling = "True"
gdLvlingPlayer = gdPlayer2(1)
Exit Sub '// Wait For User Input
End If

If gdLeveling = "False" Then Exit Sub

If gdLeveling = "True" And LCase(Message) = "atk" Then
gdstats.Item(gdLvlingPlayer)(2) = gdstats.Item(gdLvlingPlayer)(2) + 1
gdLeveling = False
AddQ "/whisper " & psd2 & gdLvlingPlayer & " Thank You For Making Your Selection. Succesfully Increased Atk By ONE."
Exit Sub
ElseIf gdLeveling = "True" And LCase(Message) = "acc" Then
gdstats.Item(gdLvlingPlayer)(3) = gdstats.Item(gdLvlingPlayer)(3) + 1
gdLeveling = "False"
AddQ "/whisper " & psd2 & gdLvlingPlayer & " Thank You For Making Your Selection. Succesfully Increased Acc By ONE."
Exit Sub
ElseIf gdLeveling = "True" And LCase(Message) = "eva" Then
gdstats.Item(gdLvlingPlayer)(4) = gdstats.Item(gdLvlingPlayer)(4) + 1
gdLeveling = "False"
AddQ "/whisper " & psd2 & gdLvlingPlayer & " Thank You For Making Your Selection. Succesfully Increased Eva By ONE."
Exit Sub
ElseIf gdLeveling = "True" Then
AddQ "/whisper " & psd2 & gdLvlingPlayer & " Your Selection is Incorrect: " & Message & ". Please Try Again."
Exit Sub
End If
End Sub



Private Function DoShot(ByRef Pmsg, ByVal a, ByVal gdAtk, ByRef gdHP)
If a >= 5 Then
Pmsg = Pmsg & " Critical!! "
gdHP = gdHP - (gdAtk + RanNum(1, 5))
ElseIf a >= 1 Then
Pmsg = Pmsg & " Hits "
gdHP = gdHP - (gdAtk + RanNum(0, 3))
ElseIf a = 0 Then
Pmsg = Pmsg & " Almost Missed "
gdHP = gdHP - (gdAtk)
ElseIf a <= -1 Then
Pmsg = Pmsg & " Misses "
gdHP = gdGameStats1(1)
End If

DoShot = "Shot Fired"
End Function



Private Function RanNum(minimum, maximum)
RanNum = Int(((maximum + 1) - (minimum)) * Rnd + (minimum))
End Function

I must have been really beat when i wrote the last parts of this script. When i took a REALLY good look at everything (I needed to indent EVERYTHING again, stupid Microsoft Visual Basic) I found so many spelling mistakes, i'm wondering how the game even worked up until now. Anyways I fixed a few things but i'm still stuck on a few things.

1: Lvl-check -> Still have no idea, I'm trying a bunch of different things but they are not working and just and up causing errors

2: Death-Check -> Same, I've been trying to fix it but i'm still finding it one hell of a troublesome code

I'll keep trying, so i'll fix it at some point, I just have no idea when i'll get the right idea to fix these problems.




CODE
'gd
'1.4
'&Gun Duel:Cyber_Hunter
'&Duel <username>:Stats <Username>:Fire:Aim:Cover:Heal:Stim:Cloak:Delete
'&
'&Gun Dueling Game:Lvl your Character:Increase your stats:Battle Other Players in 1vs1 Duels

'*****UPDATE*****
'Added a delete command, use "\delete me" to reset your own char
'Modified Health to make the Duel last a bit longer
'Removed all un-needed AddChat
'Fixed DoShot calls for player 2
'Fixed Hp Check after every move
'All Attack Commands Now Check For Game In Progress
'Fixed One More Stupid Mistake Involving The Check To Find Who Was Using The Commands
'Fixed more spelling mistakes that would have caused the game to error

'Ver: 1.4
'All shots taken have been made into a function (Thanks To: raylu)
'This version should not have errors, although i have only tested it the way it should be used
'Anyone who tests this version should try everything to create an error
'This will be the final version unless errors are found or new ideas can be added

'Ver: 1.3
'Finally, a working version. This one will work well, probably has an error here or there.
'-Removed All Instances of the command "Call". Doesn't seem to work well with Sb
'-Fixed Some Variables That Where Spelled Wrong. sad.gif
'-Replaced All Random Numbers With One Function (Thanks To: Jack)
'-Added An Hp Reply After Both Players Have Finished Their Turn
'-COMPLETLY Diablo2 COMPATIBLE (Has Been Tested with a D2 Bot)
'-If you find any errors or wish to give an idea, just message me in the forums

'*****UPDATE*****
'Still needs more testing, but im getting some progress with most errors. I haven't tested
'it completly yet so i'm still working on it.
'-Fixed an error that caused every attack command to cause an internal error
'-Fixed a few bugs involving the usernames (Now all in Lower Case)
'-Changed from using "Call" to using "Select Case", looks alot nicer biggrin.gif
'-Fixed an error with the Stat check before a duel.
'-Added Reply For In-Game Commands. (Fire, Aim, ect...)

'*****UPDATE*****
'Finally found the time to test this game. Stats Command Works And Player will be recorded
'in your plugins folder in gdStats.txt. You can play around with the levels and Stats of all
'Players, but only modify the file when the bot if shutdonw, outherwise your changes will be
'lost.

'Ver: 1.2
'Ok, at least now the script doesn't give error messages, but the problem is it won't
'do much at all. The commands dont't work but I know that the bot is going through the
'subs. Need to figure out what stoping the commands from being executed.


'Ver: 1.1
'First Basic Script. Still Many bugs to work out, Won't work yet because of a
'loading error that i can't seem to fix. After I finally fix this the script will
'be workable. Hope that will happen soon.




Public gdstats '// Holds All Player Stats
Public gdfso '// Holds fso
Public gdsaved '// Save Info On Shutdown
Public gdGameOn '// Holds the Game Status (Game On/Off)
Public gdChallenge '// Holds Challenge Status
Public gdDonePlayer1 '// Holds Turn Information
Public gdDonePlayer2 '// Holds Turn Information
Public gdLvlingPlayer '// Holds Leveling Players Name
Public gdActionPlayer1 '// Holds Player Action
Public gdActionPlayer2 '// Holds Player Action
Public gdPlayer1(6) '// Holds Challengers Stats
Public gdPlayer2(6) '// Holds Other Players Stats
Public gdGameStats1(4) '// Holds InGame Stats
Public gdGameStats2(4) '// Holds InGame Stats
Public gdStatsLookup(4) '// Holds Stats for gdStats Commands
Public gdFilePath '// Stat File FilePath
Public gdTest '// Used To Workout Errors
Public gdLeveling '// Sends messages directly to gdLevelUp

'//ACCESS (This will later be changed for use in the pluginsettings.txt file)

Const gdDuel_Access = -1 '// Default -> -1 (No Access)
Const gdDel_Access = 50 '// Default -> 50 (Users with this access can delete ANY player)

'//COMMAND NAMES (These will later be changed for use in the pluginsettings.txt file)

Const gdDuel_Command = "duel" '// Used To Challange Player.
Const gdStats_Command = "stats" '// Used to check stats.
Const gdFire_Command = "fire" '// Simple Attack Command.
Const gdAim_Command = "aim" '// Skip a turn for 100% Accurcy.
Const gdCover_Command = "cover" '// Increase you Evasion, Decrease your Accurcy.
Const gdHeal_Command = "heal" '// Used to heal yourself.
Const gdStim_Command = "stim" '// Used to attack twice while losing 5hp.
Const gdCloak_Command = "cloak" '// Increase your evasion for one attack.
Const gdDelete_Command = "delete" '// Used to delete characters

'//LEVEL REQUIREMENT (These will later be changed for use in the pluginsettings.txt file)

Const gdFire_Level = 1 '// Default -> 1
Const gdAim_Level = 1 '// Default -> 1
Const gdCover_Level = 1 '// Default -> 1
Const gdHeal_Level = 1 '// Default -> 1
Const gdStim_Level = 5 '// Default -> 5
Const gdCloak_Level = 15 '// Default -> 15

'//OTHER USER-SELECTED VARIABLES (These will later be changed for use in the pluginsettings.txt file)

Const gdUserFilePath = "plugins\gdStats.txt"
Const gdPointsPerKill = 5 '// Experience per Kill (%)
Const gdPointsPerTie = 1 '// Experience per Tie (%)

'*******************************************
'********DO NOT EDIT BELOW THIS LINE********
'*******************************************
'******UNLESS YOU KNOW WHAT YOUR DOING******
'*******************************************


Sub gd_event_Load()

Dim TempStr
gdLeveling = "False"
gdFilePath = BotPath & gdUserFilePath
Set gdstats = CreateObject("Scripting.Dictionary")
Set gdfso = CreateObject("Scripting.FileSystemObject")

If gdfso.FileExists(gdFilePath) Then '// If File Exists, Retrieves Information
Set gdsaved = gdfso.OpenTextFile(gdFilePath, 1, False)
Do While Not gdsaved.AtEndOfStream
TempStr = Split(gdsaved.ReadLine, " ")
gdstats.Add TempStr(0), Array(TempStr(1), TempStr(2), TempStr(3), TempStr(4), TempStr(5))
Loop
gdsaved.Close
Set gdsaved = Nothing
Else '// If File Does Not Exists, Gives a Welcome Msg >>> The File Will Be Created With Other Subs
AddChat vbBlue, "Welcome To Gun Duel. Thank you for testing the script."
AddChat vbCyan, "All the variables for the Duel can be changed in the plugin file."
End If

gdGameOn = "False"
gdChallenge = "False"
End Sub



Sub gd_event_UserTalk(Username, Flags, Message, Ping)

Dim MyAccess, MyFlags
GetDBEntry Username, MyAccess, MyFlags

Message = Trim(Message)
Username = LCase(Username)

If gdstats.Exists(Username) = False Then
gdstats.Add Username, Array("1", "1", "1", "1", "0") '// All Users in channel that talk will be added
AddQ "/whisper " & psd2 & Username & " You have been added to the Gun Duel Player List."
End If

If gdLeveling = "True" And Username = gdLvlingPlayer Then '// Checks to see if a Player Is Leveling
gdLevelUp Message
ElseIf gdLeveling = "True" And Username <> gdLvlingPlayer And Left(Message, Len(BotVars.Trigger)) <> BotVars.Trigger Then '// If A Player Is Leveling, Inform Player That He Has To Wait
AddQ "/whisper " & psd2 & Username & " I'm Helping " & gdLvlingPlayer & ". Please wait while they finish."
End If

If gdChallenge = "True" And Username = gdPlayer2(1) And LCase(Message) = "yes" Then '//Player Has Accepted Challenge, Store All Needed Info For The Match
gdGameOn = "True"
gdPlayer1(2) = gdstats.Item(gdPlayer1(1))(0) '// Stores Player1's Level
gdPlayer1(3) = gdstats.Item(gdPlayer1(1))(1) '// Stores Player1's Attack
gdPlayer1(4) = gdstats.Item(gdPlayer1(1))(2) '// Stores Player1's Accurcy
gdPlayer1(5) = gdstats.Item(gdPlayer1(1))(3) '// Stores Player1's Evasion
gdPlayer1(6) = gdstats.Item(gdPlayer1(1))(4) '// Stores Player1's Exp (%)
gdPlayer2(2) = gdstats.Item(gdPlayer2(1))(0) '// Stores Player2's Level
gdPlayer2(3) = gdstats.Item(gdPlayer2(1))(1) '// Stores Player2's Attack
gdPlayer2(4) = gdstats.Item(gdPlayer2(1))(2) '// Stores Player2's Accurcy
gdPlayer2(5) = gdstats.Item(gdPlayer2(1))(3) '// Stores Player2's Evasion
gdPlayer2(6) = gdstats.Item(gdPlayer2(1))(4) '// Stores Player2's Exp (%)
gdGameStats1(1) = gdPlayer1(2) * 10 '// Stores InGame HP
gdGameStats1(2) = gdPlayer1(3) '// Stores InGame Attack
gdGameStats1(3) = gdPlayer1(4) '// Stores InGame Accurcy
gdGameStats1(4) = gdPlayer1(5) '// Stores InGame Evasion
gdGameStats2(1) = gdPlayer1(2) * 10 '// Stores InGame HP
gdGameStats2(2) = gdPlayer1(3) '// Stores InGame Attack
gdGameStats2(3) = gdPlayer1(4) '// Stores InGame Accurcy
gdGameStats2(4) = gdPlayer1(5) '// Stores InGame Evasion
gdDonePlayer1 = "False"
gdDonePlayer2 = "False"
AddQ "A Duel Has Started Between " & gdPlayer1(1) & "(Level " & gdPlayer1(2) & ") And " & gdPlayer2(1) & "(Level " & gdPlayer2(2) & ")"
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You can now attack."
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You can now attack."
ElseIf gdChallenge = "True" And Username = msgUsername And LCase(Message) = "no" Then
AddQ Username & " has refused the Duel Challenge."
Exit Sub
End If

If Left(Message, Len(BotVars.Trigger)) <> BotVars.Trigger Then
Exit Sub
Else
Message = Replace(Message, BotVars.Trigger, "", 1, 1) '// Remove The Trigger From Message
End If

If gdDuel_Access > MyAccess Then Exit Sub

Select Case Split(LCase(Message), " ")(0)
Case LCase(gdDuel_Command): gdDuel Username, Message
Case LCase(gdStats_Command): gdStatReturn Username, Message
Case LCase(gdDelete_Command): gdDel Username, Message
Case LCase(gdFire_Command): gdFire Username, Message
Case LCase(gdAim_Command): gdAim Username, Message
Case LCase(gdCover_Command): gdCover Username, Message
Case LCase(gdHeal_Command): gdHeal Username, Message
Case LCase(gdStim_Command): gdStim Username, Message
Case LCase(gdCloak_Command): gdCloak Username, Message
End Select

End Sub



Sub gd_Event_WhisperFromUser(Username, Flags, Message)

gd_event_UserTalk Username, Flags, Message, 1

End Sub



Sub gd_Event_Close()
Dim TempStr

Set gdsaved = gdfso.OpenTextFile(gdFilePath, 2, True)

For Each Key In gdstats.Keys '// Puts All info into a file
TempStr = Key & " " & gdstats.Item(Key)(0) & " " & gdstats.Item(Key)(1) & " " & gdstats.Item(Key)(2) & " " & gdstats.Item(Key)(3) & " " & gdstats.Item(Key)(4)
gdsaved.WriteLine TempStr
Next
gdsaved.Close
Set gdsaved = Nothing
End Sub



Sub gdDel(Username, Message)

GetDBEntry Username, MyAccess, MyFlags

User = Split(Message, " ")
msgUsername = User(1)

If LCase(msgUsername) = "me" Then '// Change Username Incase of "me"
msgUsername = Username
ElseIf gdDel_Access > MyAccess Then '// Checks For User Access To This Command, Unless Deleting Themselfs (Reset Char)
AddQ "/whisper " & psd2 & Username & " Your access is to low to delete other players."
Exit Sub
End If

If gdGameOn = "True" Then '// Checks for current duels
AddQ "/whisper " & psd2 & Username & " a duel is currently in progress. Please wait for this duel to end."
Exit Sub
End If

If gdstats.Exists(msgUsername) = False Then
AddQ "/whisper " & psd2 & Username & " Player does not exist."
Exit Sub
Else
gdstats.Remove msgUsername
AddQ "/whisper " & psd2 & Username & " " & msgUsername & " has been deleted."
End If

End Sub



Sub gdDuel(Username, Message)

If gdGameOn = "True" Then '// Checks for current duels
AddQ "/whisper " & psd2 & Username & " a duel is currently in progress. Please wait for this duel to end."
Exit Sub
End If

User = Split(Message, " ")
msgUsername = LCase(User(1))

If GetPositionByName(msgUsername) = -1 Then '// Checks for user in channel
AddQ "/whisper " & psd2 & Username & " " & msgUsername & " is not currently in the channel."
Exit Sub
Else
AddQ "/whisper " & psd2 & msgUsername & " " & Username & " has challenged you to a duel."
AddQ "/whisper " & psd2 & msgUsername & " Whisper me 'Yes' or 'NO'."
gdChallenge = "True"
gdPlayer1(1) = Username
gdPlayer2(1) = msgUsername
End If
End Sub



Sub gdStatReturn(Username, Message)

User = Split(Message, " ")
msgUsername = User(1)

If LCase(msgUsername) = "me" Then '// Change Username Incase of "me"
msgUsername = Username
End If

If Not gdstats.Exists(msgUsername) Then '// Checks for user in dictionary
AddQ "/whisper " & psd2 & Username & " This Player does not exist."
Exit Sub
Else
gdStatsLookup(0) = gdstats.Item(msgUsername)(0)
gdStatsLookup(1) = gdstats.Item(msgUsername)(1)
gdStatsLookup(2) = gdstats.Item(msgUsername)(2)
gdStatsLookup(3) = gdstats.Item(msgUsername)(3)
gdStatsLookup(4) = gdstats.Item(msgUsername)(4)
AddQ "/whisper " & psd2 & Username & " " & msgUsername & " Level:" & gdStatsLookup(0) & " Attack:" & gdStatsLookup(1) & " Accurcy:" & gdStatsLookup(2) & " Evasion:" & gdStatsLookup(3) & " Experience(%):" & gdStatsLookup(4)
End If
End Sub



Sub gdFire(Username, Message)

If gdGameOn = "False" Then
Exit Sub
End If

If gdstats.Item(Username)(0) < gdFire_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1(1) And gdDonePlayer1 = "False" Then
gdDonePlayer1 = "True"
gdActionPlayer1 = 1
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Have Fired One Shoot."
ElseIf Username = gdPlayer2(1) And gdDonePlayer2 = "False" Then
gdDonePlayer2 = "True"
gdActionPlayer2 = 1
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Have Fired One Shoot."
End If

If gdDonePlayer1 = "True" And gdDonePlayer2 = "True" Then
gdActionChosen
End If
End Sub



Sub gdAim(Username, Message)

If gdGameOn = "False" Then
Exit Sub
End If

If gdstats.Item(Username)(0) < gdAim_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

AddChat vbBlue, "Checkpoint"

If Username = gdPlayer1(1) And gdDonePlayer1 = "False" Then
gdDonePlayer1 = "True"
gdActionPlayer1 = 2
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Aim Your Next Shoot."
ElseIf Username = gdPlayer2(1) And gdDonePlayer2 = "False" Then
gdDonePlayer2 = "True"
gdActionPlayer2 = 2
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Aim Your Next Shoot."
End If

AddChat vbBlue, "Checkpoint"

If gdDonePlayer1 = "True" And gdDonePlayer2 = "True" Then
gdActionChosen
End If
End Sub



Sub gdCover(Username, Message)

If gdGameOn = "False" Then
Exit Sub
End If

If gdstats.Item(Username)(0) < gdCover_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1(1) And gdDonePlayer1 = "False" Then
gdDonePlayer1 = "True"
gdActionPlayer1 = 3
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Take Cover And Shoot."
ElseIf Username = gdPlayer2(1) And gdDonePlayer2 = "False" Then
gdDonePlayer2 = "True"
gdActionPlayer2 = 3
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Take Cover And Shoot."
End If

If gdDonePlayer1 = "True" And gdDonePlayer2 = "True" Then
gdActionChosen
End If
End Sub



Sub gdHeal(Username, Message)

If gdGameOn = "False" Then
Exit Sub
End If

If gdstats.Item(Username)(0) < gdHeal_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1(1) And gdDonePlayer1 = "False" Then
gdDonePlayer1 = "True"
gdActionPlayer1 = 4
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Heal Yourself."
ElseIf Username = gdPlayer2(1) And gdDonePlayer2 = "False" Then
gdDonePlayer2 = "True"
gdActionPlayer2 = 4
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Heal Yourself."
End If

If gdDonePlayer1 = "True" And gdDonePlayer2 = "True" Then
gdActionChosen
End If
End Sub



Sub gdStim(Username, Message)

If gdGameOn = "False" Then
Exit Sub
End If

If gdstats.Item(Username)(0) < gdStim_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1(1) And gdDonePlayer1 = "False" Then
gdDonePlayer1 = "True"
gdActionPlayer1 = 5
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Fire Two Shoots."
ElseIf Username = gdPlayer2(1) And gdDonePlayer2 = "False" Then
gdDonePlayer2 = "True"
gdActionPlayer2 = 5
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Fire Two Shoots."
End If

If gdDonePlayer1 = "True" And gdDonePlayer2 = "True" Then
gdActionChosen
End If
End Sub



Sub gdCloak(Username, Message)

If gdGameOn = "False" Then
Exit Sub
End If

If gdstats.Item(Username)(0) < gdCloak_Level Then
AddQ "/whisper " & psd2 & Username & " Your Lvl Is Too Low Too Use This Attack."
Exit Sub
End If

If Username = gdPlayer1(1) And gdDonePlayer1 = "False" Then
gdDonePlayer1 = "True"
gdActionPlayer1 = 6
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Cloak And Shoot."
ElseIf Username = gdPlayer2(1) And gdDonePlayer2 = "False" Then
gdDonePlayer2 = "True"
gdActionPlayer2 = 6
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Cloak And Shoot."
End If

If gdDonePlayer1 = "True" And gdDonePlayer2 = "True" Then
gdActionChosen
End If
End Sub



Sub gdActionChosen()

gdDonePlayer1 = "False"
gdDonePlayer2 = "False"

If gdActionPlayer1 = 1 Then '// Action: Fire
P1msg = gdPlayer1(1) & " Fires One Round At " & gdPlayer2(1)
a = (gdGameStats1(3) + (RanNum(1, 6) - 3)) - gdGameStats2(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

gdGameStats1(3) = gdPlayer1(4)
gdGameStats1(4) = gdPlayer1(5)
ElseIf gdActionPlayer1 = 2 Then '// Action: Aim
P1msg = gdPlayer1(1) & " Takes Aim At " & gdPlayer2(1)
gdGameStats1(3) = 999
gdGameStats1(4) = gdPlayer1(5)
ElseIf gdActionPlayer1 = 3 Then '// Action: Cover
P1msg = gdPlayer1(1) & " Takes Cover And Fires At " & gdPlayer2(1)
gdGameStats1(3) = gdPlayer1(4) - 1
gdGameStats1(4) = gdPlayer1(5) + 1
a = (gdGameStats1(3) + (RanNum(1, 6) - 3)) - gdGameStats2(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

ElseIf gdActionPlayer1 = 4 Then '// Action: Heal
P1msg = gdPlayer1(1) & " Heals"
gdGameStats1(1) = gdGameStats1(1) + RanNum(1, 5)
gdGameStats1(3) = gdPlayer1(4)
gdGameStats1(4) = gdPlayer1(5)
ElseIf gdActionPlayer1 = 5 Then '// Action: Stim
P1msg = gdPlayer1(1) & " Fires Two Rounds At " & gdPlayer2(1)
gdGameStats1(1) = gdGameStats1(1) - 4
a = (gdGameStats1(3) + (RanNum(1, 6) - 3)) - gdGameStats2(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

a = (gdGameStats1(3) + (RanNum(1, 6) - 3)) - gdGameStats2(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

gdGameStats1(3) = gdPlayer1(4)
gdGameStats1(4) = gdPlayer1(5)
ElseIf gdActionPlayer1 = 6 Then '// Action: Cloak
P1msg = gdPlayer1(1) & " Cloaks And Fires At " & gdPlayer2(1)
gdGameStats1(4) = 999
a = (gdGameStats1(3) + (RanNum(1, 6) - 3)) - gdGameStats2(4)

AddChat vbBlue, DoShot(P1msg, a, gdGameStats1(2), gdGameStats2(1))

gdGameStats1(3) = gdPlayer1(4)
Else '// All Possible Options Are Depleted, Show Error
P1msg = gdPlayer1(1) & " :gdActionChosen Error"
AddChat vbRed, "P1 gdActionPlayer1 is Incorrect --> ", vbBlue, gdActionPlayer1
End If


If gdActionPlayer2 = 1 Then '// Action: Fire
P2msg = gdPlayer2(1) & " Fires One Round At " & gdPlayer1(1)
a = (gdGameStats2(3) + (RanNum(1, 6) - 3)) - gdGameStats1(4)

AddChat vbBlue, DoShot(P2msg, a, gdGameStats2(2), gdGameStats1(1))

gdGameStats2(3) = gdPlayer2(4)
gdGameStats2(4) = gdPlayer2(5)
ElseIf gdActionPlayer2 = 2 Then '// Action: Aim
P2msg = gdPlayer2(1) & " Takes Aim At " & gdPlayer1(1)
gdGameStats2(3) = 999
gdGameStats2(4) = gdPlayer2(5)
ElseIf gdActionPlayer2 = 3 Then '// Action: Cover
P2msg = gdPlayer2(1) & " Takes Cover And Fires At " & gdPlayer1(1)
gdGameStats2(3) = gdPlayer2(4) - 1
gdGameStats2(4) = gdPlayer2(5) + 1
a = (gdGameStats1(3) + (RanNum(1, 6) - 3)) - gdGameStats2(4)

AddChat vbBlue, DoShot(P2msg, a, gdGameStats2(2), gdGameStats1(1))

ElseIf gdActionPlayer2 = 4 Then '// Action: Heal
P2msg = gdPlayer2(1) & " Heals"
gdGameStats1(1) = gdGameStats1(1) + RanNum(1, 5)
gdGameStats2(3) = gdPlayer2(4)
gdGameStats2(4) = gdPlayer2(5)
ElseIf gdActionPlayer2 = 5 Then '// Action: Stim
P2msg = gdPlayer2(1) & " Fires Two Rounds At " & gdPlayer1(1)
gdGameStats2(1) = gdGameStats2(1) - 4
a = (gdGameStats2(3) + (RanNum(1, 6) - 3)) - gdGameStats1(4)

AddChat vbBlue, DoShot(P2msg, a, gdGameStats2(2), gdGameStats1(1))

a = (gdGameStats2(3) + (RanNum(1, 6) - 3)) - gdGameStats1(4)

AddChat vbBlue, DoShot(P2msg, a, gdGameStats2(2), gdGameStats1(1))

gdGameStats2(3) = gdPlayer2(4)
gdGameStats2(4) = gdPlayer2(5)
ElseIf gdActionPlayer2 = 6 Then '// Action: Cloak
P2msg = gdPlayer2(1) & " Cloaks And Fires At " & gdPlayer1(1)
gdGameStats2(4) = 999
a = (gdGameStats2(3) + (RanNum(1, 6) - 3)) - gdGameStats1(4)

AddChat vbBlue, DoShot(P2msg, a, gdGameStats2(2), gdGameStats1(1))

gdGameStats2(3) = gdPlayer2(4)
Else '// All Possible Options Are Depleted, Show Error
P2msg = gdPlayer2(1) & " :gdActionChosen Error"
AddChat vbRed, "P2 gdActionPlayer2 is Incorrect --> ", vbBlue, gdActionPlayer2
End If

AddQ P1msg
AddQ P2msg
AddQ gdPlayer1(1) & " Hp: " & gdGameStats1(1) & " || " & gdPlayer2(1) & " Hp: " & gdGameStats2(1)

If gdGameStats2(1) < 1 And gdGameStats1(1) > 0 Then '// Player 1 Wins
gdPlayer1(6) = gdPlayer1(6) + gdPointsPerKill
AddQ gdPlayer1(1) & " Has Killed " & gdPlayer2(1)
gdGameOn = "False"
gdChallenge = "False"
If gdPlayer1(6) >= 100 Then gdLevelUp
gd_Event_Close
ElseIf gdGameStats1(1) < 1 And gdGameStats2(1) > 0 Then '// Player 2 Wins
gdPlayer2(6) = gdPlayer2(6) + gdPointsPerKill
AddQ gdPlayer2(1) & " Has Killed " & gdPlayer1(1)
gdGameOn = "False"
gdChallenge = "False"
If gdPlayer2(6) >= 100 Then gdLevelUp
gd_Event_Close
ElseIf gdGameStats1(1) < 1 And gdGameStats2(1) < 1 Then '// Tie
gdPlayer2(6) = gdPlayer2(6) + gdPointsPerTie
gdPlayer1(6) = gdPlayer1(6) + gdPointsPerTie
AddQ gdPlayer2(1) & " And " & gdPlayer1(1) & " Have Killed Eachother!!!"
gdGameOn = "False"
gdChallenge = "False"
If gdPlayer1(6) >= 100 Then gdLevelUp
If gdPlayer2(6) >= 100 Then gdLevelUp
gd_Event_Close
End If
End Sub



Sub gdLevelUp(Message)

gdPlayer1(2) = gdstats.Item(gdPlayer1(1))(1) '// Stores Player1's Level
gdPlayer1(6) = gdstats.Item(gdPlayer1(1))(5) '// Stores Player1's Exp (%)
gdPlayer2(2) = gdstats.Item(gdPlayer2(1))(1) '// Stores Player2's Level
gdPlayer2(6) = gdstats.Item(gdPlayer2(1))(5) '// Stores Player2's Exp (%)

If gdPlayer1(6) >= 100 Then
gdPlayer1(2) = gdPlayer1(2) + 1
gdPlayer1(6) = gdPlayer1(6) - 100
AddQ "/whisper " & psd2 & gdPlayer1(1) & " You Have Leveled, Please tell me which stat you would like to upgrade. Atk, Acc, Eva"
gdLeveling = "True"
gdLvlingPlayer = gdPlayer1(1)
Exit Sub '// Wait For User Input
ElseIf gdPlayer2(6) >= 100 Then
gdPlayer2(2) = gdPlayer2(2) + 1
gdPlayer2(6) = gdPlayer2(6) - 100
AddQ "/whisper " & psd2 & gdPlayer2(1) & " You Have Leveled, Please tell me which stat you would like to upgrade. Atk, Acc, Eva"
gdLeveling = "True"
gdLvlingPlayer = gdPlayer2(1)
Exit Sub '// Wait For User Input
End If

If gdLeveling = "False" Then Exit Sub

If gdLeveling = "True" And LCase(Message) = "atk" Then
gdstats.Item(gdLvlingPlayer)(2) = gdstats.Item(gdLvlingPlayer)(2) + 1
gdLeveling = False
AddQ "/whisper " & psd2 & gdLvlingPlayer & " Thank You For Making Your Selection. Succesfully Increased Atk By ONE."
Exit Sub
ElseIf gdLeveling = "True" And LCase(Message) = "acc" Then
gdstats.Item(gdLvlingPlayer)(3) = gdstats.Item(gdLvlingPlayer)(3) + 1
gdLeveling = "False"
AddQ "/whisper " & psd2 & gdLvlingPlayer & " Thank You For Making Your Selection. Succesfully Increased Acc By ONE."
Exit Sub
ElseIf gdLeveling = "True" And LCase(Message) = "eva" Then
gdstats.Item(gdLvlingPlayer)(4) = gdstats.Item(gdLvlingPlayer)(4) + 1
gdLeveling = "False"
AddQ "/whisper " & psd2 & gdLvlingPlayer & " Thank You For Making Your Selection. Succesfully Increased Eva By ONE."
Exit Sub
ElseIf gdLeveling = "True" Then
AddQ "/whisper " & psd2 & gdLvlingPlayer & " Your Selection is Incorrect: " & Message & ". Please Try Again."
Exit Sub
End If
End Sub



Private Function DoShot(ByRef Pmsg, ByVal a, ByVal gdAtk, ByRef gdHP)
If a >= 5 Then
Pmsg = Pmsg & " Critical!! "
gdHP = gdHP - (gdAtk + RanNum(1, 5))
ElseIf a >= 1 Then
Pmsg = Pmsg & " Hits "
gdHP = gdHP - (gdAtk + RanNum(0, 3))
ElseIf a = 0 Then
Pmsg = Pmsg & " Almost Missed "
gdHP = gdHP - (gdAtk)
ElseIf a <= -1 Then
Pmsg = Pmsg & " Misses "
gdHP = gdGameStats1(1)
End If

DoShot = "Shot Fired"
End Function



Private Function RanNum(minimum, maximum)
RanNum = Int(((maximum + 1) - (minimum)) * Rnd + (minimum))
End Function


Fixed a small mistake in the last update i made
HearthCore
i'd like to have a look and maybe find an error for you, but since you didnt comment the code out anywhere i can hardly find anything.
I guess i really NEED to search for responses .. tT
cyber_hunter
QUOTE(HearthCore @ Feb 4 2008, 02:34 PM) *

i'd like to have a look and maybe find an error for you, but since you didnt comment the code out anywhere i can hardly find anything.
I guess i really NEED to search for responses .. tT


If you give me about one week, I can comment everything. Just so you know i DID comment on some of the code, just not all of it. I was more preoccupied with finishing it (First Draft) before i feel asleep. But I will start commenting the code, hopfully i'll find enough time to do it quickly.
HearthCore
would be highly appreciated.
You'll find some more errors while commenting anyway - i guess :>
1ruleyou
Lol i think this is one funny script!
Hydrosassin
so does this work at all yet? i loaded it and got no response to the commands
xXJohnXx
Looks interesting but I guess you have a long way to go.
cyber_hunter
This project has been very slow going mostly due to personal matters, i'll try to check it out again in the next while here. Hopfully i can get it working.
Bulletboy
ok i get this as a problem

[22:11:40] Scripting runtime error '13': (line 0; column 0)
[22:11:40] Type mismatch: 'gd_event_load'.
[22:11:40] Offending line: >>
[22:11:40] Scripting runtime error '13': (line 0; column 0)
[22:11:40] Type mismatch: 'gd_event_load'.
[22:11:40] Offending line: >>
[22:11:40] Scripting runtime error '13': (line 0; column 0)
[22:11:40] Type mismatch: 'gd_event_load'.
[22:11:40] Offending line: >>

Help Please when u have time
Thanks
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.