Jump to content
  • 0

[SRC] View Level of Player ?!


HD Scripts

Question


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  183
  • Reputation:   15
  • Joined:  06/10/12
  • Last Seen:  

I have a problem with this code, show player level on the char...

I swear like this:

screenrathena000-296990.jpg

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 ----->

semttulokib.jpg

Edited by Hurican Dooders
Link to comment
Share on other sites

7 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  218
  • Reputation:   16
  • Joined:  01/24/12
  • Last Seen:  

You should ask clydelion, he's good with source modding. :)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  554
  • Reputation:   70
  • Joined:  04/04/12
  • Last Seen:  

BTW there is no 'char_data'....

:meow:

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  754
  • Reputation:   186
  • Joined:  05/22/12
  • Last Seen:  

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;

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  183
  • Reputation:   15
  • Joined:  06/10/12
  • Last Seen:  

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 :D

@edit

not working yet =/

no errors on map-server on compilation, but not works in game.

solution plz? *--* credits for you on this mod :D

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  554
  • Reputation:   70
  • Joined:  04/04/12
  • Last Seen:  

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 :meow:

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  46
  • Topics Per Day:  0.01
  • Content Count:  292
  • Reputation:   17
  • Joined:  12/12/11
  • Last Seen:  

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,

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  183
  • Reputation:   15
  • Joined:  06/10/12
  • Last Seen:  

both ways working 100%, thanks to malufett

and wakoko321

:D :D :D

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...