AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Tweaking the NoUnlock plugin (https://forums.alliedmods.net/showthread.php?t=210701)

Mr. Man 03-13-2013 13:13

Tweaking the NoUnlock plugin
 
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");
    }



bl4nk 03-14-2013 04:20

Re: Tweaking the NoUnlock plugin
 
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

Powerlord 03-14-2013 14:04

Re: Tweaking the NoUnlock plugin
 
Quote:

Originally Posted by bl4nk (Post 1912396)
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


All times are GMT -4. The time now is 02:37.

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