Raised This Month: $51 Target: $400
 12% 

Allow certain commands target admins?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mr.D
Junior Member
Join Date: Jun 2017
Old 06-21-2017 , 02:19   Allow certain commands target admins?
Reply With Quote #1

Hi!

Is it possible to allow certain commands target admins, ignoring their immunity level?
I have some VIP commands that are meant to be used between VIP's and admins on each other. The commands are not dangerous. I need VIP members (or low level admins) to be able to target a high level admin with those commands. How would I do that?
Mr.D is offline
BraveFox
AlliedModders Donor
Join Date: May 2015
Location: Israel
Old 06-21-2017 , 05:25   Re: Allow certain commands target admins?
Reply With Quote #2

You will need to configure the targeting by your self,
Using FindTarget and then you need to configure the @ by your self.
By using FindTarget you can choose if to enable the immunity:
PHP Code:
FindTarget(int client, const char[] targetbool nobotsbool immunity
__________________
Contact Me:
Steam: NoyB
Discord: Noy#9999
Taking Private Requests

Last edited by BraveFox; 06-21-2017 at 05:28.
BraveFox is offline
Mr.D
Junior Member
Join Date: Jun 2017
Old 06-21-2017 , 07:09   Re: Allow certain commands target admins?
Reply With Quote #3

Quote:
Originally Posted by BraveFox View Post
You will need to configure the targeting by your self,
Using FindTarget and then you need to configure the @ by your self.
By using FindTarget you can choose if to enable the immunity:
PHP Code:
FindTarget(int client, const char[] targetbool nobotsbool immunity
I've been using FindTarget but never knew it had immunity arguments. I guess by default it is set to 1. I'll check it later and let you know if it worked. Thanks!

Edit:
Seems to be working. Thanks a lot!
Any idea why error message doesn't display? If I get it right, FindTarget should return -1 if the target wasn't found.
It doesn't display anything if I do it like this:
...
...
int target = FindTarget(client, arg, true, false); // Do not target bots is set to true

if (target == -1)
{
ReplyToCommand(client, "Could not find that name");
}

P.S.
Tried same thing with any names that are not present on the server and still this message didn't show.

Last edited by Mr.D; 06-21-2017 at 10:08.
Mr.D is offline
Impact123
Veteran Member
Join Date: Oct 2011
Location: Germany
Old 06-21-2017 , 15:59   Re: Allow certain commands target admins?
Reply With Quote #4

Always check your logs when testing plugins or use the command directly from the server's console, it probably says something like this
Code:
[SM] Native "ReplyToCommand" reported: Language phrase "No matching client" not found
The reason for this is that you have to load the common.phrases file when you use ProcessTargetString which is used by FindTarget.
__________________

Last edited by Impact123; 06-21-2017 at 16:04.
Impact123 is offline
Mr.D
Junior Member
Join Date: Jun 2017
Old 06-21-2017 , 17:19   Re: Allow certain commands target admins?
Reply With Quote #5

Quote:
Originally Posted by Impact123 View Post
Always check your logs when testing plugins or use the command directly from the server's console, it probably says something like this
Code:
[SM] Native "ReplyToCommand" reported: Language phrase "No matching client" not found
The reason for this is that you have to load the common.phrases file when you use ProcessTargetString which is used by FindTarget.
My bad, just starting out!
Your solution solved the problem. Thank you!
But is there a way to show my own error message (or maybe do something else) to clients instead of SM's default error messages? I could edit "common.phrases" but it's still not exactly what I have on my mind.
Mr.D is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 06-21-2017 , 23:33   Re: Allow certain commands target admins?
Reply With Quote #6

yes, use the raw processtargetstring instead of findtarget, since the point of findtarget in the first place is exactly to provide processtargetstring + error messages
Miu is offline
Mr.D
Junior Member
Join Date: Jun 2017
Old 06-22-2017 , 03:17   Re: Allow certain commands target admins?
Reply With Quote #7

Will try that. Thanks guys!
Mr.D is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:27.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode