AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Editing Friendly mode plugin to allow kills/ Disallowing func_button for public (https://forums.alliedmods.net/showthread.php?t=279045)

PointlessFish 02-14-2016 05:24

Editing Friendly mode plugin to allow kills/ Disallowing func_button for public
 
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! :bee:

PointlessFish 02-14-2016 05:30

Re: Editing Friendly mode plugin to allow kills/ Disallowing func_button for public
 
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.

PointlessFish 02-14-2016 19:07

Re: Editing Friendly mode plugin to allow kills/ Disallowing func_button for public
 
Scratch that, I am not sure what to do.

Miu 02-14-2016 19:16

Re: Editing Friendly mode plugin to allow kills/ Disallowing func_button for public
 
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

PointlessFish 02-15-2016 05:43

Re: Editing Friendly mode plugin to allow kills/ Disallowing func_button for public
 
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?

PointlessFish 02-15-2016 11:04

Re: Editing Friendly mode plugin to allow kills/ Disallowing func_button for public
 
I am new to Sourcemod coding. Sorry about that.

Miu 02-15-2016 11:20

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

Originally Posted by PointlessFish (Post 2393126)
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

PointlessFish 02-15-2016 12:02

Re: Editing Friendly mode plugin to allow kills/ Disallowing func_button for public
 
Ok, will do!
Thanks again, Miu.

PointlessFish 02-15-2016 12:40

Re: Editing Friendly mode plugin to allow kills/ Disallowing func_button for public
 
Wow thanks so much Miu! It worked :D
Not sure if there is a reputation system on this website but +rep all the same.
Thanks again!


All times are GMT -4. The time now is 18:59.

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