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

Need help setting up a loadout plugin that piggybacks [TF2items] Give Weapon plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
JeremWatts
Junior Member
Join Date: Apr 2021
Old 04-05-2021 , 07:12   Need help setting up a loadout plugin that piggybacks [TF2items] Give Weapon plugin
Reply With Quote #1

So

I have the [TF2items] Give Weapon plugin working to my knowledge.

Ultimately my goal is to setup a plugin before the end of the month for my birthday that will make tf2 more accessible for noobs by dictating loadouts for specific classes.

My issue is that I am not familiar with coding and can only either get every player to be completely weaponless or I get the weapons copying themselves and crashing the server via entity limit.

I'll attach the files for my last attempt, yet another t-pose party.

The code i was trying to Frankenstein came from the first two pages of this thread https://forums.alliedmods.net/showthread.php?t=203225

If i can see an example of just one working weapon I feel like i can figure out the rest from there.
Attached Files
File Type: sp Get Plugin or Get Source (pyrobattle.sp - 46 views - 828 Bytes)
File Type: txt tf2items.givecustom.txt (262 Bytes, 55 views)
File Type: smx pyrobattle.smx (2.9 KB, 52 views)
JeremWatts is offline
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 04-06-2021 , 17:08   Re: Need help setting up a loadout plugin that piggybacks [TF2items] Give Weapon plug
Reply With Quote #2

We can help you if more information is provided.

1. Are you wanting to give every Human and Bot Scout a STOCK Syringe Gun and a Medi Gun?
2. Are you running TF2Attributes?
3. Are you wanting to change player cosmetics?
4. What are the specific loadout do you want for a specific class?

The code you provided won't work until you change it. Once fixed it will give a standard Syringe Gun and standard Medi Gun to all Scouts when they spawn or touch a locker.

Change this line:
Code:
public OnPostInventoryApplication( Handle:hEvent, const String:strEventName[], bool:bDontBroadcast )
{
	new iClient = GetClientOfUserId( GetEventInt( hEvent, "userid" ) )
	
	for( new iSlot = 0; iSlot < _:TF2ItemSlot; iSlot++ )
		TF2_RemoveWeaponSlot( iClient, iSlot );
	
    if (TF2_GetPlayerClass(iClient) == TFClass_Scout)
    {
        TF2Items_GiveWeapon(iClient, 17);
        TF2Items_GiveWeapon(iClient, 29);
    } 
	
}
To read:
Code:
public OnPostInventoryApplicationAndPlayerSpawn( Handle:hEvent, const String:strEventName[], bool:bDontBroadcast )
{
	new iClient = GetClientOfUserId( GetEventInt( hEvent, "userid" ) )
	
    if (TF2_GetPlayerClass(iClient) == TFClass_Scout)
    {
	TF2_RemoveWeaponSlot( iClient, 0 );
        TF2Items_GiveWeapon(iClient, 17);
	TF2_RemoveWeaponSlot( iClient, 1 );		
        TF2Items_GiveWeapon(iClient, 29);
    } 
}
You can view my Bling plugin to get ideas on what is possible: https://forums.alliedmods.net/showthread.php?p=2728917
PC Gamer is offline
JeremWatts
Junior Member
Join Date: Apr 2021
Old 04-07-2021 , 04:23   Re: Need help setting up a loadout plugin that piggybacks [TF2items] Give Weapon plug
Reply With Quote #3

Script now amended, restarted the server but no go - still just t-poses. It's gotta be my config txt then right?

/just/ in case i read something wrong this is what my .sp looks like verbatim right now

Code:
#include <sourcemod>
#include <tf2items>
#include <tf2_stocks>
#include <tf2items_giveweapon>

new TF2ItemSlot = 8;
 
public Plugin:myinfo =
{
	name = "SmootheBrainBan",
	author = "Jerem",
	description = "Accessable TF2",
	version = "0.12",
	url = ""
};
 
public OnPluginStart()
{
	HookEvent( "post_inventory_application", OnPostInventoryApplicationAndPlayerSpawn );
}

public OnPostInventoryApplicationAndPlayerSpawn( Handle:hEvent, const String:strEventName[], bool:bDontBroadcast )
{
	new iClient = GetClientOfUserId( GetEventInt( hEvent, "userid" ) )
	
    if (TF2_GetPlayerClass(iClient) == TFClass_Scout)
    {
	TF2_RemoveWeaponSlot( iClient, 0 );
        TF2Items_GiveWeapon(iClient, 17);
	TF2_RemoveWeaponSlot( iClient, 1 );		
        TF2Items_GiveWeapon(iClient, 29);
    } 
}
Quote:
Are you wanting to give every Human and Bot Scout a STOCK Syringe Gun and a Medi Gun?
&
Quote:
What are the specific loadout do you want for a specific class?
For this test, yes. Stock syringe gun and medigun.
However, my final product I want to look pretty dang similar to the picture i attached (simpler tf2 v0.4.png)

