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

[TF2] Friendly Mode (v. 16.0112)


Post New Thread Reply   
 
Thread Tools Display Modes
Wazman
AlliedModders Donor
Join Date: Oct 2012
Location: Unknown place ????
Old 04-13-2013 , 18:37   Re: [TF2] Friendly Mode
Reply With Quote #21

I have a friend that's good with SDK hooks, im gonna ask him if he knows how to use that
if(ent>0) solution that was suggested. If he writes it into the mod i'll upload it for ya. I won't edit anything else in your mod, just upload a version without the Error log spam thing. hehe
Wazman is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 04-13-2013 , 18:45   Re: [TF2] Friendly Mode
Reply With Quote #22

Sweeeeeeeet~~ Sounds like a plan.

I literally haven't touched anything in this code involving SDKHooks. :\
ddhoward is offline
salsav91
Senior Member
Join Date: Aug 2012
Location: Where Lollichops sleep
Old 04-13-2013 , 19:54   Re: [TF2] Friendly Mode
Reply With Quote #23

Can this somehow become class specific? Like only work for spies.

Also another interesting glitch. If someone has one of the blocked weapons, they can still use it if they go friendly with it in there hands.
A.K.A (Pyro air blast)
__________________


Check out my pony animations. http://www.youtube.com/salsav91

Last edited by salsav91; 04-13-2013 at 19:55.
salsav91 is offline
thetwistedpanda
Good Little Panda
Join Date: Sep 2008
Old 04-13-2013 , 20:19   Re: [TF2] Friendly Mode
Reply With Quote #24

