Raised This Month: $32 Target: $400
 8% 

[TF2] Friendly Mode (v. 16.0112)


Post New Thread Reply   
 
Thread Tools Display Modes
Dyl0n
Member
Join Date: Oct 2011
Old 05-01-2013 , 00:36   Re: [TF2] Friendly Mode (v. 13.0426)
Reply With Quote #111

Wow, its crazy what you have done from my original plugin . I'm glad someone decided to use it! It feels pretty good to know I was somehow a part of this process.

To help with reloading/adding the plugin mid game you can use this in the OnPluginStart() function:

Code:
    for(new i=1;i<=MaxClients;i++) {
        if(IsClientInGame(i))
        {
            SDKHook(i, SDKHook_OnTakeDamage, OnTakeDamage);
        }
    }
__________________
BABIES DONT YOU PANIC!
If you enjoy something I did please consider donating!

Last edited by Dyl0n; 05-01-2013 at 01:28.
Dyl0n is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 05-01-2013 , 04:09   Re: [TF2] Friendly Mode (v. 13.0426)
Reply With Quote #112

Thanks a bunch for starting it. I've learned a LOT about Pawn and Sourcemod over the last three weeks.

I tried something like the code you have posted a few days back, but it just spat out errors at me. Maybe I used a check other than IsClientInGame()? I don't quite remember what I did.

If it works, the next update will include the removal of the need for a player to respawn to gain the protections of Friendly Mode upon plugin load.


EDIT: Ah, I see what I did wrong originally. Replacing <MAXPLAYERS with <= MaxClients fixed it all.

Last edited by ddhoward; 05-01-2013 at 05:13.
ddhoward is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 05-01-2013 , 16:01   Re: [TF2] Friendly Mode (v. 13.0426)
Reply With Quote #113

Is there any particular class/weapon that's causing this? Do you have any other plugins that remove weapons?

In any case, I've added an IsValidEdict() check to that function.

Last edited by ddhoward; 05-01-2013 at 16:29.
ddhoward is offline
Dyl0n
Member
Join Date: Oct 2011
Old 05-01-2013 , 17:01   Re: [TF2] Friendly Mode (v. 13.0426)
Reply With Quote #114

Oh yeah, I was having the above problem too. Eventually I got something spammed in my server window about edict spots running out or something along those lines.

I changed the way I removed my weapons from the SDKHooks way to a way I found in a plugin called "The Machina Block".

Code:
public OnPluginStart()
{
    CreateTimer(0.1, Timer_DoEquip, 0, TIMER_REPEAT);
}

public Action:Timer_DoEquip(Handle:timer, any:derp)
{
    for(new client=1; client <= MaxClients; client++)
    {        
        if(IsClientInGame(client) && IsPlayerAlive(client) && IsFriendly[client])
        {        
            new slot0 = GetPlayerWeaponSlot(client, 0);  //you would have to know the slot though :(
                        
            if(TF2_GetPlayerClass(client) == TFClass_Sniper)
            {
                 if(slot0 > MaxClients && IsValidEntity(slot0)  && GetEntProp(slot0, Prop_Send, "m_iItemDefinitionIndex") ==  WEP_DEX_Rifle)
                {
                    TF2_RemoveWeaponSlot(client, 0);
                    PrintToChat(client, "The Machina is not permitted here currently due Headshot sounds are too noisy");
                }
            }
        }    
    }
}
You could use this to block weapons. As long as the person is in friendly mode (check with a bool) it will remove the weapon instead of blocking them from switching to it. You would need to find the definition indexes of each weapon you would like to block or you could (i think) specify a weapon index with a cvar.

Maybe if you wanted you could make it so you can set multiple item indexes in the cvar and write a function that separates the numbers and puts them into an array. It sounds possible. The only problem is knowing which slot the weapon is in.
__________________
BABIES DONT YOU PANIC!
If you enjoy something I did please consider donating!
Dyl0n is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 05-01-2013 , 20:31   Re: [TF2] Friendly Mode (v. 13.0426)
Reply With Quote #115

Well, I want to avoid looping timers as much as possible. If I hook post_inventory_application, and scan for the items there (as well as on Friendly toggle), it should be just as good, and less demanding. The only thing I need to figure out if how to give the items back upon Friendly disable.

I'll see if I can't get this implemented before my next update in 6 hours.

Last edited by ddhoward; 05-01-2013 at 20:41.
ddhoward is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 05-02-2013 , 03:05   Re: [TF2] Friendly Mode (v. 13.0426)
Reply With Quote #116

Uploading new version 13.0501. It is attached to this post, has been pushed to the server that Updater downloads from, and will soon replace the version in the first post in this thread. Changes are:
  • The config file at tf/cfg/sourcemod/friendly.cfg will no longer be automatically generated. If the file exists, any settings there will override settings anywhere else. See the first post for info on this file. The first post also includes a template file.

  • On plugin load or reload, Friendly players no longer need to respawn to gain the protections of Friendly mode. Players are hooked instantly.

  • Added cvar sm_friendly_overlay, with a default value of 0. When this cvar is set to something other than 0, that string will be used as the path to an overlay to display to Friendly players. See the first post for details on usage, if interested.

  • Added IsValidEdict() check to weapon blocker function, since some people were having problems with that????

  • Added the gunslinger to the list of weapons blocked by sm_friendly_blockweps

