PDA

View Full Version : UnlockBlock - Disable unlock weapons and cosmetic items.


asherkin
12-13-2010, 09:39
It's dead, don't even try and use it.
------------------------------------------

Quite a simple one this time, provides three convars.


tf_allow_unlocks - Unlockable Weapons.
tf_allow_cosmetics - Hats and Misc Items.
tf_allow_action_items - Action Items.


All convars default to 1, just set to 0 to block the items.

I made this due to being unhappy with how the current plugins that do this work, this ext actually makes it seem to the server like the client has unequipped the item.

Download: 93798

Source Code (http://hg.limetech.org/projects/vanillaweps_ext/) | Build Status (http://users.alliedmods.net:8013/waterfall?builder=unlockblock-linux&builder=unlockblock-win32) | Snapshots (http://vphysics.limetech.org/?project=vanillaweps)

FaTony
12-13-2010, 10:12
Nice one.

Matheus28
12-13-2010, 11:53
Do set hats count as cosmetic?

asherkin
12-13-2010, 11:54
Do set hats count as cosmetic?
Yes.
It's basically hats+misc items.

Matheus28
12-13-2010, 11:58
What about a cvar for set hats?

asherkin
12-13-2010, 12:12
Fixed the Linux version, had a typo in the gamedata.

What about a cvar for set hats?
I'll think about the best way to implement this. Do note that this doesn't just make the hats invisible, the players will not get the set bonuses.

Mecha the Slag
12-17-2010, 07:06
Neat, this means I won't have to bother with an advanced plugin. Good job!

Flyflo
12-17-2010, 07:57
On my server, the extension works great (no unlocks and no cosmetics) except for the spy's watches, am I the only one ?

Server running on linux and SM 1.4.0 rev3165.

xomp
12-23-2010, 01:10
Haha bro, you have answered the whine of so many players. Good work!

Jiffs
01-14-2011, 14:48
Great plugin, but

On my server, the extension works great (no unlocks and no cosmetics) except for the spy's watches, am I the only one ?

Server running on linux and SM 1.4.0 rev3165.

I too have this problem. asherkin, please fix this.

asherkin
01-14-2011, 16:21
Considering it's quite a valid bug, I'm glad it got reported.
The original report just got forgotten under a mountain of IRL stuff.

Jiffs
01-15-2011, 13:54
Hi again.

1) I found a new bug. On the players displayed a medal "Grizzled Veteran" (http://wiki.teamfortress.com/wiki/Grizzled_Veteran). Mercenary (http://wiki.teamfortress.com/wiki/Mercenary) and Soldier of Fortune (http://wiki.teamfortress.com/wiki/Soldier_of_Fortune) - 100% is not visible, but Primeval Warrior (http://wiki.teamfortress.com/wiki/Primeval_Warrior) medal I could not check.

http://img198.**************/img198/9332/cpgravelpit0004s.th.jpg (http://img198.**************/i/cpgravelpit0004s.jpg/) http://img573.**************/img573/2941/cpwell0002.th.jpg (http://img573.**************/i/cpwell0002.jpg/)

2) I'm not sure this is a bug or not, but after the death demomen with him falls Scottish Resistance (http://wiki.teamfortress.com/wiki/Scottish_Resistance). With other classes of such problems are not found.

http://img267.**************/img267/7647/cpgravelpit0006.th.jpg (http://img267.**************/i/cpgravelpit0006.jpg/)

3) And again, I'm not sure this is a bug or not, but during the observation of the players, they can see the icons duel (http://wiki.teamfortress.com/wiki/Dueling_Mini-Game) and noise maker (http://wiki.teamfortress.com/wiki/Noise_Maker).

http://img96.**************/img96/402/cpwell0003.th.jpg (http://img96.**************/i/cpwell0003.jpg/) http://img268.**************/img268/6984/cpbadlands0008w.th.jpg (http://img268.**************/i/cpbadlands0008w.jpg/)

Leonardo
01-15-2011, 14:06
This extension not removing weapons, just replaces it with standard.

Mecha the Slag
01-15-2011, 15:39
2) I'm not sure this is a bug or not, but after the death demomen with him falls Scottish Resistance (http://wiki.teamfortress.com/wiki/Scottish_Resistance). With other classes of such problems are not found.

