Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Permanently dead


picool
 Share

Recommended Posts

Sure.
The following code will set the player's permanent death toggle to 1 when the player dies.  It will then kick the player, telling him that she or he died.  When the player joins the game, it will kick the player and give a message that the player is dead.  When a player makes a new character, that slot's death toggle is set off.  When a player dies in an arena map, the player's death toggle is not set to 1.
This takes 3 subs:

```
' Executes on death, dropping all of the players items.
Sub DropItems(Index)
Call PutVar("accounts\" & GetPlayerLogin(index) & "_Info.ini", "Char" & GetPlayerCharNum(Index), "Dead", 1)
If GetPlayerWeaponSlot(Index) > 0 Then
    Call PlayerMapDropItem(Index, GetPlayerWeaponSlot(Index), 0)
End If

If GetPlayerArmorSlot(Index) > 0 Then
    Call PlayerMapDropItem(Index, GetPlayerArmorSlot(Index), 0)
End If

If GetPlayerHelmetSlot(Index) > 0 Then
    Call PlayerMapDropItem(Index, GetPlayerHelmetSlot(Index), 0)
End If

If GetPlayerShieldSlot(Index) > 0 Then
    Call PlayerMapDropItem(Index, GetPlayerShieldSlot(Index), 0)
End If

If GetPlayerLegsSlot(Index) > 0 Then
    Call PlayerMapDropItem(Index, GetPlayerLegsSlot(Index), 0)
End If

If GetPlayerRingSlot(Index) > 0 Then
    Call PlayerMapDropItem(Index, GetPlayerRingSlot(Index), 0)
End If

If GetPlayerNecklaceSlot(Index) > 0 Then
    Call PlayerMapDropItem(Index, GetPlayerNecklaceSlot(Index), 0)
End If
Call AlertMsg(Index, "You have died!")
End Sub
```
```
' Executes when a player logs into the game.
Sub JoinGame(Index)
If GetVar("accounts\" & GetPlayerLogin(index) & "_Info.ini", "Char" & GetPlayerCharNum(Index), "Dead") = 1 Then
Call AlertMsg(Index, "You are dead!")
End If

If GetPlayerAccess(Index) = 0 Then
Call GlobalMsg(GetPlayerName(Index) & " has joined " & GameName & "!", GREY)
Else
Call GlobalMsg("Administrator " & GetPlayerName(Index) & " has joined " & GameName & "!", YELLOW)
End If

Call PlayerMsg(Index, "Welcome to " & GameName & "!", WHITE)

If LenB(MOTD) <> 0 Then
Call PlayerMsg(Index, "MOTD: " & MOTD, BRIGHTCYAN)
End If

Call SendWhosOnline(Index)
End Sub
```
```
' Executes when a new character is created.
Sub OnNewChar(Index, CharNum)
Call PutVar("accounts\" & GetPlayerLogin(index) & "_Info.ini", "Char" & GetPlayerCharNum(Index), "Dead", 0)
End Sub
```
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...