Inside3D!
     

"You've got the lead"
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
redrum



Joined: 28 Mar 2007
Posts: 367
Location: Long Island, New York

PostPosted: Mon Nov 19, 2007 1:35 am    Post subject: Reply with quote

Thanks guys, I'll give it a shot! Smile
_________________
Welcome to the Overlook Hotel 69.113.123.178:27500
Back to top
View user's profile Send private message Send e-mail
daemon



Joined: 07 Nov 2007
Posts: 62

PostPosted: Mon Nov 19, 2007 3:53 am    Post subject: Reply with quote

This is what I had in mind, but you can use whatever works for you:

Code:
void(entity ent, float amount)Frag =
{
   local entity oldleader;
   local float tie;
   oldleader = leader;
   ent.frags = ent.frags + amount;

   if(!deathmatch)
      return;

   head = nextent(world);
   while(head)
   {
      if(head.flags & FL_CLIENT)
      {
         if(head.frags == leader.frags)
            tie = TRUE;
         else
         if(head.frags > leader.frags)
         {
            leader = head;
            tie = FALSE;
         }
      }
      head = nextent(head);       
   }

   if(tie)
   {
      head = nextent(world);
      while(head)
      {
         if(head.flags & FL_CLIENT && head.frags == leader.frags)
            sprint(head, "You're tied for the lead.\n");
         head = nextent(head);
      }
   }
   else
   if(leader != oldleader)
   {
      sprint(leader, "You've got the lead.\n");
      if(oldleader.flags & FL_CLIENT)
         sprint(oldleader, "You've lost the lead.\n");
   }
};

_________________
-daemon [ daemonforge.org ]
Back to top
View user's profile Send private message Visit poster's website
redrum



Joined: 28 Mar 2007
Posts: 367
Location: Long Island, New York

PostPosted: Mon Nov 19, 2007 7:07 am    Post subject: Reply with quote

Thanks for your help Daemon. It helped me learn!
Thats what I need. I still didn't grasp the whole thing though but thats ok. I got it working fairly well. I'll implement your code and let you know how it goes. I'm leaving for vacation in the morning, so it'll be awhile until I can test it.
Thanks again Very Happy
_________________
Welcome to the Overlook Hotel 69.113.123.178:27500
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming All times are GMT
Goto page Previous  1, 2, 3
Page 3 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group