http://img267.**************/img267/7647/cpgravelpit0006.th.jpg (http://img267.**************/i/cpgravelpit0006.jpg/)

That's a bug in TF2. It will happen on every server.

asherkin
01-15-2011, 16:28
Updated to fix some items not being reverted.

Leonardo
01-15-2011, 16:49
nya! :3

Zephyrus
01-16-2011, 17:45
i think deleting hats and weapons from the items.txt is an easier way to do this :)

Boylee
01-27-2011, 19:33
Very nice plugin, tried this after trying tNoUnlocksPls v0.0.9 and I have to say it was much easier. I might miss the ability to be able to be able to toggle some weapons on and off but for sheer ease of use this takes the cake.

Thank you sir, I salute you.

noodleboy347
01-30-2011, 15:44
This should add a tag to the server or something so we can find good servers (or is there already a tag?)

gnumsploitz
04-15-2011, 22:36
Looks like the TF2 update today broke something with this extension?

22:36:02 File: vanillaweps.ext.2.ep2v.so
Loaded: No (/opt/tf2/orangebox/tf/addons/sourcemod/extensions/vanillaweps.ext.2.ep2v.so: undefined symbol: _Unwind_Resume)

Edit: The same error has been posted and fixed in this extensions' thread: http://forums.alliedmods.net/showpost.php?p=1450961&postcount=12

Cuz
04-19-2011, 21:40
asherkin is it "Offsets" or a update we need ?

gnumsploitz
04-20-2011, 03:42
Perhaps pheadxdll can shed some light with the method he used to update/fix his fire huntsman in the air extension.

asherkin
04-20-2011, 03:44
They are totally different, the undefined symbol error affected all C++ plugins on Linux.
The reason this hasn't been updated yet has nothing to do with that.

Quite a bit changed with the item system, and stuff in this extension needs rewriting.

IRJustman
05-21-2011, 17:20
Was looking for something to disable a very specific action item (the dueling minigame) and this item comes the closest to it. Is there a way to make this mod only block certain equipables or is there something already out there that I can use so neither this gentlemen nor I have to reinvent the wheel?

Thanks!

--IJ.

saiyaboy
05-30-2011, 04:23
The plugin is broken :(

[SM] Unable to load extension "vanillaweps.ext": /home/srv_1303/orangebox/tf/addons/sourcemod/extensions/vanillaweps.ext.2.ep2v.so: undefined symbol: _Unwind_Resume

snowyiet
06-05-2011, 22:11
Please fix this. I don't like hosting a server with unlocks. Thank you.

Gahruff
06-28-2011, 07:00
So is this plugin up to date? or is it going to be made up to date?

Thanks

eraserhead
07-20-2011, 20:56
Would be awesome if this plugin could be fixed. Anyone know of an alternative?

asherkin
07-23-2011, 13:23
Try these new builds: http://vphysics.limetech.org/?project=vanillaweps (latest at the top).
Windows seems to work, Linux was done with guesswork and needs someone to test it.

eraserhead
07-25-2011, 00:56
Just tested it on our private linux server and it works fine. You are the king Asherkin!!! :)

Gahruff
07-31-2011, 06:58
Works like a charm, thank you so so much [:

Thrawn2
08-06-2011, 07:12
Howdy!
Can you please add a forward like
forward Action:UnlockBlock_ItemHasBeenUpdated(iQualit y, iIDI);

I could switch tNoUnlocksPls to use this then, making everything so much nicer.
I'd really appreciate it.

Proposed patch is attached.

edit: the iQuality would be useful to block strange weapons.
edit 2: oh, adding iClient would be useful too ;)

Cuz
08-07-2011, 21:32
Thank You asherkin ! http://www.olderthandos.us/phpBB3/images/smilies/we_are_not_worthy.gif

asherkin
08-12-2011, 13:03
Yay an update!

Adds a forward for plugins to use and moved the logic for the 3 convars that were provided to a separate plugin.

Thrawn2
08-12-2011, 13:07
you sire! are awesome. donated.

Datenkralle
08-22-2011, 13:57
It not works for linux:
<Failed> "UnlockBlock" (2.0.0) by Asher "asherkin" Baker

asherkin
08-22-2011, 13:58
It not works for linux:

Without the actual error message I can't even begin to help you.

