Code: Show/Hide void startMission(int mission,int name,String difficulty)
{ _listnode <Player> *parse = playerlist->head; while(parse) { if(get_tag(p,ACTIVE)==ON) { sendPrivate(p,"You have started a mission already."); } if(get_tag(p,BREAKTIME)!=0) { sendPrivate(p,"You need to take a break between missions, "+(String)get_tag(p,BREAKTIME)+" seconds left."); } else { int reward; if(difficulty=="easy")reward=5000; else if(difficulty=="med")reward=10000; else if(difficulty=="hard")reward=25000; else reward=50000; set_tag(p,_REWARD,reward); set_tag(p,mission,ON); set_tag(p,ACTIVE); sendPrivate("You have started "+difficulty+" mission "+(String)name+". Type !abort to abort this mission."); } } } |
Bob Dole.. Bob Dole... Bob Dole...... bob dole.... bob... dole.... wrote: |
I think your function has to be a member of the botInfo class. |
Code: Show/Hide void startMission(int mission,int name,String difficulty); |
Code: Show/Hide void botInfo::startMission(int mission,int name,String difficulty)
{ //... } |
Code: Show/Hide error C2065: 'p' : undeclared identifier |
Code: Show/Hide void botInfo::startMission(int mission,int name,String difficulty)
{ _listnode <Player> *parse = playerlist->head; while(parse) { if(get_tag(p,ACTIVE)==ON) { sendPrivate(p,"You have started a mission already."); } if(get_tag(p,BREAKTIME)!=0) { sendPrivate(p,"You need to take a break between missions, "+(String)get_tag(p,BREAKTIME)+" seconds left."); } else { int reward; if(difficulty=="easy")reward=5000; else if(difficulty=="med")reward=10000; else if(difficulty=="hard")reward=25000; else reward=50000; set_tag(p,_REWARD,reward); set_tag(p,mission,ON); set_tag(p,ACTIVE); set_tag(p,CURRENT_MISSION,mission); sendPrivate(p,"You have started "+difficulty+" mission "+(String)name+". Type !abort to abort this mission."); } } } |
hellzlaker wrote: | |
|
Code: Show/Hide void botInfo::startMission(int mission,int name,String difficulty)
{ _listnode <Player> *parse = playerlist->head; while(parse) { Player *p = parse->item; if(get_tag(p,ACTIVE)==ON) { sendPrivate(p,"You have started a mission already."); } if(get_tag(p,BREAKTIME)!=0) { sendPrivate(p,"You need to take a break between missions, "+(String)get_tag(p,BREAKTIME)+" seconds left."); } else { int reward; if(difficulty=="easy")reward=5000; else if(difficulty=="med") { reward=10000; difficulty="medium"; } else if(difficulty=="hard")reward=25000; else reward=50000; set_tag(p,_REWARD,reward); set_tag(p,mission,ON); set_tag(p,ACTIVE,ON); set_tag(p,CURRENT_MISSION,mission); set_tag(p,CURRENT_MISSION_NAME,name); sendPrivate(p,"You have started "+difficulty+" mission "+(String)name+". Type !abort to abort this mission."); } } parse = parse->next; } void botInfo::beatMission() { _listnode <Player> *parse = playerlist->head; while(parse) { Player *p = parse->item; set_tag(p,BREAKTIME,300); set_tag(p,ACTIVE,OFF); set_tag(p,get_tag(p,CURRENT_MISSION),OFF); String difficulty; if(get_tag(p,_REWARD)==5000)difficulty="easy"; else if(get_tag(p,_REWARD)==10000)difficulty="medium"; else if(get_tag(p,_REWARD)==25000)difficulty="hard"; else difficulty="expert"; sendPrivate(p,"*points "+get_tag(p,_REWARD)); sendPrivate(p,"You have defeated "+difficulty+" mission "+(String)get_tag(p,CURRENT_MISSION_NAME)+"."); } parse = parse->next; } |
Code: Show/Hide else if (c->check("easymission:1"))startMission(MISSION1,1,"easy"); |
Code: Show/Hide #define ON 0
#define OFF 1 #define ACTIVE 1 #define BREAKTIME 2 #define _REWARD 3 #define CURRENT_MISSION 4 #define CURRENT_MISSION_NAME 5 #define MISSION1 6 |
Code: Show/Hide sendPrivate(p,"*points "+get_tag(p,_REWARD)); |
Code: Show/Hide sendPrivate(p,"*points " + (String)get_tag(p,_REWARD)); |
Code: Show/Hide else if (c->check("easymission:1"))startMission(p, MISSION1,1,"easy");
|
Code: Show/Hide void botInfo::startMission(Player * p, int mission,int name,String difficulty) { //Put code to start the mission for player p } |
Code: Show/Hide if (<player is in mission> && <conditions for mission be beaten>) beatMission(k); //k being the Player * representing the killer in player_death |
Code: Show/Hide enum DifficultyLevel { DIFF_Easy, DIFF_Medium, DIFF_Hard, }; |
Code: Show/Hide enum DifficultyLevel { DIFF_Easy = 1, DIFF_Medium = 3, DIFF_Hard = 88, }; |
Code: Show/Hide DifficultyLevel diff1 = DIFF_Easy; DifficultyLevel diff2 = DIFF_Medium; int blah = diff1 + diff2; // that would be 1 (0 + 1) if (diff1 == DIFF_Easy) { //this is true } if (diff1 == 0) { //this is also true } |
Code: Show/Hide //30 would be the max length of the mission name const char mission_label[MISSION_COUNT][30] = { "some mission", "a cool mission", "kill people", "do stuff", "be awesome" }; |