Code: Show/Hide #define MAX_PILOT=300; struct pilot{ char name[20]; int kills; int deaths; }; pilot pilots[MAX_PILOT]; |
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++; } |
Code: Show/Hide #define DEATHS 0
get_tag(p,DEATHS); |