Datenkralle
08-22-2011, 14:25
Ok, i used now your Snapshotversion: 1.0.1-hg13.tar.gz (http://vphysics.limetech.org/vanillaweps-1.0.1-hg13-linux.tar.gz) for linux.
And it works. Something its wrong with you "download - version" (first linked).

asherkin
08-22-2011, 14:37
Ok, i used now your Snapshotversion: 1.0.1-hg13.tar.gz (http://vphysics.limetech.org/vanillaweps-1.0.1-hg13-linux.tar.gz) for linux.
And it works. Something its wrong with you "download - version" (first linked).

They contain the exact same binary since there haven't been any code changes since the last release, the release zip is just both platform's snapshots packaged together along with a compiled copy of the plugin.

asherkin
10-13-2011, 20:53
Updated for today's update (gamedata change only).

asherkin
10-14-2011, 14:14
Sorry guys, last update didn't quite do it, binaries have changed as well now.

1nsane
10-20-2011, 10:26
Crashes on linux




#0 0xf392d3ee in CTFDynamicAssetSystem::FrameUpdatePreEntityTh ink() ()
from /home/srcds/orangebox/tf/bin/server.so
#1 0xf3893c9f in IGameSystem::FrameUpdatePreEntityThinkAllSyst ems() ()
from /home/srcds/orangebox/tf/bin/server.so
#2 0xf3c960ff in CServerGameDLL::GameFrame(bool) ()
from /home/srcds/orangebox/tf/bin/server.so
#3 0xee52278f in __SourceHook_FHCls_IServerGameDLLGameFramefal se::Func(bool)
() from /home/srcds/orangebox/tf/addons/sourcemod/bin/sourcemod.2.ep2v.so
#4 0xf6c6cd3c in CServerPlugin::GameFrame(bool) ()
from /home/srcds/orangebox/bin/engine.so
#5 0xf6c67a20 in SV_Think(bool) () from /home/srcds/orangebox/bin/engine.so
#6 0xf6c68c30 in SV_Frame(bool) () from /home/srcds/orangebox/bin/engine.so
#7 0xf6bc27dc in _Host_RunFrame_Server(bool) ()
from /home/srcds/orangebox/bin/engine.so
#8 0xf6bc355a in _Host_RunFrame(float) ()
from /home/srcds/orangebox/bin/engine.so
#9 0xf6bceee2 in CHostState::FrameUpdate(float) ()
from /home/srcds/orangebox/bin/engine.so
#10 0xf6bcf228 in HostState_Frame(float) ()
from /home/srcds/orangebox/bin/engine.so
#11 0xf6c844b0 in CEngine::Frame() () from /home/srcds/orangebox/bin/engine.so
#12 0xf6c804da in CDedicatedServerAPI::RunFrame() ()
from /home/srcds/orangebox/bin/engine.so

snowyiet
10-20-2011, 21:24
The new update broke this.

rallfo
10-21-2011, 11:11
The new update broke this.
Any news on a fix/workaround?

Screaming_Alpha
10-27-2011, 17:49
Broken for me as well, I'm sure Asherkin will get to this one soon. I have a feeling, with the last update, he has been very busy fixing a lot of plugins/ext. for us.
Thank you Asherkin for all that you do.

atticusmas
11-02-2011, 10:56
What does this do?

napalm00
11-02-2011, 10:59
What does this do?

Read the first post?

asherkin
11-02-2011, 10:59
What does this do?

At the moment? Not a lot.

noblehan1
11-02-2011, 11:41
how many wait for update This Plugins? (TωT.) I can't wait for this anymore..;;; i have to apply the tNoUnlocksPls plugins at MGE, Soap TF2DM Server.;;; Many My Country MGE User Waiting For This... (TωT.)

napalm00
11-02-2011, 12:08
how many wait for update This Plugins? (TωT.) I can't wait for this anymore..;;; i have to apply the tNoUnlocksPls plugins at MGE, Soap TF2DM Server.;;; Many My Country MGE User Waiting For This... (TωT.)

It's a magical number that gets bigger with every dumb post posted in this thread, and smaller with each donation (http://limetech.org/donate/) and fennec picture sent to asherkin.

WebNoob
11-08-2011, 08:50
Ok....is there anything we can do to get this fixed? Is there anyone willing to take this on for a fee? (although, I sent a $25 donation the author's way last week in hopes that would be enough to get us an update, but he must be busy with other things)

If a competent coder wants to get this fixed for a (reasonable) fee, please contact me.

asherkin
11-08-2011, 08:50
Ok....is there anything we can do to get this fixed? Is there anyone willing to take this on for a fee? (although, I sent a $25 donation the author's way last week in hopes that would be enough to get us an update, but he must be busy with other things)

If a competent coder wants to get this fixed for a (reasonable) fee, please contact me.

It's a work in progress, the whole thing needs to be rewritten.

noblehan1
11-13-2011, 02:36
I can't wait This plugin updating anymore.;;;; currently added the new promotion items.;;;; i want to update tihs plugins and tNoUnlocksPls
plugins.;;; damn it! damn it, damn it, damn it!

WebNoob
11-14-2011, 16:57
I can't wait This plugin updating anymore.;;;; currently added the new promotion items.;;;; i want to update tihs plugins and tNoUnlocksPls
plugins.;;; damn it! damn it, damn it, damn it!

I hear ya - but these guys have lives too. Having to re-code everything everytime Valve decides to change something can't be fun - especially when there are probably new projects they'd like to be working on, instead of going back to fix something that was working fine before.

I'm sure it'll get done soon - asherkin's one of the good guys. :up:

asherkin
11-26-2011, 19:20
Ugh, fixing this is painful, just letting you guys know it's still on my to-do list.
Thrawn: Unfortunately, I'm going to have to break the API I added, Valve's new system is considerably more complex. Although, if I think of a non-breaking way, I'll use it, might need to call the forward multiple times per-item or something.

Thrawn2
11-26-2011, 20:52
No worries. Since i've split all the different methods used to strip/replace weapons into different modules, these are pretty easy to maintain. So don't wrap your head around breaking the api :wink:

E.g. the vanilla-weps module currently looks like this:

...blabla...
public bool:OnClientCanUseItem(iClient, iItemDefinitionIndex, slot, iQuality) {
if(!g_bCoreAvailable || !tNUP_IsEnabled() || !tNUP_UseThisModule())
return true;

if(tNUP_BlockStrangeWeapons() && iQuality == QUALITY_STRANGE) {
tNUP_AnnounceBlock(iClient, iItemDefinitionIndex);
return false;
}

if(tNUP_BlockSetHats() && tNUP_IsSetHatAndShouldBeBlocked(iItemDefiniti onIndex)) {
tNUP_AnnounceBlock(iClient, iItemDefinitionIndex);
return false;
}

if(tNUP_IsItemBlocked(iItemDefinitionIndex)) {
tNUP_AnnounceBlock(iClient, iItemDefinitionIndex);
return false;
}

return true;
}

Riosha
12-16-2011, 13:03
My server crashed, when level changed because of this plugin, but I want to have it on my server. Anyone know, what is the problem with it?

asherkin
12-16-2011, 18:15
This extension isn't currently supported.

Riosha
12-16-2011, 20:44
This extension isn't currently supported.

You mean, I can't use this plugin? :<

404UserNotFound
12-27-2011, 14:53
So, how goes the rewrite? Any progress?

I had heard something about a CVAR in TF2 that when set, blocks all unlockable weapons from being used.

I had also noticed that in the coding of VS Saxton Hale, the plugin uses some switch functions to change attributes on certain weapons that a player has equipped.

This is the "MakeNoHale" function from the VS Saxton Hale plugin. I've commented out some of the Hale-related stuff that we don't need to worry about.

public Action:MakeNoHale(Handle:hTimer,any:clientid)
{
new client=GetClientOfUserId(clientid);
if (!IsValidClient(client) || !IsPlayerAlive(client)) /*|| VSHRoundState==2 || client==Hale)*/
{
return Plugin_Continue;
}

/* SetVariantString("");
AcceptEntityInput(client, "SetCustomModel");

ChangeClientTeam(client, Team);
SetEntityRenderColor(client, 255, 255, 255, 255);
if (!VSHRoundState)
HelpPanel2(client); */

new weapon=GetPlayerWeaponSlot(client, 0);
new index = -1;
if (IsValidEdict(weapon) && (weapon>0))
{
index=GetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex");
switch (index)
{
case 41:
{
TF2_RemoveWeaponSlot(client, 0);
weapon = SpawnWeapon(client,"tf_weapon_minigun",15,1,0,"");
}
case 402:
{
TF2_RemoveWeaponSlot(client, 0);
SpawnWeapon(client,"tf_weapon_sniperrifle",14,1,0,"");
}
case 237:
{
TF2_RemoveWeaponSlot(client, 0);
weapon = SpawnWeapon(client,"tf_weapon_rocketlauncher",18,1,0,"");
SetAmmo(client, 0, 20);
}
case 17, 204, 36, 412:
{
TF2_RemoveWeaponSlot(client, 0);
SpawnWeapon(client,"tf_weapon_syringegun_medic",17,1,10,"17 ; 0.05 ; 144 ; 1");
}
}
}
weapon=GetPlayerWeaponSlot(client, 1);
if (weapon && IsValidEdict(weapon))
{
index=GetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex");
switch (index)
{
case 226:
{
TF2_RemoveWeaponSlot(client, 1);
weapon = SpawnWeapon(client,"tf_weapon_shotgun_soldier",10,1,0,"");
}
case 57, 58, 231:
{
TF2_RemoveWeaponSlot(client, 1);
weapon = SpawnWeapon(client,"tf_weapon_smg",16,1,0,"");
}
case 265:
{
TF2_RemoveWeaponSlot(client, 1);
weapon = SpawnWeapon(client,"tf_weapon_pipebomblauncher",20,1,0,"");
SetAmmo(client,1,24);
}
case 39, 351:
{
TF2_RemoveWeaponSlot(client, 1);
weapon = SpawnWeapon(client, "tf_weapon_flaregun", 39, 5, 10, "25 ; 0.5 ; 207 ; 1.33 ; 144 ; 1.0 ; 58 ; 5.0");
}
}
}
if (FindPlayerBack(client))
{
RemovePlayerBack(client);
weapon = SpawnWeapon(client,"tf_weapon_smg",16,1,0,"");
}
weapon=GetPlayerWeaponSlot(client, 2);
if (weapon && IsValidEdict(weapon))
{
index=GetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex");
switch (index)
{
case 331:
{
TF2_RemoveWeaponSlot(client,2);
weapon = SpawnWeapon(client,"tf_weapon_fists",195,1,6,"");
}
case 355:
{
TF2_RemoveWeaponSlot(client, 2);
weapon = SpawnWeapon(client,"tf_weapon_bat",0,1,0,"");
}
case 357:
{
TF2_RemoveWeaponSlot(client,2);
if (TF2_GetPlayerClass(client) == TFClass_DemoMan)
weapon = SpawnWeapon(client,"tf_weapon_sword",327,1,6,"202 ; 0.5 ; 125 ; -15");
else
weapon = SpawnWeapon(client,"tf_weapon_shovel",128,1,6,"115 ; 1");
}
}
}
weapon=GetPlayerWeaponSlot(client, 4);
if (weapon > 0 && IsValidEntity(weapon) && GetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex") == 60)
{
TF2_RemoveWeaponSlot(client,4);
weapon = SpawnWeapon(client,"tf_weapon_invis",297,1,6,"");
}
// if (TF2_GetPlayerClass(client) == TFClass_Sniper)
// weapon = SpawnWeapon(client,"tf_weapon_smg",203,100,2,"");
if (TF2_GetPlayerClass(client) == TFClass_Medic)
{
TF2_RemoveWeaponSlot(client, 1);
weapon = SpawnWeapon(client,"tf_weapon_medigun",35,5,10,"10 ; 1.25"); //200 ; 1 for area of effect healing
SetEntPropFloat(weapon, Prop_Send, "m_flChargeLevel",0.41);
}
return Plugin_Continue;
}Could a plugin that uses similar code be created to block unlockable weapons? What I'm thinking in my head right now is something like this:

1. Hook into "player_spawn" and "post_inventory_application".

2. Add in the proper code similar to what I posted above, to both events, then set up the coding to switch weapons if the ID of the weapon is the ID of any and all unlockable weapons. This of course would have be organized by weapon slot, and each unlockable would need it's own switch function.

3. Set the switch function for each unlockable to remove said unlockable and spawn the equivalent Stock weapon for that slot (i.e. replace the Winger with the Scout's Stock Pistol).

It'd be a lot of coding, but I think it could be done. Hell, I could probably rig something up in a couple of hours.

jasonfrog
04-27-2012, 05:21
Any chance of resurrecting this fine extension?