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

Tweaking the NoUnlock plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mr. Man
Veteran Member
Join Date: Mar 2011
Location: Huh?
Old 03-13-2013 , 13:13   Tweaking the NoUnlock plugin
Reply With Quote #1

Hello all,

I am currently looking at the NoUnlock plugin here and want a version where users can only use strange weapons. However, the following script only allow strange weapons and nothing else. I want to configure it so players can use strange weapons and cosmetics.

Here's the snippet:

PHP Code:
public OnPluginStart() {
    
CreateConVar("sm_tonlystrangepls_version"VERSION"[TF2] tOnlyStrangePls"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD);
}

public 
TF2Items_OnGiveNamedItem_Post(clientString:classname[], iItemDefinitionIndexitemLevelitemQualityentityIndex) {
    if(
itemQuality != QUALITY_STRANGE) {
        new 
Handle:hTrie CreateTrie();
        
SetTrieValue(hTrie"client"client);
        
SetTrieValue(hTrie"entityIndex"entityIndex);

        
CreateTimer(0.01Timer_ReplaceWeaponhTrie);

        return;
    }
}

public 
Action:Timer_ReplaceWeapon(Handle:timerany:hTrie) {
    new 
entityIndex = -1;
    
GetTrieValue(hTrie"entityIndex"entityIndex);

    new 
client = -1;
    
GetTrieValue(hTrie"client"client);

    
CloseHandle(hTrie);

    if(
IsValidEntity(entityIndex)) {
        
RemovePlayerItem(cliententityIndex);
        
AcceptEntityInput(entityIndex"Kill");
    }


Last edited by Mr. Man; 03-13-2013 at 16:27.
Mr. Man is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 03-14-2013 , 04:20   Re: Tweaking the NoUnlock plugin
Reply With Quote #2

See this post by Thrawn2 about how to get an item's slot.

Unlocks are slots 0-6
Cosmetic items are slots 7-8
Action items are slot 9
bl4nk is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 03-14-2013 , 14:04   Re: Tweaking the NoUnlock plugin
Reply With Quote #3

Quote:
Originally Posted by bl4nk View Post
See this post by Thrawn2 about how to get an item's slot.

Unlocks are slots 0-6
Cosmetic items are slots 7-8
Action items are slot 9
I'm surprised slot 6 can be used for unlocks, as the class with the most slots (Engineer) is still only using 0-5 (0 = primary, 1 = secondary, 2 = melee, 3 = Construction Tool (pda), 4 = Destruction Tool (pda2), 5 = Builder (building); Construciton and Destruction tools don't work if this isn't present
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 03-14-2013 at 14:05.
Powerlord is offline
Reply



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 10:55.


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