Raised This Month: $ Target: $400
 0% 

Editing Friendly mode plugin to allow kills/ Disallowing func_button for public


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PointlessFish
Junior Member
Join Date: Feb 2016
Old 02-14-2016 , 05:24   Editing Friendly mode plugin to allow kills/ Disallowing func_button for public
Reply With Quote #1

Hello!
This is my first post so excuse me if I am posting in the incorrect place.

What I am trying to do:

It may seem, at first, like allowing a friendly player to kill is rather contradictory but I am not using the plugin as it was intended to be used.

I run a server with tr_walkway_rc2 map. I understand it was probably a bad idea to use this map on multiplayer but we have huge amounts of people coming.

The problem is, they seem to enjoy messing around in the "settings room". This makes the bots start to do weird things. I would like the controls only to be accessable by admins.

I thought of doing a few things.
1. to use the Friendly Mode plugin and edit it to allow friendlies to kill but not use func_buttons. (giveing friendly mode to all users on join)
2. Make a plugin that allows only admins to use the buttons
3. Make a plugin the will disallow the control room (maybe using co ordinates?) from the public

I am completely stumped on how to do all of these as I have hardly any Source pawn scripting experience. If anyone could help me out I would be happy.

If you have any other suggestions as to what I can do, please do tell me.

Thank you!

Last edited by PointlessFish; 02-14-2016 at 06:09.
PointlessFish is offline
PointlessFish
Junior Member
Join Date: Feb 2016
Old 02-14-2016 , 05:30   Re: Editing Friendly mode plugin to allow kills/ Disallowing func_button for public
Reply With Quote #2

Apparently func_button has a hurt based mechanic?

Is there was way to just disallow that?

I found this page but I don't know how to use it/ if it works.
https://forums.alliedmods.net/showthread.php?t=242834

Or maybe even
https://forums.alliedmods.net/showthread.php?t=39439
(Stripper:Source) Although that is probably a last thing to do because I do want to keep the buttons.

I tried a few things with the friendly mode plugin source:

It seems the ability to damage other player is based on this:

public Action OnTakeDamage(int client, int &attacker, int &inflictor, float &damage, int &damagetype, int &weapon, float damageForce[3], float damagePosition[3]) { if (!IsValidClient(attacker) || (client == attacker && cvar_invuln_p.IntValue != 3)) { return Plugin_Continue; } if ((IsFriendly[attacker] || IsFriendly[client]) && !IsAdmin[attacker]) { damage = 0.0; return Plugin_Handled; } return Plugin_Continue; }

However, it tried to compile it without this part ( a couple days ago) and it gave me an error.

Last edited by PointlessFish; 02-14-2016 at 06:02. Reason: Added extra infomation and links
PointlessFish is offline
PointlessFish
Junior Member
Join Date: Feb 2016
Old 02-14-2016 , 19:07   Re: Editing Friendly mode plugin to allow kills/ Disallowing func_button for public
Reply With Quote #3

Scratch that, I am not sure what to do.
PointlessFish is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 02-14-2016 , 19:16   Re: Editing Friendly mode plugin to allow kills/ Disallowing func_button for public
Reply With Quote #4

PHP Code:
public void OnEntityCreated(int entity, const char[] classname) {
    if (
StrEqual(classname"func_button"false)) {
        
SDKHook(entitySDKHook_OnTakeDamageButtonTakeDamage);
        
SDKHook(entitySDKHook_UseButtonUsed);
    }
}

public 
Action ButtonTakeDamage(int buttonint &attackerint &inflictorfloat &damageint &damagetypeint &weaponfloat damageForce[3], float damagePosition[3]) {
    if(
CheckCommandAccess(attacker"buttons"ADMFLAG_GENERIC))
        return 
Plugin_Continue;
    
    return 
Plugin_Handled;
}

public 
Action ButtonUsed(int entityint activatorint callerUseType typefloat value){
    if(
CheckCommandAccess(activator"buttons"ADMFLAG_GENERIC))
        return 
Plugin_Continue;
    
    return 
Plugin_Handled;

sth like that
Miu is offline
PointlessFish
Junior Member
Join Date: Feb 2016
Old 02-15-2016 , 05:43   Re: Editing Friendly mode plugin to allow kills/ Disallowing func_button for public
Reply With Quote #5

Not much explanation has been given to tell me what to do.
Would you care to explain please?

Looks like possibly a plugin to allow only admins to use buttons? Do I just compile and go?

Last edited by PointlessFish; 02-15-2016 at 05:48.
PointlessFish is offline
PointlessFish
Junior Member
Join Date: Feb 2016
Old 02-15-2016 , 11:04   Re: Editing Friendly mode plugin to allow kills/ Disallowing func_button for public
Reply With Quote #6

I am new to Sourcemod coding. Sorry about that.
PointlessFish is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 02-15-2016 , 11:20   Re: Editing Friendly mode plugin to allow kills/ Disallowing func_button for public
Reply With Quote #7

Quote:
Originally Posted by PointlessFish View Post
Looks like possibly a plugin to allow only admins to use buttons? Do I just compile and go?
Yes, add #include <sdkhooks> at the top and it should compile and work, although I have not tested it
Miu is offline
PointlessFish
Junior Member
Join Date: Feb 2016
Old 02-15-2016 , 12:02   Re: Editing Friendly mode plugin to allow kills/ Disallowing func_button for public
Reply With Quote #8

Ok, will do!
Thanks again, Miu.
PointlessFish is offline
PointlessFish
Junior Member
Join Date: Feb 2016
Old 02-15-2016 , 12:40   Re: Editing Friendly mode plugin to allow kills/ Disallowing func_button for public
Reply With Quote #9

Wow thanks so much Miu! It worked
Not sure if there is a reputation system on this website but +rep all the same.
Thanks again!
PointlessFish is offline
Reply


Thread Tools
Display Modes

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 14:23.


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