Jump to content

Recommended Posts

Posted (edited)

I think it would be useful to add a can_attack permission, so you can prevent GMs to attack monsters or players (to prevent corruption acts like: tanking players, get items to give to players, etc...).

I've just coded it by myself, so here's the code ;)

Edit: I think I should add a check to pets, homunculus, mercenaries and elementals too...

pc_groups.c

 { "use_changemaptype", PC_PERM_USE_CHANGEMAPTYPE },
 { "all_commands", PC_PERM_USE_ALL_COMMANDS },
 { "receive_requests", PC_PERM_RECEIVE_REQUESTS },
+ { "can_attack", PC_PERM_ATTACK},
};

/**

pc.h

 PC_PERM_USE_CHANGEMAPTYPE   = 0x04000,
 PC_PERM_USE_ALL_COMMANDS	= 0x08000,
 PC_PERM_RECEIVE_REQUESTS	= 0x10000,
+ PC_PERM_ATTACK			  = 0x20000,
};

#define pc_setdead(sd)		( (sd)->state.dead_sit = (sd)->vd.dead_sit = 1 )

clif.c :

 case 0x00: // once attack
 case 0x07: // continuous attack

+ if( !pc_has_permission(sd, PC_PERM_ATTACK) )
+ return;
+
 if( pc_cant_act(sd) || sd->sc.option&OPTION_HIDE )
 return;

 if( skilllv < 1 ) skilllv = 1; //No clue, I have seen the client do this with guild skills :/ [skotlex]

+ if( !pc_has_permission(sd, PC_PERM_ATTACK) )
+ return;
+
 tmp = skill_get_inf(skillnum);
 if (tmp&INF_GROUND_SKILL || !tmp)
 return; //Using a ground/passive skill on a target? WRONG.

/// There are various variants of this packet, some of them have padding between fields.
void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd)
{
+ if( !pc_has_permission(sd, PC_PERM_ATTACK) )
+ return;
 if (pc_cant_act(sd))
 return;
 if (pc_issit(sd))

Edited by Daegaladh
  • Upvote 3

Join the conversation

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

Guest
Reply to this topic...

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...