What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

Sleep X Seconds if near player

Shacaw

New Member
Joined
Jun 27, 2014
Messages
25
Reaction score
0
Hello, im looking for a function that will do the following:

List of names = "John", "Paul", "Martin";
List of playersnear = get all player names near X radius;
foreach(playersnear p){
if (names.contains(p))
sleep(10000)
}

I dont know C# syntax but i think thats pretty much it.
Planning to add this to HaslaAssistant

Thank you btw
 
If you want to use that in the combat routine of my plugin, then something like that should work (remove the "core." before getCreatures() and dist() otherwise)

Code:
double scanRadius = 50; // max distance to check for players
List<string> dangerousPlayers = new List<string>() {"John", "Paul", "Martin"};
bool playerInRange = false;

do
{
    playerInRange = false;
    List<Creature> nearbyPlayers = core.getCreatures();
    foreach (Creature obj in nearbyPlayers)
    {
        if (obj.type == BotTypes.Player && core.dist(obj) <= scanRadius && dangerousPlayers.Contains(obj.name))
        {
            Thread.Sleep(10000);
            playerInRange = true;
            break;
        }
    }
} while (playerInRange);
 
Last edited:
Its working perfectly. Sometimes its spitting some weird exceptions like "The object oasdjnfoasdn/12312321t234/xconsdofkjn.rem was not found" but i think it's not related to haslaassistant.
Thank you.
 
Edited the code in previous post a bit, the getCreatures() should be inside the do-while loop then shouldn't give you exceptions anymore
 
Back
Top