Find:
Code:
Function HasItem(ByVal index As Long, ByVal ItemNum As Long) As Long
Dim i As Long
HasItem = 0
' Check for subscript out of range
If IsPlaying(index) = False Or ItemNum <= 0 Or ItemNum > MAX_ITEMS Then
Exit Function
End If
For i = 1 To MAX_INV
' Check to see if the player has the item
If GetPlayerInvItemNum(index, i) = ItemNum Then
If Item(ItemNum).Type = ITEM_TYPE_CURRENCY Then
HasItem = GetPlayerInvItemValue(index, i)
Else
HasItem = 1
End If
Exit Function
End If
Next i
End Function
Under it add:
Code:
Function TakeGold(ByVal index As Long, ByVal ItemNum As Long, ByVal ItemVal As Long) As Boolean
Dim i As Long, N As Long
TakeGold = False
' Check for subscript out of range
If IsPlaying(index) = False Or ItemNum <= 0 Or ItemNum > MAX_ITEMS Then
Exit Function
End If
For i = 1 To MAX_INV
' Check to see if the player has the item
If GetPlayerInvItemNum(index, i) = ItemNum Then
If Item(ItemNum).Type = ITEM_TYPE_CURRENCY Then
' Is what we are trying to take away more then what they have? If so just set it to zero
If ItemVal <= GetPlayerInvItemValue(index, i) Then
Call SetPlayerInvItemValue(index, i, GetPlayerInvItemValue(index, i) - ItemVal)
Call SendInventoryUpdate(index, i)
TakeGold = True
Exit Function
End If
End If
End If
Next i
End Function
Find:
Code:
PK As Byte
in the player rec.
Under it add:
Code:
Bounty as Long
Then Find:
Code:
CQuit
Under it add:
Code:
CSetBounty
Then find:
Code:
Case CQuit
HandleQuit index
Under it add:
Code:
Case CSetBounty
HandleSetBounty index, Parse
Then find:
Code:
' :::::::::::::::::::::::
' :: Set access packet ::
' :::::::::::::::::::::::
Sub HandleSetAccess(ByVal index As Long, _
ByRef Parse() As String)
Dim N As Long, i As Long
' Prevent hacking
If GetPlayerAccess(index) < ADMIN_CREATOR Then
Call HackingAttempt(index, "Trying to use powers not available")
Exit Sub
End If
' The index
N = FindPlayer(Parse(1))
' The access
i = Val(Parse(2))
' Check for invalid access level
If i >= 0 Or i <= 3 Then
' Check if player is on
If N > 0 Then
If GetPlayerAccess(N) <= 0 Then
Call GlobalMsg(GetPlayerName(N) & " has been blessed with administrative access.", BrightBlue)
End If
Call SetPlayerAccess(N, i)
Call SendPlayerData(N)
Call AddLog(GetPlayerName(index) & " has modified " & GetPlayerName(N) & "'s access.", ADMIN_LOG)
Else
Call PlayerMsg(index, "Player is not online.", White)
End If
Else
Call PlayerMsg(index, "Invalid access level.", Red)
End If
End Sub
Under it add:
Code:
' :::::::::::::::::::::::
' :: Set Bounty packet ::
' :::::::::::::::::::::::
Sub HandleSetBounty(ByVal index As Long, _
ByRef Parse() As String)
Dim N As Long
Dim i As Long
' The index
N = FindPlayer(Parse(1))
' The name
i = (Parse(2))
' Check if player is on
If N > 0 Then
If N <> index Then
If GetPlayerLevel(N) >= 10 Then
If GetPlayerBounty(N) = 0 Then
If TakeGold(index, 1, i) Then
Call GlobalMsg(GetPlayerName(index) & " has just had a " & i & " dollar bounty put on " & GetPlayerName(N) & "!", BrightBlue)
Call SetPlayerBounty(N, i)
Call SendPlayerData(N)
Call AddLog(GetPlayerName(index) & " has put a " & i & " bounty on " & GetPlayerName(N), ADMIN_LOG)
Else
Call PlayerMsg(index, "You don't have sufficient funds for this action!", BrightRed)
End If
Else
Call PlayerMsg(index, GetPlayerName(N) & " already has a price on their head!", BrightRed)
End If
Else
Call PlayerMsg(index, "Player must be level 10 or higher!", BrightRed)
End If
Else
Call PlayerMsg(index, "You cant set a hit out on yourself!", BrightRed)
End If
Else
Call PlayerMsg(index, "Player isn't online!", BrightRed)
End If
End Sub
Then find:
Code:
' Player is dead
Call GlobalMsg(GetPlayerName(Victim) & " has been killed by " & GetPlayerName(Attacker), BrightRed)
Under it add:
Code:
If GetPlayerBounty(Victim) > 0 Then
'Give the reward
Call GiveItem(Attacker, 1, GetPlayerBounty(Victim))
'Send the messages
Call PlayerMsg(Attacker, "You have received: " & GetPlayerBounty(Victim) & " dollars for killing " & GetPlayerName(Victim), BrightGreen)
Call GlobalMsg(GetPlayerName(Victim) & " has been slain by " & GetPlayerName(Attacker) & " and has collected the " & GetPlayerBounty(Victim) & " dollar bounty on his/her head", BrightGreen)
'Set the bounty to 0
Call SetPlayerBounty(Victim, 0)
End If
And now for the code for the list:
Find:
Code:
Case CWhosOnline
HandleWhosOnline index
Under it add:
Code:
Case CBountyList
HandleBountyList index
Then find:
Code:
' :::::::::::::::::::::::
' :: Who online packet ::
' :::::::::::::::::::::::
Sub HandleWhosOnline(ByVal index As Long)
Call SendWhosOnline(index)
End Sub
Under it add:
Code:
' ::::::::::::::::::::::::
' :: Bounty list packet ::
' ::::::::::::::::::::::::
Sub HandleBountyList(ByVal index As Long)
Call SendBountyList(index)
End Sub
Then find:
Code:
Sub SendWhosOnline(ByVal index As Long)
Dim s As String
Dim N As Long, i As Long
For i = 1 To MAX_PLAYERS
If IsPlaying(i) Then
If i <> index Then
s = s & GetPlayerName(i) & ", "
N = N + 1
End If
End If
Next i
If N = 0 Then
s = "There are no other players online."
Else
s = Mid$(s, 1, Len(s) - 2)
s = "There are " & N & " other players online: " & s & "."
End If
Call PlayerMsg(index, s, WhoColor)
End Sub
Under it add:
Code:
Sub SendBountyList(ByVal index As Long)
Dim s As String
Dim N As Long, i As Long
For i = 1 To MAX_PLAYERS
If IsPlaying(i) Then
If i <> index Then
If GetPlayerBounty(i) > 0 Then
s = s & GetPlayerName(i) & "(" & GetPlayerBounty(i) & ")" & ", "
N = N + 1
End If
End If
End If
Next i
If N = 0 Then
s = "No one has a bounty!"
Else
s = Mid$(s, 1, Len(s) - 2)
s = "There are " & N & " players with bounties: " & s & "."
End If
Call PlayerMsg(index, s, WhoColor)
End Sub
Then find:
Code:
CSetBounty
Under it add:
Code:
CBountyList