Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Guild Wars > GW Bots
You last visited: Today at 12:30

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Function That Detects Players In District

Discussion on Function That Detects Players In District within the GW Bots forum part of the Guild Wars category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Feb 2024
Posts: 19
Received Thanks: 3
Function That Detects Players In District

To anyone interested, I wrote this function which detects the presence of other players in the district. You can use it to stop the bot from continuing while other players are in the district.

Code:
; ; Checks if there are other players present in the vicinity of the player and logs their names.
Func AreOtherPlayersPresent()
    Local $myLoginNumber = DllStructGetData(GetAgentByID(-2), 'LoginNumber') ; Your character's login number
    Local $playerNames = "" ; Initialize an empty string to store player names
    Local $playerFound = False ; Flag to indicate if any player was found

    For $i = 1 To GetMaxAgents() ; Iterates through all possible agent IDs
        Local $agent = GetAgentByID($i)
        If IsDllStruct($agent) Then ; Checks if $agent is a valid structure
            Local $loginNumber = DllStructGetData($agent, 'LoginNumber')
            If $loginNumber <> 0 And $loginNumber <> $myLoginNumber Then ; Checks if the agent is a player and not you
                Local $playerName = GetPlayerName($agent)
                ; Adjust the regex to allow spaces in player names.
                If $playerName <> "" And StringRegExp($playerName, "^[a-zA-Z0-9 ]+$") Then ; Checks if the name is valid
                    $playerFound = True
                    $playerNames &= $playerName & [MENTION=3576271]CRLF[/MENTION] ; Append the player name to the list
                EndIf
            EndIf
        EndIf
    Next

    If $playerFound Then
        Logger("Players detected in the district: " & $playerNames) ; Log all detected player names
        Return True ; Returns true as players were found
    Else
        Logger("No Other Players Found") ; Log when no players are found
        Return False ; Returns false as no players were found
    EndIf
EndFunc
Example usage (put this in your main loop):

Code:
    ; Wait until the district is empty of other players.
    While AreOtherPlayersPresent()
        Logger("Other players detected. Waiting 5s")
        Sleep(10000) ; Wait for 10 seconds before checking again.
    WEnd
albino albatross is offline  
Thanks
2 Users
Old 05/01/2024, 12:54   #2
 
elite*gold: 0
Join Date: Feb 2024
Posts: 66
Received Thanks: 13
Hello! Thanks for the contri.

How did you start? Im good at changing stuff but not from 0. Like there's so much and I don't think is hard at all somehow feel like I have to hit the right spot with the info I look for as I eventually want to write my own.
ATbs is offline  
Old 05/04/2024, 02:21   #3
 
elite*gold: 0
Join Date: Feb 2024
Posts: 19
Received Thanks: 3
Well I started by going through the gwa2 library to check out what kinds of functions and other things were available to use. Then I modified a bunch of pre-existing scripts to include utilities I desired. At one point I decided it would be useful to be able to detect players in the district, this seemed like a decent solution. I've noticed every once in a while it'll detect someone when there's nobody there, but it happens very rarely, and I'm still not sure of the cause.
albino albatross is offline  
Old 05/04/2024, 05:59   #4
 
elite*gold: 0
Join Date: Feb 2024
Posts: 66
Received Thanks: 13
Fair enough, thanks!
And to change districts? If players are there
ATbs is offline  
Old 05/22/2024, 19:07   #5
 
Scythe X's Avatar
 
elite*gold: 0
Join Date: Aug 2023
Posts: 80
Received Thanks: 62
I am utilizing this in my Vaettir bot, and i just wanted to post a verbal thank you. I placed Credits for you in my readme file. I will be using this for my current map-running bot project. If you want this removed at any time just let me know please. Thank you again!
Scythe X is offline  
Old 05/25/2024, 04:53   #6
 
elite*gold: 0
Join Date: Feb 2024
Posts: 19
Received Thanks: 3
Thank you Scythe X for the kind words. Please go ahead and use it, that's why I posted it!

At ATbs, for changing districts and the like, you'll have to add that functionality yourself for now. Personally, I make my script run outside and wait if it detects someone in the district.
albino albatross is offline  
Old 06/01/2024, 03:29   #7
 
elite*gold: 0
Join Date: Feb 2024
Posts: 66
Received Thanks: 13
Yup, made it work with everything i wanted!
ATbs is offline  
Reply


Similar Threads Similar Threads
[Trading] hm6 Blade Dancer 516ap + 495ap summonner Hao District to 530+ ap FM/assa Hao District
05/29/2016 - Blade & Soul Trading - 0 Replies
Hy! Want to trade my lvl50 hm6 70% Blade Dancer on Hao District. Interested in every char on Hao District! 516 ap, 4200 crit, 63 000 hp, 112% acc eq: true pirate lynblade (4slot : 25ap ,360ad, 170 life drain, 3sec immune+120 crit), awakened oathbreaker bracelet, True Siren neck/earring/ring, moonwater soul 15ap, 410 gold, 10 naryu tablet, 900 achievement + Want to trade my other account, lvl50 hm5 summoner on server Dokumo. 495ap, True pirate staff, true siren accs, moonwater soul....
std::function of a function returning an std::function
11/11/2013 - C/C++ - 19 Replies
Nun muss ich nach langer Zeit auch mal wieder einen Thread erstellen, weil mir Google nicht mehr weiterhelfen kann. Ich verzweifle an Folgendem Vorhaben: #include <Windows.h> #include <string> #include <iostream> using namespace std;
Running Function 2 after Function 1 finished
09/15/2013 - AutoIt - 3 Replies
Hey, its me again. Im stuck on a problem since yesterday and as much as i hate to ask for help, i really dont know what else to try. I want Function 2 to run after Function 1 has finished. I tried GuiCtrlSetOnEvent and MsgLoop, but i dont really understand it. I tried to read tutorials but they didnt help at all. The line that are underline is what im talking about. I want gamestart() to run first and when its finished, i want iniviteteam() to run. #AutoIt3Wrapper_UseX64=n...
[VIP-function] ToxicSYS [VIP-function]
08/14/2010 - WarRock Hacks, Bots, Cheats & Exploits - 1 Replies
heeeey E-pvpers :pimp: this is a new hack by TSYS Status : UNDETECTED Functions (VIDEO) : YouTube - WarRock - Bikini event VIP hack
Forceshock Detects !
07/21/2005 - World of Warcraft - 15 Replies
Guten Tach ! Wie ich erfahren habe, wurden letzte Woche 120 Leute gebanned die Forceshock benutzt haben. Daher wollte ich euch warnen vorsichtiger mit Forceshock umzugehen. Ein paar Leute davon kannte ich recht gut davon und die hatten ihre Mail von blizzard gleich erhalten nachdem sie aus dem Spiel geflogen sind. Nun es wurden 120 Leute gebanned und bei diesen 3 Leuten die ich gut kannte war nur Forceshock im Spiel, sprich die schlechte Nachricht ist, dass Forceshock jezt wohl...



All times are GMT +1. The time now is 12:31.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.