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

more than 2 smokegrenades?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
tobi187
Junior Member
Join Date: Jan 2012
Old 01-20-2012 , 17:26   more than 2 smokegrenades?
Reply With Quote #1

Hi out there!

I have s simple question.

In the search function, there wasnt any "real helping" thing.

Ive searched for a way, players get 2 smokegrenades on spawn.
I dont think of giving him one and if he throws it, he gets another.
Im thinking of giving him 2 on spawn. I know theres some way, cause you can do it with eventscripts (Some CSBase entitiy stuff).

Cause im all new, well not entirely new to sourcemod (using it since a few months) my skills arent that great. And even ive nothing found on the wiki at all.

So i ask you, is there a way?

Thx for your help

and im sorry for my baaad english

Last edited by tobi187; 01-20-2012 at 17:28.
tobi187 is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 01-20-2012 , 17:53   Re: more than 2 smokegrenades?
Reply With Quote #2

you want to just "give" them two when they spawn or allow them to buy two?

The CVar has been fixed - ammo_smokegrenade_max 2

That will allow all players the ability to buy two smoke grenades
__________________
View my Plugins | Donate
TnTSCS is offline
tobi187
Junior Member
Join Date: Jan 2012
Old 01-21-2012 , 11:51   Re: more than 2 smokegrenades?
Reply With Quote #3

Thank you

Yes i want to allow them buying 2 smokegrenades.

Is there a possibility to set the cvar per client?

Want to use it for a VIP script

Last edited by tobi187; 01-21-2012 at 11:52.
tobi187 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 01-21-2012 , 13:40   Re: more than 2 smokegrenades?
Reply With Quote #4

Dunno you like this
Lucky I found bl4nk code to look ammo offsets

- Plugin check have server cvar ammo_smokegrenade_max bigger than 1
- Look is player in buyzone
- When try buying smokegrenade, check player ammo offset what he have already
Then check has he admin priviledge allow to buy.

Hope you figure it yourself.

PHP Code:
new ammoOffset;
new 
Handle:ammo_smokegrenade_max INVALID_HANDLE;
new 
bool:enable false;

public 
OnPluginStart()
{
    if((
ammoOffset FindSendPropInfo("CCSPlayer""m_iAmmo")) == -1)
    {
        
SetFailState("Not found offset CCSPlayer:m_iAmmo");
    }

    if((
ammo_smokegrenade_max FindConVar("ammo_smokegrenade_max")) == INVALID_HANDLE)
    {
        
SetFailState("Not found cvar ammo_smokegrenade_max");
    }

    
HookConVarChange(ammo_smokegrenade_maxconvar_change);
    
enable GetConVarInt(ammo_smokegrenade_max) > true:false // If server allow buy more than 1 smokegrenade, plugin start work

    
AddCommandListener(buy"buy"); // Keep look players buy cmd
}

public 
convar_change(Handle:convar, const String:oldValue[], const String:newValue[])
{
    
enable GetConVarInt(ammo_smokegrenade_max) > true:false
}

public 
Action:buy(client, const String:command[], argc)
{
    if(
enable && GetEntProp(clientProp_Send"m_bInBuyZone")) // Players can buy more than 1 smokegrenade and in buyzone (is alive also)
    
{
        new 
String:buffer[15];
        
GetCmdArgString(buffersizeof(buffer));

        if(
StrEqual(buffer"smokegrenade"false))
        {
            
/*
            // thanks blank http://forums.alliedmods.net/showpost.php?p=724943&postcount=8
            for (new i = 0; i < 32; i++)
            {
                PrintToConsole(client, "Offset: %i - Count: %i", i, GetEntData(client, ammoOffset+(i*4)));
            }
            */

            
new has GetEntData(clientammoOffset+(13*4)); // How much smokegrenades player got already

            
if(has >= && !CheckCommandAccess(client"vip_smoke"ADMFLAG_RESERVATION)) // Player have already 1 or more smokegrenades and not priviledge buy more, prevent buying.
            
{
                
//PrintCenterText(client, "You cannot carry any more.");
                
PrintCenterText(client"Only VIP can buy more.");
                return 
Plugin_Handled;
            }
        }
    }
    return 
Plugin_Continue;

So this only prevent buy smokegrenades, not carry what they find from gound.
__________________
Do not Private Message @me
Bacardi is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 01-21-2012 , 15:04   Re: more than 2 smokegrenades?
Reply With Quote #5

My GrenadePack2 plugin allows server admins to give VIP players more nades...

I'm working on finalizing it to keep non-VIP players from being able to pickup more than what they're allowed... right now, it only restricts them from purchasing more than they're allowed.

...:: TnT Edit ::...

Wait a minute - maybe my plugin already does this - testing is in order
__________________
View my Plugins | Donate

Last edited by TnTSCS; 01-21-2012 at 15:33.
TnTSCS is offline
tobi187
Junior Member
Join Date: Jan 2012
Old 01-21-2012 , 17:14   Re: more than 2 smokegrenades?
Reply With Quote #6

Just throwing in 2 props:

CBasePlayer.localdata.m_iAmmo.002 90


and


CBasePlayer m_iAmmo

I had an eventscript for this, few months ago. searched it on the rootservers but it isnt there any more...

it just sets the smokegrenade limit to 2, like if you wouldnt give anyone a smoke, you can just buy 2 and they are shown in your hud as well.

It was some CBase prop, and it was 1 line of code.

Hoped i had saved it for this moment

Last edited by tobi187; 01-21-2012 at 17:17.
tobi187 is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 01-21-2012 , 17:17   Re: more than 2 smokegrenades?
Reply With Quote #7

valve has this CVar - ammo_smokegrenade_max...

but my plugin gives VIPs more treatment
__________________
View my Plugins | Donate
TnTSCS is offline
tobi187
Junior Member
Join Date: Jan 2012
Old 01-21-2012 , 17:27   Re: more than 2 smokegrenades?
Reply With Quote #8

yeah alright.

But it shouldnt prevent non VIP from purchasing more than 1 nade, if they can normally. (like buying one, throwing one and rebuying after that - should even work!) And VIP can carry 2 smokegrenades...

btw CBasePlayer.localdata.m_iAmmo.013 was the prop for smokegrenades

Last edited by tobi187; 01-21-2012 at 17:37.
tobi187 is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 01-21-2012 , 23:18   Re: more than 2 smokegrenades?
Reply With Quote #9

Updated the GrenadePack2 plugin.

I think it will satisfy your needs. Let me know
__________________
View my Plugins | Donate
TnTSCS is offline
tobi187
Junior Member
Join Date: Jan 2012
Old 01-22-2012 , 06:58   Re: more than 2 smokegrenades?
Reply With Quote #10

Thanks a lot

Last edited by tobi187; 01-22-2012 at 12:54.
tobi187 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 21:06.


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