All regular unless specified
Scout with Backscat, Crit-a-cola, Bat
Heavy with Rocket Launcher(2rocketclip), Family Business, Cabertoss (+movementspeed while active)
Engineer with Panic Attack, Ambassadore, Gunslinger
Medic with Shotgun, Quick-fix, Solemn Vow
Sniper with Classic, Piss, Bushwhacka

Quote:
Are you running TF2Attributes?
Nope, perhaps we have a winner I'll install it now.
Alright, copied the .sp, .smx & .inc into their directories & restarted but still t-pose central for now.

Quote:
Are you wanting to change player cosmetics?
Nah, I /did/ want to make all of blue team robots and disable/reduce cosmetics but after looking into it it seemed like a major hassle.
I guess I wouldn't mind being able to so some of that but I didn't think of doing that with this plugin.
Attached Thumbnails
Click image for larger version

Name:	simpler tf2 v0.4.png
Views:	51
Size:	85.3 KB
ID:	188626  
JeremWatts is offline
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 04-07-2021 , 12:32   Re: Need help setting up a loadout plugin that piggybacks [TF2items] Give Weapon plug
Reply With Quote #4

I don't believe it is your config text file since you aren't using any custom weapons at all yet.

I tested your code without any edits on my server and it runs as intended. All scouts receive a Syringe Gun and Medigun. There is no T-pose.

I suspect there is a problem with your tf2items or tf2items_giveweapon plugin. You can test it by trying to give yourself a weapon. Try giving yourself a rocketlauncher by typing: !gimme 18

You can also type: sm plugins list
That will show you what plugins are running, and if if any plugins failed to load properly. You can also check your error log in: /tf/addons/sourcemod/logs/

Alternatively, you could just build the plugin without having a requirement to use tf2items or tf2items_giveweapon. See attached plugin for working example of Scout and Medic without tf2items.
Attached Files
File Type: sp Get Plugin or Get Source (simpletf2.sp - 116 views - 3.1 KB)

Last edited by PC Gamer; 04-07-2021 at 13:30.
PC Gamer is offline
JeremWatts
Junior Member
Join Date: Apr 2021
Old 04-08-2021 , 04:00   Re: Need help setting up a loadout plugin that piggybacks [TF2items] Give Weapon plug
Reply With Quote #5

oh, here we go
Code:
Unkown command: !gimme
Got that, did the tf2items_allow_gimme 1 command in the server before that too. But this got me thinking so I scrolled around and found this in the console (see attatched)

That item code doesn't appear in the pyrobattle.sp anymore and i doubt it's referenced in the smx so I reckon you're right about it not being the pyrobattle.sp

For good measure in case something broke while I wasn't looking I ran sm plugins list again. Everything's working as far as I can tell.

In case it's an option I want to mention at this point I'm happy to give you the login details to my server and just send you money through paypal to help. I've made a mess and I feel obliged to compensate you.
Attached Thumbnails
Click image for larger version

Name:	8-4-21.png
Views:	66
Size:	29.4 KB
ID:	188635  
JeremWatts is offline
JeremWatts
Junior Member
Join Date: Apr 2021
Old 04-08-2021 , 07:34   Re: Need help setting up a loadout plugin that piggybacks [TF2items] Give Weapon plug
Reply With Quote #6

WAIT NO YOUR SCRIPT WORKS

alright yeah idk what was going wrong with tf2items but this is just as good, gdi I could kiss you man. Thank you so much lol - ignore my last post.

I've added the other classes to the code

