这篇教程C++ write_user函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中write_user函数的典型用法代码示例。如果您正苦于以下问题:C++ write_user函数的具体用法?C++ write_user怎么用?C++ write_user使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了write_user函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: reload_gun/* * well...Duh! Reload the gun */voidreload_gun(UR_OBJECT user){ RM_OBJECT rm; rm = get_room_full(amsys->default_shoot); if (!rm) { write_user(user, "There is nowhere that you can shoot./n"); return; } if (user->room != rm) { vwrite_user(user, "Do not be shooting in a public place. Go to the ~OL%s~RS to play./n", rm->name); return; } if (user->bullets > 0) { vwrite_user(user, "You have ~OL%d~RS bullets left./n", user->bullets); return; } vwrite_room_except(user->room, user, "~FY%s reloads their gun./n", user->bw_recap); write_user(user, "~FYYou reload your gun./n"); user->bullets = 6;}
开发者ID:BackupTheBerlios,项目名称:mamnuts,代码行数:28,
示例2: personal_room_rename/* * allows a user to rename their room */voidpersonal_room_rename(UR_OBJECT user, char *inpstr){ if (!amsys->personal_rooms) { write_user(user, "Personal room functions are currently disabled./n"); return; } if (word_count < 2) { write_user(user, "Usage: myname <name you want room to have>/n"); return; } if (strcmp(user->room->owner, user->name)) { write_user(user, "You have to be in your personal room to rename it./n"); return; } if (strlen(inpstr) > PERSONAL_ROOMNAME_LEN) { write_user(user, "You cannot have a room name that long./n"); return; } if (strlen(inpstr) - teslen(inpstr, 0) < 1) { write_user(user, "You must enter a room name./n"); return; } strcpy(user->room->show_name, inpstr); vwrite_user(user, "You have now renamed your room to: %s/n", user->room->show_name); if (!personal_room_store(user->name, 1, user->room)) { write_syslog(SYSLOG | ERRLOG, 1, "ERROR: Unable to save personal room status in personal_room_rename()/n"); }}
开发者ID:blindsight,项目名称:Amnuts,代码行数:34,
示例3: clear_topic/* * clears a room topic */voidclear_topic(UR_OBJECT user){ RM_OBJECT rm; const char *name; if (word_count < 2) { rm = user->room; *rm->topic = '/0'; write_user(user, "Topic has been cleared/n"); name = user->vis ? user->recap : invisname; vwrite_room_except(rm, user, "%s~RS ~FY~OLhas cleared the topic./n", name); return; } strtolower(word[1]); if (!strcmp(word[1], "all")) { if (user->level > (enum lvl_value) command_table[CTOPIC].level || user->level >= ARCH) { for (rm = room_first; rm; rm = rm->next) { *rm->topic = '/0'; write_room_except(rm, "/n~FY~OLThe topic has been cleared./n", user); } write_user(user, "All room topics have now been cleared/n"); return; } write_user(user, "You can only clear the topic of the room you are in./n"); return; } write_user(user, "Usage: ctopic [all]/n");}
开发者ID:blindsight,项目名称:Amnuts,代码行数:35,
示例4: personal_room_decorate/* * Enter a description for a personal room */voidpersonal_room_decorate(UR_OBJECT user, char *inpstr){ if (inpstr) { if (!amsys->personal_rooms) { write_user(user, "Personal room functions are currently disabled./n"); return; } if (strcmp(user->room->owner, user->name)) { write_user(user, "You have to be in your personal room to decorate it./n"); return; } if (word_count < 2) { write_user(user, "/n~BB*** Decorating your personal room ***/n/n"); user->misc_op = 19; editor(user, NULL); return; } strcat(inpstr, "/n"); } else { inpstr = user->malloc_start; } *user->room->desc = '/0'; strncat(user->room->desc, inpstr, ROOM_DESC_LEN); if (strlen(user->room->desc) < strlen(inpstr)) { vwrite_user(user, "The description is too long for the room /"%s/"./n", user->room->name); } write_user(user, "You have now redecorated your personal room./n"); if (!personal_room_store(user->name, 1, user->room)) { write_syslog(SYSLOG | ERRLOG, 1, "ERROR: Unable to save personal room status in personal_room_decorate()/n"); }}
开发者ID:blindsight,项目名称:Amnuts,代码行数:38,
示例5: suggestions_from/*** Show list of people suggestions are from without seeing the whole lot ***/void suggestions_from(UR_OBJECT user){ FILE *fp; int cnt; char id[ARR_SIZE],line[ARR_SIZE], *str; set_crash(); if (!amsys->suggestion_count) { write_user(user,"There are currently no suggestions./n"); return; } if (!(fp=fopen(SUGBOARD, "r"))) { write_user(user,"There was an error trying to read the suggestion board./n"); write_syslog(ERRLOG,1,"Unable to open suggestion board in suggestions_from()./n"); return; } write_user(user,"/n~BB*** Suggestions on the suggestions board from ***/n/n"); cnt=0; line[0]='/0'; fgets(line,ARR_SIZE-1,fp); while (!feof(fp)) { sscanf(line,"%s",id); str=colour_com_strip(id); if (!strcmp(str,"From:")) { cnt++; vwrite_user(user,"~FT%2d)~RS %s",cnt,remove_first(line)); } line[0]='/0'; fgets(line,ARR_SIZE-1,fp); } fclose(fp); vwrite_user(user,"/nTotal of ~OL%d~RS suggestions./n/n",amsys->suggestion_count);}
开发者ID:Lopo,项目名称:Lotos,代码行数:34,
示例6: uninvite/* * no longer invite a user to the room you are in if you invited them */voiduninvite(UR_OBJECT user){ UR_OBJECT u; const char *name; if (word_count < 2) { write_user(user, "Uninvite who?/n"); return; } u = get_user_name(user, word[1]); if (!u) { write_user(user, notloggedon); return; } if (u == user) { write_user(user, "You cannot uninvite yourself./n"); return; } if (!u->invite_room) { vwrite_user(user, "%s~RS has not been invited anywhere./n", u->recap); return; } if (strcmp(u->invite_by, user->name)) { vwrite_user(user, "%s~RS has not been invited anywhere by you!/n", u->recap); return; } vwrite_user(user, "You cancel your invitation to %s~RS./n", u->recap); name = user->vis || u->level >= user->level ? user->recap : invisname; vwrite_user(u, "%s~RS cancels your invitation./n", name); u->invite_room = NULL; *u->invite_by = '/0';}
开发者ID:blindsight,项目名称:Amnuts,代码行数:37,
示例7: write_room_except2void write_room_except2(RM_OBJECT rm, char *str, UR_OBJECT user, UR_OBJECT user2){ UR_OBJECT u; set_crash();for (u=user_first; u!=NULL; u=u->next) { if (u->login || u->room==NULL || (u->room!=rm && rm!=NULL) || (u->ignore.all && !force_listen) || (u->ignore.shouts && (com_num==SHOUT || com_num==SEMOTE || com_num==SHOUTTO)) || (u->ignore.logons && logon_flag) || (u->ignore.greets && com_num==GREET) || u==user || u==user2) continue; if ((check_igusers(u,user))!=-1 && user->level<ARCH) continue; if (u->type==CLONE_TYPE) { if (u->clone_hear==CLONE_HEAR_NOTHING || u->owner->ignore.all) continue; /* Ignore anything not in clones room, eg shouts, system messages and semotes since the clones owner will hear them anyway. */ if (rm!=u->room) continue; if (u->clone_hear==CLONE_HEAR_SWEARS) { if (!contains_swearing(str)) continue; } sprintf(text, "~FT[ %s ]:~RS %s",u->room->name,str); write_user(u->owner, text); } else write_user(u,str); } /* end for */}
开发者ID:Lopo,项目名称:Lotos,代码行数:30,
示例8: visibility/* * Set user visible or invisible */voidvisibility(UR_OBJECT user, int vis){ if (vis) { if (user->vis) { write_user(user, "You are already visible./n"); return; } write_user(user, "~FB~OLYou recite a melodic incantation and reappear./n"); vwrite_room_except(user->room, user, "~FB~OLYou hear a melodic incantation chanted and %s materialises!/n", user->bw_recap); user->vis = 1; return; } if (!user->vis) { write_user(user, "You are already invisible./n"); return; } write_user(user, "~FB~OLYou recite a melodic incantation and fade out./n"); vwrite_room_except(user->room, user, "~FB~OL%s recites a melodic incantation and disappears!/n", user->bw_recap); user->vis = 0;}
开发者ID:amnuts,项目名称:Amnuts,代码行数:29,
示例9: load_swear_file/*** Load swear words list from file ***/void load_swear_file(UR_OBJECT user){ FILE *fp; char line[WORD_LEN+1]; int i; set_crash(); for (i=0; i<MAX_SWEARS; i++) swear_words[i][0]='/0'; i=0; if (user==NULL) printf("Loading swear words file ... "); else write_user(user,">>>Loading swear words file ... "); if (!(fp=fopen(SWEARFILE, "r"))) { strcpy(swear_words[0],"*"); if (user==NULL) printf(" not found./n"); else write_user(user," not found./n"); return; } fgets(line,WORD_LEN+2,fp); while (!feof(fp)) { line[strlen(line)-1]='/0'; strcpy(swear_words[i],line); i++; if (i>=MAX_SWEARS) break; fgets(line,WORD_LEN+2,fp); } fclose(fp); strcpy(swear_words[i],"*"); if (user==NULL) printf(" done (%d words)./n",i); else vwrite_user(user," done ( ~FT%d~RS words )./n",i);}
开发者ID:Lopo,项目名称:Lotos,代码行数:32,
示例10: restore/* Restore a user to his original rank from a temp promote. S.C. 09/27/99 */void restore(UR_OBJECT user){UR_OBJECT u; set_crash();if (word_count<2) { write_usage(user,"restore <user>"); return; }if (!(u=get_user_name(user,word[1]))) { write_user(user, notloggedon); return; }if (u->level>u->real_level) { u->level=u->real_level; vwrite_user(user,"%s Ma odteraz svoj originalny level./n", u->name); vwrite_room_except(u->room,u,"%s begins fading as their power is restored to normal./n",u->name); vwrite_user(u,"Bol obnoveny tvoj originalny level./n"); write_syslog(SYSLOG, 1, "%s restored %s to their original level./n",user->name,u->name); sprintf(text,"Had their level restored by %s./n",user->name); add_history(u->name,1,text); return; }else { write_user(user,"You can't restore a person to their original rank if they're already there./n"); return; }}
开发者ID:Lopo,项目名称:Lotos,代码行数:29,
示例11: check_lynxvoid check_lynx(void){ UR_OBJECT user=user_first, next; pid_t pid; char fname[FNAME_LEN]; set_crash(); while (user) { next=user->next; if (user->lynx) { sprintf(fname, "%s/%s.lynx", TEMPFILES, user->name); pid=waitpid(user->lynx, (int *) NULL, WNOHANG); if (pid==user->lynx) { user->lynx=0; write_user(user, "~CTpozadovana www stranka:/n"); switch (more(user, user->socket, fname)) { case 0: write_user(user, "nemozem najst nacitanu stranku"); break; case 1: user->misc_op=2; break; } } else if (pid==-1) { write_user(user, "chyba pri nacitavani dokumentu/n"); } } user=next; }}
开发者ID:Lopo,项目名称:Lotos,代码行数:27,
示例12: personal_room_rename/* allows a user to rename their room */void personal_room_rename(UR_OBJECT user,char *inpstr) { char name[ROOM_NAME_LEN+1]; RM_OBJECT rm; if (!amsys->personal_rooms) { write_user(user,"Personal room functions are currently disabled./n"); return; } if (word_count<2) { write_usage(user, "%s <nazov>/n", command_table[MYNAME].name); return; } sprintf(name,"(%s)",user->name); strtolower(name); /* get room that user is in */ if ((rm=get_room_full(name))==NULL) { write_user(user,"Sorry, but you cannot use the room renaming feature at this time./n"); return; } if (user->room!=rm) { write_user(user,"You have to be in your personal room to rename it./n"); return; } if (strlen(inpstr)>PERSONAL_ROOMNAME_LEN) { write_user(user,"You cannot have a room name that long./n"); return; } strcpy(rm->real_name,inpstr); vwrite_user(user,"You have now renamed your room to: %s/n",rm->real_name); if (!personal_room_store(user->name,1,rm)) write_syslog(SYSLOG,1,"ERROR: Unable to save personal room status in personal_room_rename()/n");}
开发者ID:Lopo,项目名称:Lotos,代码行数:33,
示例13: go/* * Move to another room */voidgo(UR_OBJECT user){ RM_OBJECT rm; int i; if (user->lroom == 2) { write_user(user, "You have been shackled and cannot move./n"); return; } if (word_count < 2) { rm = get_room_full(amsys->default_warp); if (!rm) { write_user(user, "You cannot warp to the main room at this time./n"); return; } if (user->room == rm) { vwrite_user(user, "You are already in the %s!/n", rm->name); return; } move_user(user, rm, 1); return; }#ifdef NETLINKS release_nl(user); if (transfer_nl(user)) { return; }#endif rm = get_room(word[1]); if (!rm) { write_user(user, nosuchroom); return; } if (rm == user->room) { vwrite_user(user, "You are already in the %s!/n", rm->name); return; } /* See if link from current room */ for (i = 0; i < MAX_LINKS; ++i) { if (user->room->link[i] == rm) { break; } } if (i < MAX_LINKS) { move_user(user, rm, 0); return; } if (is_personal_room(rm)) { write_user(user, "To go to another user's home you must /".visit/" them./n"); return; } if (user->level < WIZ) { vwrite_user(user, "The %s is not adjoined to here./n", rm->name); return; } move_user(user, rm, 1);}
开发者ID:blindsight,项目名称:Amnuts,代码行数:62,
示例14: unmuzzle/* * Unmuzzle the bastard now he has apologised and grovelled enough via email */voidunmuzzle(UR_OBJECT user){ UR_OBJECT u; int on; if (word_count < 2) { write_user(user, "Usage: unmuzzle <user>/n"); return; } u = retrieve_user(user, word[1]); if (!u) { return; } on = retrieve_user_type == 1; /* error checks */ if (u == user) { write_user(user, "Trying to unmuzzle yourself is the tenth sign of madness./n"); done_retrieve(u); return; } /* FIXME: Use sentinel other JAILED */ if (u->muzzled == JAILED) { vwrite_user(user, "%s~RS is not muzzled./n", u->recap); done_retrieve(u); return; } if (u->muzzled > user->level) { vwrite_user(user, "%s~RS's muzzle is set to level %s, you do not have the power to remove it./n", u->recap, user_level[u->muzzled].name); done_retrieve(u); return; } /* do the unmuzzle */ u->muzzled = JAILED; /* FIXME: Use sentinel other JAILED */ vwrite_user(user, "~FG~OLYou remove %s~RS's muzzle./n", u->recap); write_syslog(SYSLOG, 1, "%s unmuzzled %s./n", user->name, u->name); add_history(u->name, 0, "~FGUnmuzzled~RS by %s, level %d (%s)./n", user->name, user->level, user_level[user->level].name); sprintf(text, "~FG~OLYou have been unmuzzled!/n"); if (!on) { send_mail(user, u->name, text, 0); } else { write_user(u, text); } /* finish up */ if (!on) { strcpy(u->site, u->last_site); u->socket = -2; } save_user_details(u, on); done_retrieve(u);}
开发者ID:amnuts,项目名称:Amnuts,代码行数:58,
示例15: send_icqpagevoid send_icqpage(UR_OBJECT user, char *inpstr){ char fname[FNAME_LEN], icqnum[ICQ_LEN+1], subj[100], addr[100]; int on; UR_OBJECT ur; FILE *fp; if (word_count<3) { write_usage(user, "%s <user>/<ICQ#> <text>", command_table[ICQPAGE].name); return; } icqnum[0]='/0'; if (is_number(word[1])) strncpy(icqnum, word[1], ICQ_LEN); else { if (!(ur=get_user_name(user, word[1]))) { if (!(ur=create_user())) { vwrite_user(user, "%s: nemozem vytvorit docasny user objekt./n", syserror); write_syslog(ERRLOG, 1, "Unable to create temp user object in send_icqpage()/n"); return; } strcpy(ur->name, word[1]); if (!load_user_details(ur)) { write_user(user, nosuchuser); destruct_user(ur); destructed=0; return; } on=0; } else on=1; strcpy(icqnum, ur->icq); if (!on) { destruct_user(ur); destructed=0; } } if (icqnum[0]=='/0') { write_user(user, "sprava neposlana, chybne alebo nezistitelne ICQ cislo/n"); return; } sprintf(fname, "%s/%s.icq", TEMPFILES, user->name); if (!(fp=fopen(fname, "w"))) { write_user(user, "nemozem vytvorit docasny subor pre spravu/n"); write_syslog(ERRLOG, 1, "unable to open file in send_icqpage()/n"); return; } fprintf(fp, icq_page_email); fprintf(fp, "%s/n", remove_first(inpstr)); fclose(fp); sprintf(addr, "%[email C++ write_zsreg函数代码示例 C++ write_unlock_irqrestore函数代码示例
|