Wrote these a while back for a different script. Hope someone finds them useful

Copy into your main (bottom works fine):
'GiveSpell/TakeSpell subs
'Written by PICKLE :O
'**************************
Sub GiveSpell(index, spell)
'**************************
Dim slot
slot = 1
Do while slot <= 20
If GetPlayerSpell(index, Int(slot)) < 1 Then
Call SetPlayerSpell(index, Int(slot), spell)
Exit Sub
End If
slot = slot + 1
Loop
End Sub
'**************************
Sub TakeSpell(index, spell)
'**************************
Dim slot
slot = 1
Do while slot <= 20
If GetPlayerSpell(index, Int(slot)) < 1 Then
Call SetPlayerSpell(index, Int(slot), 0)
Exit Sub
End If
slot = slot + 1
Loop
End Sub
'***********************
Sub ClearSpells(index)
'***********************
Dim slot
slot = 1
Do while slot <= 20
Call SetPlayerSpell(index, Int(slot), 0)
slot = slot + 1
Loop
Call PlayerMsg(index, "Spells cleared.", 14)
End SubUsage:
Call GiveSpell(index, spell)
Sets a player's spell slot to the spell number you specify
Call TakeSpell(index, spell)
Removes one of the spells you specify from the player's spell list
Call ClearSpells(index)
Completely clears the spell list
Note: TakeSpell isn't tested so if someone could tell me if that works that'd be great.