Code:
{
	int client = GetClientOfUserId(GetEventInt(event, "userid"));
	
	if (TF2_GetPlayerClass(client) == TFClass_Scout)
	{
		TF2_RemoveWeaponSlot(client, 0);
		CreateWeapon(client, "tf_weapon_scattergun", 1103, 6);
		
		TF2_RemoveWeaponSlot(client, 1);		
		CreateWeapon(client, "tf_weapon_lunchbox_drink", 163, 6);
		
		TF2_RemoveWeaponSlot(client, 2);		
		CreateWeapon(client, "tf_weapon_bat", 0, 6);
	}

	if (TF2_GetPlayerClass(client) == TFClass_Medic)
	{
		TF2_RemoveWeaponSlot(client, 0);
		CreateWeapon(client, "tf_weapon_shotgun_primary", 9, 6);
		
		TF2_RemoveWeaponSlot(client, 1);		
		CreateWeapon(client, "tf_weapon_medigun", 411, 6);
		
		TF2_RemoveWeaponSlot(client, 2);		
		CreateWeapon(client, "tf_weapon_bonesaw", 413, 6);
	}

	if (TF2_GetPlayerClass(client) == TFClass_Heavy)
	{
		TF2_RemoveWeaponSlot(client, 0);
		CreateWeapon(client, "tf_weapon_rocketlauncher", 414, 6);
		
		TF2_RemoveWeaponSlot(client, 1);		
		CreateWeapon(client, "tf_weapon_shotgun", 425, 6);
		
		TF2_RemoveWeaponSlot(client, 2);		
		CreateWeapon(client, "tf_weapon_stickbomb", 307, 6);
	}
	
	if (TF2_GetPlayerClass(client) == TFClass_Engineer)
	{
		TF2_RemoveWeaponSlot(client, 0);
		CreateWeapon(client, "tf_weapon_shotgun", 1153, 6);
		
		TF2_RemoveWeaponSlot(client, 1);		
		CreateWeapon(client, "tf_weapon_revolver", 61, 6);
		
		TF2_RemoveWeaponSlot(client, 2);		
		CreateWeapon(client, "tf_weapon_robot_arm", 142, 6);
	}
	
	if (TF2_GetPlayerClass(client) == TFClass_Sniper)
	{
		TF2_RemoveWeaponSlot(client, 0);
		CreateWeapon(client, "tf_weapon_sniperrifle_classic", 1098, 6);
		
		TF2_RemoveWeaponSlot(client, 1);		
		CreateWeapon(client, "tf_weapon_jar", 58, 6);
		
		TF2_RemoveWeaponSlot(client, 2);		
		CreateWeapon(client, "tf_weapon_club", 232, 6);
	}
}
With this code the scout and medic are still fine but, what do I change to get the other 3 classes working?

Is there anyway to change attributes with this plugin? If not all good, i'll cope. If so then how would i reduce the clip on the liberty launcher to 2 and increase the movespeed when the cabertoss is active?
JeremWatts is offline
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 04-08-2021 , 15:06   Re: Need help setting up a loadout plugin that piggybacks [TF2items] Give Weapon plug
Reply With Quote #7

The easiest way to change attributes is to install TF2Attributes. Once you do that you can use the plugin attached to this post for increased speed while caber is active and reduced ammo for rocketlauncher.

I would've had this done sooner but changing the rocketlauncher ammo for the Heavy proved difficult. It appears that giving weapons to other classes (such as rocketlauncher to Heavy) results in the weapon having the default weapon ammo (such as 200 ammo for minigun applied to rocketlauncher).

Anyway, enjoy the plugin. I hope you have a great Birthday!
Attached Files
File Type: sp Get Plugin or Get Source (simpletf2.sp - 74 views - 4.7 KB)
File Type: smx simpletf2.smx (5.7 KB, 66 views)
PC Gamer is offline
JeremWatts
Junior Member
Join Date: Apr 2021
Old 04-08-2021 , 20:29   Re: Need help setting up a loadout plugin that piggybacks [TF2items] Give Weapon plug
Reply With Quote #8

Perfection dude. Couple of randoms hopped on my server and helped me test balance and it's actually pretty damn good.

Thanks again, keep safe and all that.
JeremWatts is offline
oqyh
Senior Member
Join Date: May 2019
Location: United Arab Emirates
Old 04-09-2021 , 15:58   Re: Need help setting up a loadout plugin that piggybacks [TF2items] Give Weapon plug
Reply With Quote #9

Quote:
Originally Posted by JeremWatts View Post
So

I have the [TF2items] Give Weapon plugin working to my knowledge.

Ultimately my goal is to setup a plugin before the end of the month for my birthday that will make tf2 more accessible for noobs by dictating loadouts for specific classes.

My issue is that I am not familiar with coding and can only either get every player to be completely weaponless or I get the weapons copying themselves and crashing the server via entity limit.

I'll attach the files for my last attempt, yet another t-pose party.

The code i was trying to Frankenstein came from the first two pages of this thread https://forums.alliedmods.net/showthread.php?t=203225

If i can see an example of just one working weapon I feel like i can figure out the rest from there.

This Working Spawn Giver loadout

https://github.com/Hartmannq/SpawnWeapon
__________________
.:[ >> My Plugins << ]:.

My discord : oqyh
oqyh is offline
JeremWatts
Junior Member
Join Date: Apr 2021
Old 04-11-2021 , 19:27   Re: Need help setting up a loadout plugin that piggybacks [TF2items] Give Weapon plug
Reply With Quote #10

Quote:
Originally Posted by oqyh View Post
This Working Spawn Giver loadout

https://github.com/Hartmannq/SpawnWeapon
Doesn't look related to tf2
JeremWatts 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 11:19.


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