Just before the player lefts


I wanna call a sub that I did (Sub Informations) just before the player lefts the game. (the sub will warp the player, and change his sprite)

I tried to call the sub from Sub LeftGame, but it didn’t worked 😕

Can someone help me please ?

Thank you :)

is it server side?

Yes. ^^

can you paste the sub and the place you put the call at?(pm if you don’t want anyone knowing the code)

Yeah sure, it’s just a Warp & Change player sprite, nothing special x)

Sub Informations(ByVal Index As Long)

Call PlayerWarp(Index, 4, 2, 8)

Call SetPlayerSprite(Index, 218)

Call SendPlayerData(Index)

End Sub

I’ve putted this Sub at the bottom of ModPlayer.

And this is my Sub LeftGame

Sub LeftGame(ByVal Index As Long)

Dim n As Long, i As Long

Dim tradeTarget As Long

If TempPlayer(Index).InGame Then

TempPlayer(Index).InGame = False

’ Check if player was the only player on the map and stop npc processing if so

If GetTotalMapPlayers(GetPlayerMap(Index)) < 1 Then

PlayersOnMap(GetPlayerMap(Index)) = NO

End If

’ cancel any trade they’re in

If TempPlayer(Index).InTrade > 0 Then

tradeTarget = TempPlayer(Index).InTrade

PlayerMsg tradeTarget, Trim$(GetPlayerName(Index)) & " has declined the trade.", BrightRed

’ clear out trade

For i = 1 To MAX_INV

TempPlayer(tradeTarget).TradeOffer(i).Num = 0

TempPlayer(tradeTarget).TradeOffer(i).Value = 0


TempPlayer(tradeTarget).InTrade = 0

SendCloseTrade tradeTarget

End If


Call Informations(Index)

’ leave party.

Party_PlayerLeave Index

If Player(Index).GuildFileId > 0 Then

'Set player online flag off

GuildData(TempPlayer(Index).tmpGuildSlot).Guild_Members(Player(Index).GuildMemberId).Online = False

Call CheckUnloadGuild(TempPlayer(Index).tmpGuildSlot)

End If

’ save and clear data.

Call SavePlayer(Index)

Call SaveBank(Index)

Call ClearBank(Index)

’ Send a global message that he/she left

If GetPlayerAccess(Index) <= ADMIN_MONITOR Then

Call GlobalMsg(GetPlayerName(Index) & " has left " & Options.Game_Name & “!”, JoinLeftColor)


Call GlobalMsg(GetPlayerName(Index) & " has left " & Options.Game_Name & “!”, White)

End If

Call TextAdd(GetPlayerName(Index) & " has disconnected from " & Options.Game_Name & “.”, ChatPlayer)

Call SendLeftGame(Index)

TotalPlayersOnline = TotalPlayersOnline - 1

End If

Call ClearPlayer(Index)

End Sub

ok well, the warp player only works if the player is actually online. the player sprite should work fine, and the SendPlayerData doesn’t need to be there, the SavePlayer(Index) in the main sub saves all of that into the playerRec so if the player is offline, there’s no point in sending offline data to online players ;)

The reason playerwarp won’t work is because of this near the top of Sub PlayerWarp:

If isPlaying(index) = False Or mapnum <= 0 Or mapnum > MAX_MAPS Then

     Exit Sub

End If

That’s okay though. PlayerWarp is a really simple sub - it just meshes three commands into one with some error checks. Instead of using CallPlayerWarp(Index, 4, 2, 8), use this:

Call SetPlayerMap(Index, 4)

Call SetPlayerX(Index, 2)

Call SetPlayerY(Index, 8)

If this has been solved, make sure to mark your topic as solved :P

Log in to reply