Aller au contenu

Photo

A conditional that checks if there are any players in the area


  • Veuillez vous connecter pour répondre
2 réponses à ce sujet

#1
Grani

Grani
  • Members
  • 554 messages
I wanted some variables to reset when a player leaves the area but only if there are no other players still in that area. Is there any function that can check whether the area is empty or not?

Thanks. :)

#2
FunkySwerve

FunkySwerve
  • Members
  • 1 308 messages
There's a bunch of ways to skin that cat. This is probably the best, given considerations of speed, reliability, and simplicity.
int GetIsAreaEmpty(object oArea) {

    object oPC = GetFirstPC();
    while (GetIsObjectValid(oPC)) {
        if (GetArea(oPC) == oArea)
            return FALSE;
        oPC = GetNextPC();
    }
    return TRUE;
}

Funky

#3
Grani

Grani
  • Members
  • 554 messages
Great! Just what I needed! Thank you :D