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

Main.txt Bugs


HappyBoy
 Share

Recommended Posts

Here's my Main.txt :)…
I have inserted some codes from here, but when removing those I didn't need anymore, I made mistakes I guess, coz others aren't working anymore now...

I'll mark all the things that might cause the problem ;)
```
' Eclipse Evolution 2.7 Scripting File

' Global Variables
Public GameName
Public MAX_MAPS
Public MOTD

' Color Constants
Public Const BLACK = 0
Public Const BLUE = 1
Public Const GREEN = 2
Public Const CYAN = 3
Public Const RED = 4
Public Const MAGENTA = 5
Public Const BROWN = 6
Public Const GREY = 7
Public Const DARKGREY = 8
Public Const BRIGHTBLUE = 9
Public Const BRIGHTGREEN = 10
Public Const BRIGHTCYAN = 11
Public Const BRIGHTRED = 12
Public Const PINK = 13
Public Const YELLOW = 14
Public Const WHITE = 15

' Admin Constants
Public Const ADMIN_MONITER = 1
Public Const ADMIN_MAPPER = 2
Public Const ADMIN_DEVELOPER = 3
Public Const ADMIN_CREATOR = 4

' Executes when the server initially loads.
Sub OnServerLoad()
GameName = GetVar("Data.ini", "CONFIG", "GameName")
MAX_MAPS = GetVar("Data.ini", "MAX", "MAX_MAPS")
MOTD = GetVar("MOTD.ini", "MOTD", "Msg")
End Sub

' Executes when the scripts are reloaded.
Sub OnScriptReload()
GameName = GetVar("Data.ini", "CONFIG", "GameName")
MAX_MAPS = GetVar("Data.ini", "MAX", "MAX_MAPS")
MOTD = GetVar("MOTD.ini", "MOTD", "Msg")
End Sub

' Executes the MOTD is changed by the client.
Sub ChangeMOTD()
MOTD = GetVar("MOTD.ini", "MOTD", "Msg")
End Sub

' Executes when a new character is created.
Sub OnNewChar(Index, CharNum)

End Sub

' Executes every second, based on the server time.
Sub TimedEvent(Hours, Minutes, Seconds)
If Minutes = 0 Then
If Seconds = 0 Then
Call AdminMsg("Contact an Admin if having any troubles.", YELLOW)
End If
End If
End Sub

' Executes when a player presses the CONTROL key.
Sub OnAttack(Index, Damage)
Dim Target

If Int(Damage) > 0 Then
If Int(GetPlayerTarget(Index)) > 0 Then
Target = GetPlayerTarget(Index)
Call DamagePlayer(Index, Target, Damage)
Else
Target = GetPlayerTargetNPC(Index)
Call DamageNPC(Index, Target, Damage)
End If
End If
End Sub

Sub OnArrowHit(Index, Damage)
Dim Target

If Int(Damage) > 0 Then
If Int(GetPlayerTarget(Index)) > 0 Then
Target = GetPlayerTarget(Index)
Call DamagePlayer(Index, Target, Damage)
Else
Target = GetPlayerTargetNPC(Index)
Call DamageNPC(Index, Target, Damage)
End If
End If
End Sub

Sub PlayerHit(Index, NPCNum, Damage)
If Damage > 0 then
Call NPCAttack(NPCNum, Index, Damage)
End If
End Sub

[b]' Executes when a hotkey is pressed client-side.
Sub HotScript(Index, KeyID)
Select Case KeyID
' Executes when any player presses the PageUp key.
Case 1
Dim Name
Dim Guild
Dim ClassName
Dim Sex
Dim Level
Dim Strenght
Dim Defence
Dim Speed
Dim Magic
Dim HP
Dim MP
Dim MAXHP
Dim MAXMP
Dim msg1
Dim msg2
Dim msg3
Dim msg4
Dim msg5

Call CustomMenuShow(index, "mailsystem", "\GUI\CUSTOM\perkament.gif", 1)
Call CustomMenuLabel(index, 1, "Character Info", 60, 30, 15, 0, 0, 400, 40)
Call CustomMenuLabel(index, 2, "Messages", 315, 30, 15, 0, 0, 400, 40)

Name = GetPlayerName(index) & ""
Guild = GetPlayerGuild(index) & ""
ClassName = GetPlayerClassName(index) & ""
Level = GetPlayerLevel(index) & ""
Strenght = GetPlayerStr(index) + 0 & ""
Defence = GetPlayerDef(index) & ""
Speed = GetPlayerSpeed(index) & ""
Magic = GetPlayerMagi(index) + 0 & ""
HP = GetPlayerHP(index) & ""
MP = GetPlayerMP(index) & ""
MAXHP = GetPlayerMaxHP(index) & ""
MAXMP = GetPlayerMaxMP(index) & ""

If GetPlayerSex(index) = 0 Then
Sex = "Male"
Else
Sex = "Female"
End If

Call CustomMenuLabel(index, 3, "Name: " & Name, 85, 80, 10, 0, 0, 400, 40)
Call CustomMenuLabel(index, 4, "Guild: " & Guild, 85, 90, 10, 0, 0, 400, 40)
Call CustomMenuLabel(index, 5, "Class: " & ClassName, 85, 100, 10, 0, 0, 400, 40)
Call CustomMenuLabel(index, 6, "Sex: " & Sex, 85, 110, 10, 0, 0, 400, 40)

Call CustomMenuLabel(index, 7, "Level: " & Level, 85, 130, 10, 0, 0, 400, 40)
Call CustomMenuLabel(index, 8, "Strenght: " & Strenght, 85, 140, 10, 0, 0, 400, 40)
Call CustomMenuLabel(index, 9, "Defence: " & Defence, 85, 150, 10, 0, 0, 400, 40)
Call CustomMenuLabel(index, 10, "Magic: " & Magic, 85, 160, 10, 0, 0, 400, 40)
Call CustomMenuLabel(index, 11, "Speed: " & Speed, 85, 170, 10, 0, 0, 400, 40)

msg1 = GetVar("mailsystem\" & GetPlayerName(index) & ".ini", "mailbox", "box1")
msg2 = GetVar("mailsystem\" & GetPlayerName(index) & ".ini", "mailbox", "box2")
msg3 = GetVar("mailsystem\" & GetPlayerName(index) & ".ini", "mailbox", "box3")
msg4 = GetVar("mailsystem\" & GetPlayerName(index) & ".ini", "mailbox", "box4")
msg5 = GetVar("mailsystem\" & GetPlayerName(index) & ".ini", "mailbox", "box5")

Call CustomMenuLabel(index, 14, "Message 1: " & msg1, 300, 70, 10, 0, 0, 400, 40)
Call CustomMenuLabel(index, 15, "Message 2: " & msg2, 300, 80, 10, 0, 0, 400, 40)
Call CustomMenuLabel(index, 16, "Message 3: " & msg3, 300, 90, 10, 0, 0, 400, 40)
Call CustomMenuLabel(index, 17, "Message 4: " & msg4, 300, 100, 10, 0, 0, 400, 40)
Call CustomMenuLabel(index, 18, "Message 5: " & msg5, 300, 110, 10, 0, 0, 400, 40)

Call CustomMenuLabel(index, 19, "Clear Inbox", 300, 140, 10, 0, 0, 100, 14)
Call CustomMenuLabel(index, 12, "Refresh", 300, 150, 10, 0, 0, 100, 14)

Call CustomMenuTextBox(index, 1, 180, 65, 235, "Enter a name!")
Call CustomMenuTextBox(index, 2, 180, 65, 260, "Enter a message!")
' Executes when any player presses the Delete key.
Case 2

' Executes when players press the End key.
Case 3

' Executes when players press the PageDown key.
Case 4
End Select
End Sub[/b]

[b]' Executes when a player logs into the game.
Sub JoinGame(Index)
Dim GMOTD
Dim q
q = 1

GMOTD = Trim(GetVar("guilds.ini", GetPlayerGuild(index), "Motd"))

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)
If GetVar("var.ini", GetPlayerName(index), "startup") = "" Then

weapon = Int(GetVar("classes\class" & GetPlayerClass(index) & ".ini", "StartUp", "Weapon"))
armor = Int(GetVar("classes\class" & GetPlayerClass(index) & ".ini", "StartUp", "Armor"))
shield = Int(GetVar("classes\class" & GetPlayerClass(index) & ".ini", "StartUp", "Shield"))
helmet = Int(GetVar("classes\class" & GetPlayerClass(index) & ".ini", "StartUp", "Helmet"))
wepdur = Int(GetVar("classes\class" & GetPlayerClass(index) & ".ini", "StartUp", "Wepdur"))
armdur = Int(GetVar("classes\class" & GetPlayerClass(index) & ".ini", "StartUp", "Armdur"))
shldur = Int(GetVar("classes\class" & GetPlayerClass(index) & ".ini", "StartUp", "Shldur"))
hlmdur = Int(GetVar("classes\class" & GetPlayerClass(index) & ".ini", "StartUp", "Hlmdur"))

If weapon <> 0 Then
Call Give_Item(index, weapon, wepdur)
End If
If armor <> 0 Then
Call Give_Item(index, armor, armdur)
End If
If shield <> 0 Then
Call Give_Item(index, shield, shldur)
End If
If helmet <> 0 Then
Call Give_Item(index, helmet, hlmdur)
End If

Call PutVar("var.ini", GetPlayerName(index), "startup", "yes")
End If

[/b]
If GetPlayerGuild(index) = "" Then
Call PlayerMsg(index, "You are not in a guild!", 9)
Else
Call PlayerMsg(index, GetPlayerGuild(index) & ": " & GMOTD, 9)
End If

  Do While q < 201
  If GetVar("Scripts\charextras\" & GetPlayerName(Index) & ".ini", "QUESTS", "Quest" & q) = "" Then
      Call PutVar("Scripts\charextras\" & GetPlayerName(Index) & ".ini", "QUESTS", "Quest" & q, 0)
  End If
  q = q + 1
  Loop

End Sub

' Executes when a player logs out of the game.
Sub LeftGame(Index)
If GetPlayerAccess(Index) = 0 Then
Call GlobalMsg(GetPlayerName(Index) & " has left " & GameName & "!", GREY)
Else
Call GlobalMsg("Administrator " & GetPlayerName(Index) & " has left " & GameName & "!", YELLOW)
End If
If GetVar("Buff.ini", GetPlayerName(index), "0") <> "" Then
Call Debuff(index, "0")
End If
If GetVar("Buff.ini", GetPlayerName(index), "1") <> "" Then
Call Debuff(index, "1")
End If
If GetVar("Buff.ini", GetPlayerName(index), "2") <> "" Then
Call Debuff(index, "2")
End If
If GetVar("Buff.ini", GetPlayerName(index), "3") <> "" Then
Call Debuff(index, "3")
End If
End Sub

' Executes when a players experience exceeds the next level requirement.
Sub PlayerLevelUp(Index)
Dim TotalExp

Do While GetPlayerExp(Index) >= GetPlayerNextLevel(Index)
TotalExp = GetPlayerExp(Index) - GetPlayerNextLevel(Index)
Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1)

Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 1)
Call SetPlayerExp(Index, TotalExp)
Loop

Call BattleMsg(Index, "You have " & GetPlayerPOINTS(Index) & " stat points.", BRIGHTBLUE, 0)
End Sub

' Executes when a player uses one of the points given on an attribute to level up.
Sub UsingStatPoints(Index, PointType)
Select Case PointType
Case 0
If GetPlayerSTR(Index) + 1 > 1000 Then
Call BattleMsg(Index, "You have maxed your strength!", BRIGHTRED, 0)
Exit Sub
End If
Call SetPlayerSTR(Index, GetPlayerSTR(Index) + 1)
Call BattleMsg(Index, "You have gained more strength!", WHITE, 0)

Case 1
If GetPlayerDEF(Index) + 1 > 1000 Then
Call BattleMsg(Index, "You have maxed your defence!", BRIGHTRED, 0)
Exit Sub
End If
Call SetPlayerDEF(Index, GetPlayerDEF(Index) + 1)
Call BattleMsg(Index, "You have gained more defense!", WHITE, 0)

Case 2
If GetPlayerMAGI(Index) + 1 > 1000 Then
Call BattleMsg(Index, "You have maxed your magic!", BRIGHTRED, 0)
Exit Sub
End If
Call SetPlayerMAGI(Index, GetPlayerMAGI(Index) + 1)
Call BattleMsg(Index, "You have gained more magic!", WHITE, 0)

Case 3
If GetPlayerSPEED(Index) + 1 > 1000 Then
Call BattleMsg(Index, "You have maxed your speed!", BRIGHTRED, 0)
Exit Sub
End If
Call SetPlayerSPEED(Index, GetPlayerSPEED(Index) + 1)
Call BattleMsg(Index, "You have gained more speed!", WHITE, 0)
End Select

' Remove one point after the sub in question is done
Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) - 1)
End Sub

' Executes when a player steps onto a scripted tile.
Sub ScriptedTile(Index, Script)
Select Case Script
Case 0
Call PlayerMsg(Index, "This scripted tile has no apparent use.", WHITE)
Exit Sub

Case Else
Call PlayerMsg(Index, "No tile script found. Please contact an admin to solve this problem.", WHITE)
Exit Sub
End Select
End Sub

' Executes when a player clicks on an OnClick tile.
Sub OnClick(Index, Script)
Select Case Script
Case 0
Call PlayerMsg(Index, "This scripted tile has no apparent use.", WHITE)
Exit Sub

Case Else
Call PlayerMsg(Index, "No tile script found. Please contact an admin to solve this problem.", WHITE)
Exit Sub
End Select
End Sub

' Out-dated: Executes when a player chooses yes or no on a player prompt.
[b]'-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Sub Playerprompt(index, Prompt, Value)
'-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Dim Curr
Dim Key
Dim Stuff

Key = 2 ' Item number of the key
Curr = 1 ' Item number of your main currency

If Prompt = 6 Then
    Select Case Int(Value)
    Case 0 ' House Merchant
        Call SetHouseOwner(index)

    Case 1 ' Key Seller
        If Int(GetPlayerHouse(GetPlayerName(index))) > Int(0) Then
            If Int(GetFreeItemSlot(index)) > Int(0) Then
Call playerMsg(Index, "HEre!", 14)
                If Int(TakeCurrency(index, Curr, 50)) = Int(1) Then
    Call PlayerMsg(Index, GetHouseKey(GetPlayerHouse(GetPlayerName(Index))), 3)
                    Call GiveItem(index, GetFreeItemSlot(index), Key, GetHouseKey(GetPlayerHouse(GetPlayerName(Index))))
                    Call MapMsg(GetPlayerMap(index), "Key Merchant : Enjoy your new key!", 15)
                    Exit Sub
                Else
                    Call PlayerMsg(index, "Key Merchant : You dont have enough for a key!", 15)
                End If
            Else
                Call PlayerMsg(index, "Key Merchant : You dont have enough room sir!", 15)
            End If
        Else
            Call PlayerMsg(index, "Key merchant : I can only make keys for your own home!", 15)
        End If

    Case 2 ' LockSmith
        If GetPlayerHouse(GetPlayerName(index)) > 0 Then
            If TakeCurrency(index, Curr, 50) = 1 Then
                Call SetHouseKey(GetPlayerHouse(index))
                Call MapMsg(GetPlayerMap(index), "Lock Smith : Pleasure doin buisness wi'ye!", 15)
            Elsem
                Call PlayerMsg(index, "Lock Smith : Pssstt, you dont have enough coins mate!", 15)
            End If
        Else
            Call PlayerMsg(index, "Lock Smith : Thats all well n good mate but you dont have a house!", 15)
        End If

    Case 3 ' Furnature Drop
        Stuff = getVar("\Scripts\PlayerHousing\Furnature.ini", "Players", CStr(LCase(GetPlayerName(index))))
        Call ClearSquares(index)
        Call LoadFurnature(index, LCase(Stuff))
        Call LockPlayer(index, 0)
    End Select

Else

    Select Case Int(Value)
        Case 0
            Call MapMsg(GetPlayerMap(index), "Housing Agent : Very well " & GetPlayerName(index) & ", please come back when

you are ready!", 15)

        Case 1
            Call MapMsg(GetPlayerMap(index), "Key merchant : Very well " & GetPlayerName(index) & ", please come back when

you are ready!", 15)

    Case 2
        Call MapMsg(GetPlayerMap(index), "Lock Smith : Very well " & GetPlayerName(index) & ", please come back when you are

ready!", 15)

    Case 3
        Call ClearSquares(index)
        Call LockPlayer(index, 0)
    End Select
End If
End Sub

' Out-dated: Executes query box responses.
'-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Sub QueryBox(index, Script) 
'-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Value = GetVar("responses.ini","Responses",Cstr(index))

Select Case Int(Script)
Case 0
If GetPlayerHouse(Value) > 0 Then
Call PlayerWarp(Index, GetPlayerHouse(Value), 9, 14)
Else
Call PlayerMsg(Index, "That person doesnt seem to have a house!", 12)
End If

End Select

End Sub[/b]

' Executes every time a player drops an item.
Sub OnItemDrop(Index, Map, ItemNum, ItemVal, ItemDur, ItemIndex, InvSlot)

End Sub

' Executes each time a player changes map.
Sub OnMapLoad(Index, OldMap, NewMap)
Call SaveCharInfo (index)
End Sub

' Executes whenever an NPC is killed.
' Note: Death occurs as normal externally to this script.
Sub OnNPCDeath(Index, Map, NPCNum, NPCIndex)
Call BattleMsg(Index, "You killed a " & getnpcname(NPCNum) & ".", BRIGHTRED, 0)
End Sub

' Executes when a player is killed by another.
' Note: Death occurs as normal externally to this script.
Sub OnPVPDeath(Attacker, Victim)
Call GlobalMsg(GetPlayerName(Victim) & " has been killed by " & GetPlayerName(Attacker), BRIGHTRED)
End Sub

' Executes when a player dies in an arena by another player.
Sub OnArenaDeath(Attacker, Victim)
Dim Map
Dim X
Dim Y
Dim Data1
Dim Data2
Dim Data3

Map = GetPlayerMap(Victim)
X = GetPlayerX(Victim)
Y = GetPlayerY(Victim)

Call GlobalMsg(GetPlayerName(Victim) & " has been defeated in the arena by " & GetPlayerName(Attacker), BRIGHTRED)

Call SetPlayerHP(Victim, GetPlayerMaXHP(Victim))
Call SetPlayerMP(Victim, GetPlayerMaXMP(Victim))

Call sendHp(Victim)
Call sendMP(Victim)

Data1 = GetTileData1(Map, X, Y)
Data2 = GetTileData2(Map, X, Y)
Data3 = GetTileData3(Map, X, Y)

Call PlayerWarp(Victim, Data1, Data2, Data3)
End Sub

' Executes whenever a player casts a scripted spell.
Sub ScriptedSpell(Index, Script)
Select Case Script
Case 0
Call Buff(index, stat, amount, duration)
Case 1
If GetPlayerTarget(index) > 0 Then
Call Buff(GetPlayerTarget(index), 3, 500, 10)
End If

Case Else
Call PlayerMsg(Index, "No spell script found. Please contact an admin to solve this problem.", WHITE)
Exit Sub
End Select
End Sub

[b]' Executes whenever a scripted NPC does an action.
Sub ScriptedNPC(Index, Script)
Select Case Script

Case 0 'Noobs Quest
'Quest Nummer 1 Begin
If GetPlayerLevel(Index) > 0 Then
If Getvar("Scripts\charextras\" & GetPlayerName(Index) & ".ini", "QUESTS", "Quest1") = 0 Then
Call PlayerMsg(Index, "Noob says: Hello there stranger, you have to give me 60 gold, because I am a noob and really need it. To get gold, kill monsters, press ctrl, and grab their money, press enter. You will be rewarded!", MAGENTA)
Call PutVar("Scripts\charextras\" & GetPlayerName(Index) & ".ini", "QUESTS", "Quest1", 1)
  ElseIf GetVar("Scripts\charextras\" & GetPlayerName(Index) & ".ini", "QUESTS", "Quest1") = 1 Then
          If CanTake(Index, 1, 60) Then
          Call TakeItem(Index, 1, 60)
          Call PutVar("Scripts\charextras\" & GetPlayerName(Index) & ".ini", "QUESTS", "Quest1", 2)
          Call PlayerMsg(Index, "Noob says: Thank you for the 60 gold, here's your reward.", MAGENTA)
          Call SetPlayerEXP(Index, GetPlayerEXP(Index) + 150)
Call PlayerMsg(Index, "You receive experience points: 150", YELLOW)
Call SendStats(Index)
Call PlayerLevelUp(Index)
Call GiveCurrency(Index, 0, 0)
Call PlayerMsg(Index, "You receive Money: 0", YELLOW)
Else
Call PlayerMsg(Index, "Noob says: To attack a monster, press CTRL, to pick things up press ENTER while standing on it.", MAGENTA)
    End If
ElseIf GetVar("Scripts\charextras\" & GetPlayerName(Index) & ".ini", "QUESTS", "Quest1") = 2 Then
Call PlayerMsg(Index, "Noob says: Hello, again, thanks for the money!", MAGENTA)
Call PlayerMsg(Index, "(You already completed this Quest.)", BLACK)
End If
Else
Call PlayerMsg(Index, "The Level requirement for  this quest is too high.", MAGENTA)
End If
Exit Sub[/b]

Case Else
Call PlayerMsg(Index, "No NPC script found. Please contact an admin to solve this problem.", WHITE)
Exit Sub
End Select
End Sub

' Executed whenever a slash command is sent to the server.
Sub Commands(Index)
  Dim TextSay
  Dim PlayerID
  Dim MapNum

  ' Get the command and arguments from the cache.
  TextSay = Trim(GetVar("Scripts\Command.ini", "TEMP", "Text" & Index))

  ' Split the command into an array. All arguments are seperated by spaces.
  TextSay = Split(TextSay)

  Select Case TextSay(0)
      Case "/testscripts"
        Call TestMain(Index)
        Exit Sub

      Case "/help"
        Call PlayerMsg(Index, "Social Commands:", WHITE)
        Call PlayerMsg(Index, "'msghere = Broadcast Message", WHITE)
        Call PlayerMsg(Index, "-msghere = Emote Message", WHITE)
        Call PlayerMsg(Index, "!namehere msghere = Player Message", WHITE)
        Call PlayerMsg(Index, "Available Commands: /help, /info, /who, /fps, /inv, /stats, /train, /party, /join, /leave, /refresh", WHITE)
        Exit Sub 

      Case "/calladmins"
        If GetPlayerAccess(Index) = 0 Then
            Call AdminMsg(GetPlayerName(Index) & " needs your help!", BRIGHTGREEN)
        Else
            Call PlayerMsg(Index, "You are an admin! You cannot call for help!", BRIGHTGREEN)
        End If
        Exit Sub 

      Case "/admin"
        If GetPlayerAccess(Index) > 0 Then
            Call PlayerMsg(Index, "Social Commands:", WHITE)
            Call PlayerMsg(Index, """msghere = Global Admin Message", WHITE)
            Call PlayerMsg(Index, "=msghere = Private Admin Message", WHITE)
            Call PlayerMsg(Index, "Available Commands: /admin, /loc, /mapeditor, /warpmeto, /warptome, /warpto, /setsprite, /mapreport, /kick, /ban, /edititem, /respawn, /editnpc, /motd, /editshop, /ban, /editspell", WHITE)
        End If
        Exit Sub

      Case "/warpmeto"
        If GetPlayerAccess(Index) > 0 Then
            PlayerID = FindPlayer(TextSay(1))

            If PlayerID > 0 Then
              Call PlayerWarp(Index, GetPlayerMap(PlayerID), GetPlayerX(PlayerID), GetPlayerY(PlayerID))
              Call PlayerMsg(Index, "You have been warped to " & GetPlayerName(PlayerID) & ".", BROWN)
            Else
              Call PlayerMsg(Index, "Player is not online.", WHITE)
            End If
        End If
        Exit Sub

      Case "/warptome"
        If GetPlayerAccess(Index) > 0 Then
            PlayerID = FindPlayer(TextSay(1))

            If PlayerID > 0 Then
              Call PlayerWarp(PlayerID, GetPlayerMap(Index), GetPlayerX(Index), GetPlayerY(Index))
              Call PlayerMsg(PlayerID, "You have been warped to " & GetPlayerName(Index) & ".", BROWN)
            Else
              Call PlayerMsg(Index, "Player is not online.", WHITE)
            End If
        End If
        Exit Sub

      Case "/warpto"
        If GetPlayerAccess(Index) > 0 Then
            MapNum = TextSay(1)

            If MapNum > 0 And MapNum <= MAX_MAPS Then
              Call PlayerWarp(Index, MapNum, GetPlayerX(Index), GetPlayerY(Index))
              Call PlayerMsg(Index, "You have been warped to map #" & MapNum & ".", BRIGHTBLUE)
            Else
              Call PlayerMsg(Index, "Invalid map number.", BRIGHTRED)
            End If
        End If

      Case "/map"
        Call CustomMenuShow(Index, Map, "\GUI\Custom\Map.bmp", 1)
        Exit Sub
  End Select

  Call PlayerMsg(Index, "That is not a valid command.", BRIGHTRED)
End Sub

' Executes on death, dropping all of the players items.
Sub DropItems(Index)
' Remove this to enable.
Exit Sub

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
End Sub

' Executes whenever somebody dies outside of an arena.
Sub OnDeath(Index)
Dim MapNum
Dim ClassID
Dim X
Dim Y

If GetMapBootMap(Index) > 0 Then
Call PlayerWarp(Index, GetMapBootMap(Index), GetMapBootX(Index), GetMapBootY(Index))
Else
ClassID = GetPlayerClass(Index)

MapNum = GetVar("Classes\Class" & ClassID & ".ini", "CLASS", "Map")

X = GetVar("Classes\Class" & ClassID & ".ini", "CLASS", "x")
Y = GetVar("Classes\Class" & ClassID & ".ini", "CLASS", "y")

Call PlayerWarp(Index, MapNum, X, Y)
End If
End Sub

[b]' Executes whenever a scripted item is used or double clicked.
Sub ScriptedItem(Index, Script)
Select Case Script
Case 0
Call PlayerWarp(Index, 1,6,13)
Exit Sub
Case 1 ' Example
Call DropFurnature(Index, "bed")
Exit Sub
Case 2 ' Key
Call Usekey(Index)
Case 4
x = GETPLAYERX(INDEX)
y = GETPLAYERY(INDEX)
If GetAttribute(GetPlayerMap(Index), x, y) = 1 then
Call playermsg(index, "The scroll fizzles up.", 1)
Call TakeItem(Index, 26)
Exit Sub
Else
Call playerwarp(Index, 1, 6, 13)
Call TakeItem(Index, 29)
Call playermsg(index, "The scroll fizzles up as you drift into a different location.", 1)
Exit sub
End If
Case Else
Call PlayerMsg(Index, "No item script found. Please contact an admin to solve this problem.", WHITE)
Exit Sub
End Select
End Sub[/b]

Function GetFreeSlots(Index)   
Dim Slot
Dim Slots

Slot = 1
Slots = 0

Index = Int(Index)

Do While Slot < 25 
If GetPlayerInvItemNum(Index, Slot) = 0 Then
Slots = Slots + 1
End If

Slot = Slot + 1
Loop

GetFreeSlots = Slots
End Function

Sub GiveItem(Index, Number, Durability)
Dim Slot

Slot = 1

Index = Int(Index)
Number = Int(Number)
Durability = Int(Durability)

Do While Slot < 25
If GetPlayerInvItemNum(Index, Slot) = 0 Then
Call SetPlayerInvItemNum(Index, Slot, Number)
Call SetPlayerInvItemDur(Index, Slot, Durability)
Call SendInventoryUpdate(Index, Slot)
Exit Sub
End If

Slot = Slot + 1
Loop
End Sub

Sub GiveCurrency(Index, Number, Amount)
Dim Slot
Dim CurrentAmount

Slot = 1

Index = Int(Index)
Number = Int(Number)
Amount = Int(Amount)

Do While Slot < 25
If GetPlayerInvItemNum(Index, Slot) = Number Then
CurrentAmount = GetPlayerInvItemValue(Index, Slot)
Call SetPlayerInvItemValue(Index, Slot, CurrentAmount + Amount)
Call SendInventoryUpdate(Index, Slot)
Exit Sub
End If

Slot = Slot + 1
Loop

Slot = 1

Do While Slot < 25
If GetPlayerInvItemNum(Index, Slot) = 0 Then
Call SetPlayerInvItemNum(Index, Slot, Number)
Call SetPlayerInvItemValue(Index, Slot, Amount)
Call SendInventoryUpdate(Index, Slot)
Exit Sub
End If

Slot = Slot + 1
Loop
End Sub

Function CanTake(Index, Number, Amount)
Dim Slot

Slot = 1

Index = Int(Index)
Number = Int(Number)
Amount = Int(Amount)

Do While Slot < 25
If GetPlayerInvItemNum(Index, Slot) = Number Then
If GetPlayerInvItemValue(Index, Slot) >= Amount Then
CanTake = True
Exit Function
End If
End If

Slot = Slot + 1
Loop

CanTake = False
End Function

Sub TakeItem(Index, Number, Amount)
Dim Slot
Dim CurrentAmount

Index = Int(Index)
Number = Int(Number)
Amount = Int(Amount)

Slot = 1

Do While Slot < 25
If GetPlayerInvItemNum(Index, Slot) = Number Then
If GetPlayerInvItemValue(Index, Slot) >= Amount Then
CurrentAmount = GetPlayerInvItemValue(Index, Slot)

If CurrentAmount <= Amount Then
Call SetPlayerInvItemValue(Index, Slot, 0)
Call SetPlayerInvItemDur(Index, Slot, 0)
Call SendInventoryUpdate(Index, Slot)
Else
Call SetPlayerInvItemValue(Index, Slot, CurrentAmount - Amount)
Call SendInventoryUpdate(Index, Slot)
End If

End If
End If

Slot = Slot + 1
Loop
End Sub
```
Things I have problems with:
-Guild MOTD doesn't do ANYthing…
-I still have stuff from "housing", but I don't know what I can remove
-Mail System doesn't work
-Quest System doesn't work

Thanks for helping :)
~All good scripters here are from the Netherlands (Ilnair, Godlord etc., how can it be that I suck so badly?~

PS:
I can't find out how to make a swimming script for all classes :S
(ClassBlock -> Change Sprite -> Change Sprite = crap :p)
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...