Jump to content
  • 0

Karma & Fame


cahadeyelo

Question


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  170
  • Reputation:   1
  • Joined:  11/13/14
  • Last Seen:  

i got this src codes for Karma & Fame but when i rebuild the server, some error appears

/*==========================================
 * display karma and fame stats info of player [boks]
 *------------------------------------------*/

ACMD_FUNC(charstats)
{
    char output[CHAT_SIZE_MAX];
    int i;
    struct map_session_data *pl_sd=NULL;
	nullpo_retr(-1, sd);

    if (!message || !*message) {
        clif_displaymessage(sd->fd,"You must enter a name.");
        return 0;
    }

    if((pl_sd=map_nick2sd((char *)message)) == NULL && (pl_sd=map_charid2sd(atoi(message))) == NULL) {
        clif_displaymessage(fd, msg_txt(sd,3)); // Character Not Found.
        return 0;
    }

    for (i = 0; i < 2; i++) {
        if(i == 0) sprintf(output, "Name: %s | Lvl: %d/%d | Job: %s", pl_sd->status.name, pl_sd->status.base_level, pl_sd->status.job_level, job_name(pl_sd->status.class_));
        if(i == 1) {
			if(pc_readglobalreg(pl_sd,"REBORNPOINTS")) sprintf(output, "[ Karma: %d Fame: %d Reborn: %d ]", pc_readglobalreg(pl_sd,"KARMAPOINTS"), pc_readglobalreg(pl_sd,"FAMEPOINTS"), pc_readglobalreg(pl_sd,"REBORNPOINTS"));
			else sprintf(output, "[ Karma: %d Fame: %d Reborn: None ]", pc_readglobalreg(pl_sd,"KARMAPOINTS"), pc_readglobalreg(pl_sd,"FAMEPOINTS"));
		}
		clif_displaymessage(fd, output);
    }
	clif_displaymessage(fd, msg_txt(sd,29)); // 1 Player Found.

    return 0;
}

and this are the errors

1>..\src\map\atcommand.c(8554): warning C4047: 'function' : 'int64' differs in levels of indirection from 'char [13]'
1>..\src\map\atcommand.c(8554): warning C4024: 'pc_readregistry' : different types for formal and actual parameter 2
1>..\src\map\atcommand.c(8554): warning C4047: 'function' : 'int64' differs in levels of indirection from 'char [12]'
1>..\src\map\atcommand.c(8554): warning C4024: 'pc_readregistry' : different types for formal and actual parameter 2
1>..\src\map\atcommand.c(8554): warning C4047: 'function' : 'int64' differs in levels of indirection from 'char [11]'
1>..\src\map\atcommand.c(8554): warning C4024: 'pc_readregistry' : different types for formal and actual parameter 2
1>..\src\map\atcommand.c(8554): warning C4047: 'function' : 'int64' differs in levels of indirection from 'char [13]'
1>..\src\map\atcommand.c(8554): warning C4024: 'pc_readregistry' : different types for formal and actual parameter 2
1>..\src\map\atcommand.c(8555): warning C4047: 'function' : 'int64' differs in levels of indirection from 'char [12]'
1>..\src\map\atcommand.c(8555): warning C4024: 'pc_readregistry' : different types for formal and actual parameter 2
1>..\src\map\atcommand.c(8555): warning C4047: 'function' : 'int64' differs in levels of indirection from 'char [11]'
1>..\src\map\atcommand.c(8555): warning C4024: 'pc_readregistry' : different types for formal and actual parameter 2
Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  153
  • Reputation:   8
  • Joined:  07/01/14
  • Last Seen:  

 

i got this src codes for Karma & Fame but when i rebuild the server, some error appears

/*==========================================
 * display karma and fame stats info of player [boks]
 *------------------------------------------*/

