Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
Help me (again LoL)

 
Post new topic   Reply to topic Printable version
 View previous topic  Error parsing Post :: Post Death packets  View next topic  
Author Message
The Arctica
Newbie


Gender:Gender:Male
Joined: Dec 04 2004
Posts: 13
Offline

PostPosted: Sat Dec 04, 2004 1:14 pm    Post subject: Help me (again LoL) Reply to topic Reply with quote

Hey,

I have a struct, in the struct there are data of the player (name, kills, deaths). When a player dies i want to add ++death but, how do i know the slot of the player ?

Thanks alot anyways.

-The Arctica icon_cool.gif
Back to top
View users profile Send private message Add User to Ignore List
D1st0rt
Miss Directed Wannabe


Age:37
Gender:Gender:Male
Joined: Aug 31 2003
Posts: 2247
Location: Blacksburg, VA
Offline

PostPosted: Sat Dec 04, 2004 1:24 pm    Post subject: Reply to topic Reply with quote

Are you using merv? If you are, I would probably use tags as they are easier.

Whatever you end up using, Underlord's Tutorial tells you how to go about it
_________________

Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Bak
?ls -s
0 in


Age:26
Gender:Gender:Male
Joined: Jun 11 2004
Posts: 1826
Location: USA
Offline

PostPosted: Sat Dec 04, 2004 2:11 pm    Post subject: Reply to topic Reply with quote

structInstance->deaths++;

you get the right struct instance based on how you stored it... like in a linked list you would have to iterate through the list looking for when the right name.
Back to top
View users profile Send private message Add User to Ignore List AIM Address
CypherJF
I gargle nitroglycerin


Gender:Gender:Male
Joined: Aug 14 2003
Posts: 2582
Location: USA
Offline

PostPosted: Sat Dec 04, 2004 2:16 pm    Post subject: Reply to topic Reply with quote

Noting that if two players have the first same 19 characters; looping through comparing player names won't work correctly. icon_wink.gif
_________________
Performance is often the art of cheating carefully. - James Gosling
Back to top
View users profile Send private message Add User to Ignore List
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Sat Dec 04, 2004 6:44 pm    Post subject: Reply to topic Reply with quote

You could record it by ident. I did it once and it worked fine.
_________________
This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
k0zy (too lazy to login)
Guest


Offline

PostPosted: Sun Dec 05, 2004 3:39 am    Post subject: Reply to topic Reply with quote

I'd just tag the player...
Take a look at the tutorial D1st0rt posted.
I think it's explained there.

Bob Dole.. Bob Dole... Bob Dole...... bob dole.... bob... dole....
Back to top
Underlord
Novice


Gender:Gender:Male
Joined: Feb 17 2004
Posts: 55
Offline

PostPosted: Sun Dec 05, 2004 9:09 am    Post subject: Reply to topic Reply with quote

assuming a struct of type:

Code: Show/Hide

#define MAX_PILOT=300;

struct pilot{
   char name[20];
   int kills;
    int deaths;
};

pilot pilots[MAX_PILOT];



to find a pilot slot

Code: Show/Hide


int botInfo::GetPilot(Player *p)
{
      // assumes: any player searched for already exists in the struct, otherwise sends back MAX_PILOT as slot
      int pilot = 0;

      for (pilot=0; pilot < MAX_PILOT;  pilot++)  // cycle struct slots
           if (strcmp(p->name,pilots[pilot].name)==0)  // compare pilot name to struct slot name
               break;  // found pilot
     
       return pilot;
}

// to use in spawn.cpp

case EVENT_PlayerDeath:  {

   Player *p = (Player*)event.p[0];

   int slot = GetPilot(p);

    if (slot < MAX_PILOT)
         pilots[slot].deaths++;
}


hopefully u know how to insert and delete slots as they enter/leave arena, and initialize struct data before using

tutorial location: http://www.dzleagues.com/bots/MERVbot_tutorial.html

20 character name bug ('player entering' packet only sends 19 i think) only solved by tracking userids from *einfo. easier to just disallow 19+ character names (not count them, speclock, ban, etc)
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
CypherJF
I gargle nitroglycerin


Gender:Gender:Male
Joined: Aug 14 2003
Posts: 2582
Location: USA
Offline

PostPosted: Sun Dec 05, 2004 12:09 pm    Post subject: Reply to topic Reply with quote

Thats what I ended up doing; writing out code that would kick them out w/ a warning message. icon_wink.gif
Back to top
View users profile Send private message Add User to Ignore List
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Sun Dec 05, 2004 12:20 pm    Post subject: Reply to topic Reply with quote

Like ew, no, that's so inefficient. As long as you don't actually need to save the info after the player leaves, use the frickin' ident.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
D1st0rt
Miss Directed Wannabe


Age:37
Gender:Gender:Male
Joined: Aug 31 2003
Posts: 2247
Location: Blacksburg, VA
Offline

PostPosted: Sun Dec 05, 2004 1:39 pm    Post subject: Reply to topic Reply with quote

Wouldn't just a tag be more efficient? and easy?

you can like
Code: Show/Hide
#define DEATHS 0
get_tag(p,DEATHS);
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Bot Questions All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can 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
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 271 page(s) served in previous 5 minutes.

phpBB Created this page in 0.498650 seconds : 34 queries executed (93.8%): GZIP compression disabled