Print Page | Close Window

AFK mode (player is unattackable)

Printed From: Mirage Source
Category: Tutorials
Forum Name: Temporary Archive (Read Only)
Forum Discription: Temporary 3.0.3 archive tutorials, will be deleted when converted.
URL: http://ms.shannaracorp.com/backup-forums/forum_posts.asp?TID=223
Printed Date: 20 December 2006 at 5:53pm
Software Version: Web Wiz Forums 8.01 - http://www.webwizforums.com


Topic: AFK mode (player is unattackable)
Posted By: Sync
Subject: AFK mode (player is unattackable)
Date Posted: 11 February 2006 at 3:39pm
AFK Tutorial (attack prevention)
Fixed Up version 1.1
by acfrazier2 and the Mirage Source Forums Members (fixes)
[humor]Thanks to notepad for allowing me to type this up.[/humor]

Well I'm reposting this with fixes from other players.

Alright, here goes.

:::::::::::::::::
:::Client Side:::
:::::::::::::::::

Find ' Help
Add Underneath

' AFK
If LCase(Mid(MyText, 1, 4)) = "/afk" Then
Call SendData("AFK" & SEP_CHAR & END_CHAR)
MyText = ""
End If

:::::::::::::::::
:::Server Side:::
:::::::::::::::::
Open Server
Find ' None saved local vars
Add Above AttackTimer As Long

AFK As Byte


Find Sub HandleData
Add Somewhere:

':::::::
'::AFK::
':::::::
If LCase(Parse(0)) = "AFK" Then
If Player(Index).AFK = 0 then
Player(Index).AFK = 1
Call PlayerMsg(GetPlayerName(Index) & " has gone AFK.", White)
Else
Player(Index).AFK = 0
Call PlayerMsg(GetPlayerName(Index) & " has returned from AFK.", White)
End If
' Prevent them from going AFK if they are a PKer or being attacked
If Player(Index).PK = 1 Then
Player(Index).AFK = 0
Call PlayerMsg(Index, "Sorry, you can't go AFK because you are a PKer.", BrightRed)
Call PlayerMsg(GetPlayerName(Index) & " can't go away because they are a PKer.", White)
End If
If Player(Index).Attacked = True Then
Player(Index).AFK = 0
Call PlayerMsg(Index, "Sorry, you can't go AFK because you are being attacked.", BrightRed)
Call PlayerMsg(GetPlayerName(Index) & " can't go away because they are being attacked.", White)
End If
Exit Sub
End If


Find Player attack packet

Add under: If I <> index but above: ' Can we attack the player?

If Player(i).AFK = 1 Then
Call PlayerMsg(Index, GetPlayerName(i) & " is AFK and is immune to attacks.", BrightRed)
End If



Find Sub PlayerMove
Under the ' Check for subscript out of range section add:

If Player(Index).AFK = 1 Then
Exit Sub
End If

This concludes the fixed up tut.
Post with your fixes and they will be added.



Print Page | Close Window

Bulletin Board Software by Web Wiz Forums version 8.01 - http://www.webwizforums.com
Copyright ©2001-2006 Web Wiz Guide - http://www.webwizguide.info