HD Scripts Posted August 16, 2012 Posted August 16, 2012 (edited) I have a problem with this code, show player level on the char... I swear like this: Code is here: case BL_CHAR: { struct char_data *md = (struct char_data *)bl; nullpo_retv(md); char charhp[25], *str_p = charhp; WBUFW(buf, 0) = cmd = 0x195; if( battle_config.show_char_info&1 ){ str_p += sprintf(str_p, "Lv. %d | ", md->level); } if( str_p != charhp ) { *(str_p-3) = '\0'; memcpy(WBUFP(buf,30), charhp, NAME_LENGTH); WBUFB(buf,54) = 0; memcpy(WBUFP(buf,78), charhp, NAME_LENGTH); } } break; wrong code? help plz? '----' @edit Error in the Visual Studio C++ 2010 -----> Edited August 16, 2012 by Hurican Dooders Quote
Nipsino Posted August 16, 2012 Posted August 16, 2012 You should ask clydelion, he's good with source modding. Quote
clydelion Posted August 16, 2012 Posted August 16, 2012 I don't know where you got this, but if you want to make it rathena compatible.. then it should probably look like this.. case BL_CHAR: { struct map_session_data *sd = BL_CAST(BL_PC, bl); nullpo_retv(sd); char charhp[25], *str_p = charhp; WBUFW(buf, 0) = cmd = 0x195; if( battle_config.show_char_info&1 ){ str_p += sprintf(str_p, "Lv. %d | ", sd->status.base_level); } if( str_p != charhp ) { *(str_p-3) = '\0'; memcpy(WBUFP(buf,30), charhp, NAME_LENGTH); WBUFB(buf,54) = 0; memcpy(WBUFP(buf,78), charhp, NAME_LENGTH); } } break; Quote
HD Scripts Posted August 16, 2012 Author Posted August 16, 2012 As I got? I used the base of BL_MOB, and I was just trying to adapt ... but I will try this for user testing ... Thank you @edit not working yet =/ no errors on map-server on compilation, but not works in game. solution plz? *--* credits for you on this mod Quote
malufett Posted August 17, 2012 Posted August 17, 2012 try this @clif.c case BL_PC: { struct map_session_data *ssd = (struct map_session_data *)bl; struct party_data *p = NULL; struct guild *g = NULL; +char name[NAME_LENGTH]; //Requesting your own "shadow" name. [skotlex] if (ssd->fd == fd && ssd->disguise) WBUFL(buf,2) = -bl->id; if( ssd->fakename[0] ) { WBUFW(buf, 0) = cmd = 0x195; memcpy(WBUFP(buf,6), ssd->fakename, NAME_LENGTH); WBUFB(buf,30) = WBUFB(buf,54) = WBUFB(buf,78) = 0; break; } +sprintf(name, "[%d/%d] %s", ssd->status.base_level, pc_maxbaselv(ssd),ssd->status.name); +memcpy(WBUFP(buf,6), name, NAME_LENGTH); -memcpy(WBUFP(buf,6), ssd->status.name, NAME_LENGTH); NOTE:I didn't test it yet Quote
Elijah23 Posted August 17, 2012 Posted August 17, 2012 Hmm.. I think there's no such thing as BL_CHAR... So you need to put the code under BL_PC.. case BL_PC: { struct map_session_data *ssd = (struct map_session_data *)bl; struct party_data *p = NULL; struct guild *g = NULL; char charhp[50], *str_p = charhp; str_p += sprintf(str_p, "[%u/%u] %s\n", ssd->status.base_level,ssd->status.job_level,ssd->status.name); //Requesting your own "shadow" name. [skotlex] if (ssd->fd == fd && ssd->disguise) WBUFL(buf,2) = -bl->id; if( ssd->fakename[0] ) { WBUFW(buf, 0) = cmd = 0x195; memcpy(WBUFP(buf,6), ssd->fakename, NAME_LENGTH); WBUFB(buf,30) = WBUFB(buf,54) = WBUFB(buf,78) = 0; break; } if( str_p != charhp ) { if( battle_config.show_char_info&1 ){ memcpy(WBUFP(buf,6), charhp,NAME_LENGTH); } else { memcpy(WBUFP(buf,6), ssd->status.name, NAME_LENGTH); } } if( ssd->status.party_id ) { p = party_search(ssd->status.party_id); } if( ssd->status.guild_id ) { if( ( g = guild_search(ssd->status.guild_id) ) != NULL ) { ARR_FIND(0, g->max_member, i, g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id); if( i < g->max_member ) ps = g->member[i].position; } } if( !battle_config.display_party_name && g == NULL ) {// do not display party unless the player is also in a guild p = NULL; } if (p == NULL && g == NULL) break; WBUFW(buf, 0) = cmd = 0x195; if (p) memcpy(WBUFP(buf,30), p->party.name, NAME_LENGTH); else WBUFB(buf,30) = 0; if (g && ps >= 0 && ps < MAX_GUILDPOSITION) { memcpy(WBUFP(buf,54), g->name,NAME_LENGTH); memcpy(WBUFP(buf,78), g->position[ps].name, NAME_LENGTH); } else { //Assume no guild. WBUFB(buf,54) = 0; WBUFB(buf,78) = 0; } } break; try changing your BL_PC with the above code.. The problem I have encountered with this are for names that are very long... You need @refresh and then the level will show then the name will be cut, Quote
HD Scripts Posted August 17, 2012 Author Posted August 17, 2012 both ways working 100%, thanks to malufett and wakoko321 :D Quote
Question
HD Scripts
I have a problem with this code, show player level on the char...
I swear like this:
Code is here:
wrong code?
help plz? '----'
@edit
Error in the Visual Studio C++ 2010 ----->

Edited by Hurican Dooders7 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.