Please let me know if you run into any issues. Please also consider installing Updater if you haven't already!




A different method of blocking certain weapons will hopefully come soon, as well as anti-AFK-while-Friendly measures.
Attached Files
File Type: sp Get Plugin or Get Source (friendly.sp - 119 views - 43.5 KB)
File Type: smx friendly.smx (20.7 KB, 113 views)

Last edited by ddhoward; 05-02-2013 at 03:05.
ddhoward is offline
Scipizoa
Senior Member
Join Date: Aug 2012
Location: ask me
Old 05-03-2013 , 17:57   Re: [TF2] Friendly Mode (v. 13.0501)
Reply With Quote #117

getting this in my logs

Code:
L 05/03/2013 - 17:53:54: [SM] Displaying call stack trace for plugin "Friendly.smx":
L 05/03/2013 - 17:53:54: [SM]   [0]  Line 127, C:\Users\root\Desktop\Friendly.sp::OnTakeDamage()
L 05/03/2013 - 17:53:54: [SM] Native "GetClientWeapon" reported: Client index 127 is invalid
L 05/03/2013 - 17:53:54: [SM] Displaying call stack trace for plugin "Friendly.smx":
L 05/03/2013 - 17:53:54: [SM]   [0]  Line 127, C:\Users\root\Desktop\Friendly.sp::OnTakeDamage()
L 05/03/2013 - 17:53:54: [SM] Native "GetClientWeapon" reported: Client index 127 is invalid
L 05/03/2013 - 17:53:54: [SM] Displaying call stack trace for plugin "Friendly.smx":
L 05/03/2013 - 17:53:54: [SM]   [0]  Line 127, C:\Users\root\Desktop\Friendly.sp::OnTakeDamage()
L 05/03/2013 - 17:53:54: [SM] Native "GetClientWeapon" reported: Client index 127 is invalid
L 05/03/2013 - 17:53:54: [SM] Displaying call stack trace for plugin "Friendly.smx":
L 05/03/2013 - 17:53:54: [SM]   [0]  Line 127, C:\Users\root\Desktop\Friendly.sp::OnTakeDamage()
L 05/03/2013 - 17:53:55: [SM] Native "GetClientWeapon" reported: Client index 127 is invalid
L 05/03/2013 - 17:53:55: [SM] Displaying call stack trace for plugin "Friendly.smx":
L 05/03/2013 - 17:53:55: [SM]   [0]  Line 127, C:\Users\root\Desktop\Friendly.sp::OnTakeDamage()
L 05/03/2013 - 17:53:55: [SM] Native "GetClientWeapon" reported: Client index 127 is invalid
L 05/03/2013 - 17:53:55: [SM] Displaying call stack trace for plugin "Friendly.smx":
L 05/03/2013 - 17:53:55: [SM]   [0]  Line 127, C:\Users\root\Desktop\Friendly.sp::OnTakeDamage()
L 05/03/2013 - 17:53:56: [SM] Native "GetClientWeapon" reported: Client index 127 is invalid
L 05/03/2013 - 17:53:56: [SM] Displaying call stack trace for plugin "Friendly.smx":
L 05/03/2013 - 17:53:56: [SM]   [0]  Line 127, C:\Users\root\Desktop\Friendly.sp::OnTakeDamage()
L 05/03/2013 - 17:53:58: [SM] Native "GetClientWeapon" reported: Client index 127 is invalid
L 05/03/2013 - 17:53:58: [SM] Displaying call stack trace for plugin "Friendly.smx":
L 05/03/2013 - 17:53:58: [SM]   [0]  Line 127, C:\Users\root\Desktop\Friendly.sp::OnTakeDamage()
also friendly admin won't let me kill other friendlies, and i have invuln set to 2[basic damage protect only]
__________________

ZaBaGaBe Gaming Community: http://steamcommunity.com/groups/ZBGB
Scipizoa is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 05-03-2013 , 19:25   Re: [TF2] Friendly Mode (v. 13.0501)
Reply With Quote #118

Are you compiling the plugin yourself? What changes are you making? I'm not getting any such error spam, and sm_friendly_admin is working fine for me. Please attach the entire altered .sp that you are compiling.

Last edited by ddhoward; 05-03-2013 at 19:27.
ddhoward is offline
Scipizoa
Senior Member
Join Date: Aug 2012
Location: ask me
Old 05-03-2013 , 19:27   Re: [TF2] Friendly Mode (v. 13.0501)
Reply With Quote #119

I didnt do notin. This was from your latest version


EDIT: o fail.... fail fail.. sorry never mind my fail for some reason when i installed yours it didn't overwrite the version i tried using from that code before you took this project on officially my bad xD
__________________

ZaBaGaBe Gaming Community: http://steamcommunity.com/groups/ZBGB

Last edited by Scipizoa; 05-03-2013 at 19:31.
Scipizoa is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 05-03-2013 , 19:31   Re: [TF2] Friendly Mode (v. 13.0501)
Reply With Quote #120

Made some sick improvements to the weapon blocker, hoping to upload soon~

Last edited by ddhoward; 05-03-2013 at 19:33.
ddhoward 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 23:29.


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