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

[l4d2] single pickup weapons


Post New Thread Reply   
 
Thread Tools Display Modes
GanjaStar
Senior Member
Join Date: Jun 2009
Old 11-20-2010 , 17:01   Re: [l4d2] single pickup weapons
Reply With Quote #11

i lvoe you, i really do.

your outside shell can't hide your good heart
GanjaStar is offline
AtomicStryker
Veteran Member
Join Date: Apr 2009
Location: Teutonia!!
Old 11-20-2010 , 17:58   Re: [l4d2] single pickup weapons
Reply With Quote #12

You dont need more strings. I used StrContains, not StrEqual, which means weapon_sniper and weapon_rifle cover all their parent-strings allready
AtomicStryker is offline
GanjaStar
Senior Member
Join Date: Jun 2009
Old 11-20-2010 , 18:16   Re: [l4d2] single pickup weapons
Reply With Quote #13

and my modified verison didnt work. will try your now tyo see if i maybe did something wrong.


could it be that static weapons removal lines mess with this? again with the quiestons. dont aswer if you can't be arsed


trying out the original version by you now.
GanjaStar is offline
GanjaStar
Senior Member
Join Date: Jun 2009
Old 11-20-2010 , 19:04   Re: [l4d2] single pickup weapons
Reply With Quote #14

your version still doesn't work unfortunately.

im only using srs and your weapon unlock modified version.

nothing in the error logs.

i have no idea why it doesnt work. my srs settings are default for weapons, except i remove the static spawns, by pasting the text above the dynamic spawns, as you said should be done.
GanjaStar is offline
GanjaStar
Senior Member
Join Date: Jun 2009
Old 11-20-2010 , 20:50   Re: [l4d2] single pickup weapons
Reply With Quote #15

My last update until i see if you have more time for this atomicstryker.


your version of the plugin doesn't work even when i disable srs on my server. sourcemod and metamod both latest 1.4 and 1.9 snapshots.

the version posted by xjr15 works without srs mod and doesnt work with srs mod.
GanjaStar is offline
AtomicStryker
Veteran Member
Join Date: Apr 2009
Location: Teutonia!!
Old 11-21-2010 , 06:45   Re: [l4d2] single pickup weapons
Reply With Quote #16

PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>

static const String:t2strings[][] = {
                                    
"weapon_autoshotgun",
                                    
"weapon_shotgun_spas",
                                    
"weapon_hunting_rifle",
                                    
"weapon_sniper",
                                    
"weapon_rifle"
                                    
};
                                    
static const        
t2weaponIDs[] = {
                                    
4,
                                    
5,
                                    
6,
                                    
9,
                                    
10,
                                    
11,
                                    
26,
                                    
34,
                                    
35,
                                    
36
                                    
};

/*
#define PISTOL                     1
#define SMG                     2
#define PUMPSHOTGUN             3
#define AUTOSHOTGUN             4
#define RIFLE                     5
#define HUNTING_RIFLE             6
#define SMG_SILENCED             7
#define SHOTGUN_CHROME             8
#define RIFLE_DESERT             9
#define SNIPER_MILITARY         10
#define SHOTGUN_SPAS             11
#define MOLOTOV                 13
#define PIPE_BOMB                 14
#define VOMITJAR                 25
#define RIFLE_AK47                 26
#define PISTOL_MAGNUM             32
#define SMG_MP5                 33
#define RIFLE_SG552             34
#define SNIPER_AWP                 35
#define SNIPER_SCOUT             36
*/

static const String:GENERIC_WEAPON[]         = "weapon_spawn";
static const 
String:WEAPON_ID_ENTPROP[]        = "m_weaponID";


public 
OnPluginStart()
{
    
HookEvent("player_use"Event_PlayerUse);
}

public 
Action:Event_PlayerUse(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
item GetEventInt(event"targetid");
    
    if (
IsValidEdict(item)
    && 
IsT2Gun(item))
    {
        
RemoveEdict(item);
    }
}

