Jump to content
  • 0
mauiboy

R> @pk state on/off in town only

Question

11 answers to this question

Recommended Posts

  • 0
Finally found one and works fine on latest version. (Credits to the Owner/s)

 

First : I got the main source codes edited by malufett here, but it allows you to use @pk anywhere.

 


 

Second : So I keep on searching and I found this function suggested by Brynner to restrict anyone to use @pk state on/off only on towns/non-PVP maps. 

 


 



if( map[sd->bl.m].flag.pvp || map[sd->bl.m].flag.gvg || map[sd->bl.m].flag.gvg_castle || map[sd->bl.m].flag.gvg_dungeon ) {
clif_displaymessage(fd, "You can only change your PK state on non-PVP maps.");
return -1;
}


 

Third : I made a little editing on adding this function from Brynner.

 

at atcommand.c

 



int atcommand_pkmode( const int fd, struct map_session_data *sd, const char *command, const char *message ) {

nullpo_retr(-1, sd);

if( map[sd->bl.m].flag.pvp || map[sd->bl.m].flag.gvg || map[sd->bl.m].flag.gvg_castle || map[sd->bl.m].flag.gvg_dungeon ) {
clif_displaymessage(fd, "You can only change your PK state on non-PVP maps.");
return -1;
}

else if (!sd->state.pk_mode) {
sd->state.pk_mode = 1;
clif_displaymessage(sd->fd, "You are now no longer in PK mode.");
}

else {
sd->state.pk_mode = 0;
clif_displaymessage(sd->fd, "Returned to normal state.");
}

return 0;
}


Im currently using this code and it works fine on my test server. Thanks to all!

Link to comment
Share on other sites

  • 0

 

Finally found one and works fine on latest version. (Credits to the Owner/s)
 
First : I got the main source codes edited by malufett here, but it allows you to use @pk anywhere.
 
 
Second : So I keep on searching and I found this function suggested by Brynner to restrict anyone to use @pk state on/off only on towns/non-PVP maps. 
 
 
if( map[sd->bl.m].flag.pvp || map[sd->bl.m].flag.gvg || map[sd->bl.m].flag.gvg_castle || map[sd->bl.m].flag.gvg_dungeon ) {
clif_displaymessage(fd, "You can only change your PK state on non-PVP maps.");
return -1;
} 
 
Third : I made a little editing on adding this function from Brynner.
 
at atcommand.c
 
    int atcommand_pkmode( const int fd, struct map_session_data *sd, const char *command, const char *message ) {

        nullpo_retr(-1, sd);

        if( map[sd->bl.m].flag.pvp || map[sd->bl.m].flag.gvg || map[sd->bl.m].flag.gvg_castle || map[sd->bl.m].flag.gvg_dungeon ) {
            clif_displaymessage(fd, "You can only change your PK state on non-PVP maps.");
            return -1;
        }
        
        else if (!sd->state.pk_mode) {
            sd->state.pk_mode = 1;
            clif_displaymessage(sd->fd, "You are now no longer in PK mode.");
        }
        
        else {
            sd->state.pk_mode = 0;
            clif_displaymessage(sd->fd, "Returned to normal state.");
        }
        
        return 0;
    } 
Im currently using this code and it works fine on my test server. Thanks to all!

 

this file

 pk_mod_rA_r16215.PATCH?

Link to comment
Share on other sites

  • 0

 

 

Finally found one and works fine on latest version. (Credits to the Owner/s)
 
First : I got the main source codes edited by malufett here, but it allows you to use @pk anywhere.
 
 
Second : So I keep on searching and I found this function suggested by Brynner to restrict anyone to use @pk state on/off only on towns/non-PVP maps. 
 
 
if( map[sd->bl.m].flag.pvp || map[sd->bl.m].flag.gvg || map[sd->bl.m].flag.gvg_castle || map[sd->bl.m].flag.gvg_dungeon ) {
clif_displaymessage(fd, "You can only change your PK state on non-PVP maps.");
return -1;
} 
 
Third : I made a little editing on adding this function from Brynner.
 
at atcommand.c
 
    int atcommand_pkmode( const int fd, struct map_session_data *sd, const char *command, const char *message ) {

        nullpo_retr(-1, sd);

        if( map[sd->bl.m].flag.pvp || map[sd->bl.m].flag.gvg || map[sd->bl.m].flag.gvg_castle || map[sd->bl.m].flag.gvg_dungeon ) {
            clif_displaymessage(fd, "You can only change your PK state on non-PVP maps.");
            return -1;
        }
        
        else if (!sd->state.pk_mode) {
            sd->state.pk_mode = 1;
            clif_displaymessage(sd->fd, "You are now no longer in PK mode.");
        }
        
        else {
            sd->state.pk_mode = 0;
            clif_displaymessage(sd->fd, "Returned to normal state.");
        }
        
        return 0;
    } 
Im currently using this code and it works fine on my test server. Thanks to all!

 

this file

 pk_mod_rA_r16215.PATCH?

 

Yes

Link to comment
Share on other sites

  • 0
Hello, I'm using the latest version of rAthena and I wanted to put this mod but I get this error when compiling, I hope you can help me.

Thank you.

 

Edited by noxty
Link to comment
Share on other sites

  • 0
8 hours ago, noxty said:

error pk mode.jpg

-			if( map[m].flag.pvp && sd->state.pk_mode && flag&BCT_ENEMY && s_bl->type != BL_MOB )
-				return 0;

+			if( map_getmapflag(sd->bl.m, MF_PVP) && sd->state.pk_mode && flag&BCT_ENEMY && s_bl->type != BL_MOB )
+				return 0;

-				}else if( map[m].flag.pvp && sd->state.pk_mode && t_bl->type != BL_MOB )
-					return 0;

					return 0; // You can't target anything out of your duel

+				}else if (map_getmapflag(sd->bl.m, MF_PVP) && sd->state.pk_mode && t_bl->type != BL_MOB)
+					return 0;

Try This

Edited by Bringer
Link to comment
Share on other sites

  • 0
Thanks for the help but now I have another mistake, I hope you can help me.

Thank you
 
 
 
 
 
 

error pk mode 2.jpg

Link to comment
Share on other sites

  • 0
18 hours ago, noxty said:
Thanks for the help but now I have another mistake, I hope you can help me.

Thank you

 

 

 
 
 
 

error pk mode 2.jpg

+			if( map_getmapflag(sd->bl.m, MF_PVP) && sd->state.pk_mode && flag&BCT_ENEMY && s_bl->type != BL_MOB )
+				return 0;

 

+				}else if (map_getmapflag(sd->bl.m, MF_PVP) && sd->state.pk_mode && t_bl->type != BL_MOB)
+
Link to comment
Share on other sites

  • 0

Hi thanks for the mod how about @pk off in town.. for example when using @pk off in town and enter the pvp / mvp room can still be attacked

 
Edited by Get Backers
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...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.