ACMD_FUNC(charstats)
{
    char output[CHAT_SIZE_MAX];
    int i;
    struct map_session_data *pl_sd=NULL;
	nullpo_retr(-1, sd);

    if (!message || !*message) {
        clif_displaymessage(sd->fd,"You must enter a name.");
        return 0;
    }

    if((pl_sd=map_nick2sd((char *)message)) == NULL && (pl_sd=map_charid2sd(atoi(message))) == NULL) {
        clif_displaymessage(fd, msg_txt(sd,3)); // Character Not Found.
        return 0;
    }

    for (i = 0; i < 2; i++) {
        if(i == 0) sprintf(output, "Name: %s | Lvl: %d/%d | Job: %s", pl_sd->status.name, pl_sd->status.base_level, pl_sd->status.job_level, job_name(pl_sd->status.class_));
        if(i == 1) {
			if(pc_readglobalreg(pl_sd,"REBORNPOINTS")) sprintf(output, "[ Karma: %d Fame: %d Reborn: %d ]", pc_readglobalreg(pl_sd,"KARMAPOINTS"), pc_readglobalreg(pl_sd,"FAMEPOINTS"), pc_readglobalreg(pl_sd,"REBORNPOINTS"));
			else sprintf(output, "[ Karma: %d Fame: %d Reborn: None ]", pc_readglobalreg(pl_sd,"KARMAPOINTS"), pc_readglobalreg(pl_sd,"FAMEPOINTS"));
		}
		clif_displaymessage(fd, output);
    }
	clif_displaymessage(fd, msg_txt(sd,29)); // 1 Player Found.

    return 0;
}

and this are the errors

1>..\src\map\atcommand.c(8554): warning C4047: 'function' : 'int64' differs in levels of indirection from 'char [13]'
1>..\src\map\atcommand.c(8554): warning C4024: 'pc_readregistry' : different types for formal and actual parameter 2
1>..\src\map\atcommand.c(8554): warning C4047: 'function' : 'int64' differs in levels of indirection from 'char [12]'
1>..\src\map\atcommand.c(8554): warning C4024: 'pc_readregistry' : different types for formal and actual parameter 2
1>..\src\map\atcommand.c(8554): warning C4047: 'function' : 'int64' differs in levels of indirection from 'char [11]'
1>..\src\map\atcommand.c(8554): warning C4024: 'pc_readregistry' : different types for formal and actual parameter 2
1>..\src\map\atcommand.c(8554): warning C4047: 'function' : 'int64' differs in levels of indirection from 'char [13]'
1>..\src\map\atcommand.c(8554): warning C4024: 'pc_readregistry' : different types for formal and actual parameter 2
1>..\src\map\atcommand.c(8555): warning C4047: 'function' : 'int64' differs in levels of indirection from 'char [12]'
1>..\src\map\atcommand.c(8555): warning C4024: 'pc_readregistry' : different types for formal and actual parameter 2
1>..\src\map\atcommand.c(8555): warning C4047: 'function' : 'int64' differs in levels of indirection from 'char [11]'
1>..\src\map\atcommand.c(8555): warning C4024: 'pc_readregistry' : different types for formal and actual parameter 2

 

My knowledge in source is not so good [im an Engeneer, goddammit xD] but I'll try to help using logic. I don't know if it's right. Here we go!

 

You declare output[CHAT_SIZE_MAX] with char and then uses it to store base and job level, which is int64 (I guess) in sprintf:

 

sprintf(output, "Name: %s | Lvl: %d/%d | Job: %s", pl_sd->status.name, pl_sd->status.base_level, pl_sd->status.job_level, job_name(pl_sd->status.class_));

 

I suggest you declare another variable int64 and store those in another line like:

int64 output2[CHAT_SIZE_MAX];
sprintf(output2, "Lvl: %d/%d",pl_sd->status.base_level, pl_sd->status.job_level);

and let the first line like this: 

sprintf(output, "Name: %s | Job: %s", pl_sd->status.name, job_name(pl_sd->status.class_));

I never did this before. Sorry if I'm wrong.

 

Good Luck!!

Edited by Fratini
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  7
  • Reputation:   0
  • Joined:  08/22/12
  • Last Seen:  

That's interesting. I was able to compile the code you pasted without any errors .

What revision are you using? 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  164
  • Reputation:   16
  • Joined:  03/15/12
  • Last Seen:  

That's interesting. I was able to compile the code you pasted without any errors .

What revision are you using? 

@Corrosive, try to update your svn. seems outdated.

 

Confirm there's an ERROR i'm using rAthena (31ef12b) 3/27/2016

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  170
  • Reputation:   1
  • Joined:  11/13/14
  • Last Seen:  

the revision on github right now

Edited by cahadeyelo
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  170
  • Reputation:   1
  • Joined:  11/13/14
  • Last Seen:  

and due to recent updates of rathena this pc_readglobalreg source code doesn't read by the server anymore when i tried to add REBORNPOINTS or any kind of cash points to my account/chars....how to fix this?

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