static 
bool:IsT2Gun(item)
{
    
decl String:itemname[64];
    
GetEdictClassname(itemitemnamesizeof(itemname));
    
    if (
StrEqual(itemnameGENERIC_WEAPONfalse))
    {
        new 
gunid GetEntProp(itemProp_SendWEAPON_ID_ENTPROP);
        
        for (new 
0sizeof(t2weaponIDs); x++)
        {
            if (
gunid == t2weaponIDs[x])
            {
                return 
true;
            }
        }
        
        return 
false;
    }
    
    for (new 
0sizeof(t2strings); i++)
    {
        if (
StrContains(t2strings[i], itemnamefalse) != -1)
        {
            return 
true;
        }
    }
    
    return 
false;

You expected me to playtest this?! I had a string pair the wrong way around. For an added bonus ive put the weapon_spawn stuff into it now aswell, which covers saferooms etc
Attached Files
File Type: sp Get Plugin or Get Source (l4d2_singlet2guns.sp - 1050 views - 1.9 KB)
AtomicStryker is offline
GanjaStar
Senior Member
Join Date: Jun 2009
Old 11-21-2010 , 08:31   Re: [l4d2] single pickup weapons
Reply With Quote #17

Quote:
Originally Posted by AtomicStryker View Post
You expected me to playtest this?
of course not : that's my part of the job, as with srs updates, i will always test it as soon as posible ;)

thats the least i could do thx again, i owe you, and if you do want a server, or ever need one for something, let me know. i feel bad not being able to repay you.


testing this in a few.
GanjaStar is offline
GanjaStar
Senior Member
Join Date: Jun 2009
Old 11-21-2010 , 09:34   Re: [l4d2] single pickup weapons
Reply With Quote #18

works great.

will you post it in new plugins section, or should i do it?
GanjaStar is offline
AtomicStryker
Veteran Member
Join Date: Apr 2009
Location: Teutonia!!
Old 01-11-2011 , 06:55   Re: [l4d2] single pickup weapons
Reply With Quote #19

Updated version, now excludes second-hand weapons

PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>

static const String:t2strings[][] = {
                                    
"weapon_autoshotgun",
                                    
"weapon_shotgun_spas",
                                    
"weapon_hunting_rifle",
                                    
"weapon_sniper",
                                    
"weapon_rifle"
                                    
};
                                    
static const        
t2weaponIDs[] = {
                                    
4,
                                    
5,
                                    
6,
                                    
9,
                                    
10,
                                    
11,
                                    
26,
                                    
34,
                                    
35,
                                    
36
                                    
};

/*
#define PISTOL                     1
#define SMG                     2
#define PUMPSHOTGUN             3
#define AUTOSHOTGUN             4
#define RIFLE                     5
#define HUNTING_RIFLE             6
#define SMG_SILENCED             7
#define SHOTGUN_CHROME             8
#define RIFLE_DESERT             9
#define SNIPER_MILITARY         10
#define SHOTGUN_SPAS             11
#define MOLOTOV                 13
#define PIPE_BOMB                 14
#define VOMITJAR                 25
#define RIFLE_AK47                 26
#define PISTOL_MAGNUM             32
#define SMG_MP5                 33
#define RIFLE_SG552             34
#define SNIPER_AWP                 35
#define SNIPER_SCOUT             36
*/

static const String:GENERIC_WEAPON[]         = "weapon_spawn";
static const 
String:WEAPON_ID_ENTPROP[]        = "m_weaponID";

static        
Handle:DROPPED_GUNS_ARRAY        INVALID_HANDLE;


public 
OnPluginStart()
{
    
HookEvent("player_use"Event_PlayerUse);
    
HookEvent("weapon_drop"Event_WeaponDrop);
    
    
DROPPED_GUNS_ARRAY CreateArray();
}

public 
OnMapStart()
{
    
ClearArray(DROPPED_GUNS_ARRAY);
}

public 
Action:Event_PlayerUse(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
item GetEventInt(event"targetid");
    
    if (
IsValidEdict(item)
    && !
HasBeenDropped(item)
    && 
IsT2Gun(item))
    {
        
RemoveEdict(item);
    }
}

public 
Action:Event_WeaponDrop(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
droppedgun GetEventInt(event"propid");

    
PushArrayCell(DROPPED_GUNS_ARRAYdroppedgun);
}

static 
bool:HasBeenDropped(item)
{
    new 
index FindValueInArray(DROPPED_GUNS_ARRAYitem);

    if (
index != -1)
    {
        
RemoveFromArray(DROPPED_GUNS_ARRAYindex);
        return 
true;
    }
    
    return 
false;
}

static 
bool:IsT2Gun(item)
{
    
decl String:itemname[64];
    
GetEdictClassname(itemitemnamesizeof(itemname));
    
    if (
StrEqual(itemnameGENERIC_WEAPONfalse))
    {
        new 
gunid GetEntProp(itemProp_SendWEAPON_ID_ENTPROP);
        
        for (new 
0sizeof(t2weaponIDs); x++)
        {
            if (
gunid == t2weaponIDs[x])
            {
                return 
true;
            }
        }
        
        return 
false;
    }
    
    for (new 
0sizeof(t2strings); i++)
    {
        if (
StrContains(t2strings[i], itemnamefalse) != -1)
        {
            return 
true;
        }
    }
    
    return 
false;

Attached Files
File Type: sp Get Plugin or Get Source (l4d2_singlet2guns.sp - 923 views - 2.5 KB)
AtomicStryker is offline
GanjaStar
Senior Member
Join Date: Jun 2009
Old 01-11-2011 , 16:11   Re: [l4d2] single pickup weapons
Reply With Quote #20

you have been reading steam forums or just going for perfection

in any case awesome no need to tell you i love you by this point
GanjaStar 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 04:30.


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