Not sure what was mysterious about the post I provided. Although the modified function prototype replacing entity with building probably didn't help, you may want to avoid doing that since OnEntityCreated is fired for EVERY entity that is created, not just "buildings".
PHP Code:
public OnEntityCreated(building, const String:classname[])
{
    
SDKHook(buildingSDKHook_SpawnOnEntitySpawned);

Becomes
PHP Code:
public OnEntityCreated(building, const String:classname[])
{
  if(
building 0)
  {
    
SDKHook(buildingSDKHook_SpawnOnEntitySpawned);
  }

It's a long existing bug that occurs from time to time where negatives appear instead of a valid entity index.
__________________

Last edited by thetwistedpanda; 04-13-2013 at 20:27.
thetwistedpanda is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 04-13-2013 , 21:04   Re: [TF2] Friendly Mode
Reply With Quote #25

Quote:
Originally Posted by salsav91 View Post
Can this somehow become class specific? Like only work for spies.
Maybe? I'll look into it when I can; it's not really a high priority for me.

Quote:
Originally Posted by salsav91 View Post
Also another interesting glitch. If someone has one of the blocked weapons, they can still use it if they go friendly with it in there hands.
A.K.A (Pyro air blast)
I am aware of this, and realized a solution literally as I was typing "I am aware of this." I should have the fix implemented in the next version of the plugin.

Quote:
Originally Posted by thetwistedpanda View Post
Not sure what was mysterious about the post I provided
Please understand that I know next to nothing about this stuff. I haven't done any sort of coding or programming since I took an "Introduction to Object Oriented Programming" (or whatever it was called) class at my local community college just under 4 years ago. I am using this plugin as an opportunity to learn this stuff. That being said, this was my initial instinct on how to implement that fix.

Code:
public OnEntityCreated(building, const String:classname[]) {
	if(entity > 0) {
		SDKHook(building, SDKHook_Spawn, OnEntitySpawned);
	}
}
If that didn't work, I would have tried:
Code:
public OnEntityCreated(building, const String:classname[]) {
	if(entity(building) > 0) {
		SDKHook(building, SDKHook_Spawn, OnEntitySpawned);
	}
}
If that didn't work, I would have tried:
Code:
public OnEntityCreated(building, const String:classname[]) {
	if(entity[building] > 0) {
		SDKHook(building, SDKHook_Spawn, OnEntitySpawned);
	}
}
I was close, at least.

Thank you for your help~
ddhoward is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 04-14-2013 , 00:09   Re: [TF2] Friendly Mode
Reply With Quote #26

Uploading new version 13.0413 (2054). It is attached to this post, and will soon replace the version in the first post in this thread. Changes are:
  • Players who enter Friendly mode while holding a blocked weapon will be forced to remove that weapon, assuming that sm_friendly_blockweps = 1.
  • Error log spam should be fixed, big thanks to thetwistedpanda.
Attached Files
File Type: sp Get Plugin or Get Source (friendly.sp - 548 views - 12.0 KB)
File Type: smx friendly.smx (7.0 KB, 178 views)

Last edited by ddhoward; 04-14-2013 at 00:10.
ddhoward is offline
NameUser
Senior Member
Join Date: Apr 2012
Location: Bay Area, California
Old 04-14-2013 , 01:00   Re: [TF2] Friendly Mode
Reply With Quote #27

Instead of doing this
Code:
 if(ClientIsFriendly[client] && GetConVarBool(sm_friendly_blockweps))
 {
  if(StrEqual(sWeapon, "tf_weapon_flamethrower") || StrEqual(sWeapon, "tf_weapon_medigun") || StrEqual(sWeapon, "tf_weapon_builder") || StrEqual(sWeapon, "tf_weapon_bonesaw") || StrEqual(sWeapon, "tf_weapon_compound_bow") || StrEqual(sWeapon, "tf_weapon_bat_wood") || StrEqual(sWeapon, "tf_weapon_jar") || StrEqual(sWeapon, "tf_weapon_jar_milk") || StrEqual(sWeapon, "tf_weapon_fireaxe") || StrEqual(sWeapon, "tf_weapon_lunchbox") || StrEqual(sWeapon, "tf_weapon_crossbow") || StrEqual(sWeapon, "tf_weapon_sapper"))
   return Plugin_Handled;
 }
Why not use TF2Items to block the weapon ids?
__________________
NameUser is offline
Send a message via Skype™ to NameUser
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 04-14-2013 , 01:23   Re: [TF2] Friendly Mode
Reply With Quote #28

Quote:
Originally Posted by NameUser View Post
Why not use TF2Items to block the weapon ids?
Because I have no idea how to use TF2Items, and I didn't write that code that you've quoted. I've only been using SourcePawn for about 2 days now.

As stated in the OP, the method of blocking weapons is something that I am looking into changing. Again, I know next to nothing about any of this stuff.

Last edited by ddhoward; 04-14-2013 at 01:23.
ddhoward is offline
Scipizoa
Senior Member
Join Date: Aug 2012
Location: ask me
Old 04-14-2013 , 01:57   Re: [TF2] Friendly Mode
Reply With Quote #29

Ok just tested it, it seems like everything works fine but i don't thing the remembering portion is working quite right, for one when i change classes it doesn't remember friendly mode or it just remembers some of it, example, i can be a heavy in friendly and not use the sandvich then switch tomedic i can't use the medigun but i can still take damage so its like a half friendly mode

also as for the goomba issues why not use godmode instead of budah and slay instead of slap/punish iirc people in god mode can't goomba/be goomba'd ;) i 'd need a clarification on this
__________________

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

Last edited by Scipizoa; 04-14-2013 at 02:02.
Scipizoa is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 04-14-2013 , 04:08   Re: [TF2] Friendly Mode
Reply With Quote #30

Quote:
Originally Posted by Scipizoa View Post
also as for the goomba issues why not use godmode instead of budah and slay instead of slap/punish iirc people in god mode can't goomba/be goomba'd ;) i 'd need a clarification on this
Wrong. People in Godmode CAN goomba others. Changing the buddha to godmode would not change ANYTHING, other than remove a player's ability to rocket/sticky jump. And if you read the first post, you will see that setting the punish CVARS to negative values makes the punishment a slay.

Quote:
Originally Posted by Scipizoa View Post
Ok just tested it, it seems like everything works fine but i don't thing the remembering portion is working quite right, for one when i change classes it doesn't remember friendly mode or it just remembers some of it, example, i can be a heavy in friendly and not use the sandvich then switch tomedic i can't use the medigun but i can still take damage so its like a half friendly mode
I am unable to recreate this issue. Please ensure that you change the map upon updating/installing the plugin.

Last edited by ddhoward; 04-14-2013 at 04:22.
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 01:06.


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