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

Count players with AWP in team


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MindeLT
Senior Member
Join Date: Dec 2010
Location: Lithuania
Old 06-26-2011 , 10:43   Count players with AWP in team
Reply With Quote #1

Hi,

since some people are complaining about VIP only awp, i'm trying to do a little fix. The idea looks like this:

There is a limit of 1(free) awp per team. This means, in each team only one non-vip person, could shoot with it, vip persons are ignored(they can shoot awp as before).

Taken some examples from Restrict plugin, but it looks too difficult.

Can someone suggest me, how to check each team AWP holders, and then take some actions?

Thanks
MindeLT is offline
Send a message via Skype™ to MindeLT
lokizito
Veteran Member
Join Date: Dec 2010
Location: Brazil
Old 06-26-2011 , 10:51   Re: Count players with AWP in team
Reply With Quote #2

GetPlayerWeaponSlot(client, slot);
GetEntityClassname(entity, String:clsname[], maxlength)
__________________
[CS:S] RankMe - Why pay for a rank plugin if you can have one for free?
[CS:S] RankMe Connect Announcer - Announce when a player connect
Translation Project - Let's make the plugins to be international
lokizito is offline
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 06-26-2011 , 11:09   Re: Count players with AWP in team
Reply With Quote #3

Quote:
Originally Posted by MindeLT View Post
Hi,

since some people are complaining about VIP only awp, i'm trying to do a little fix. The idea looks like this:

There is a limit of 1(free) awp per team. This means, in each team only one non-vip person, could shoot with it, vip persons are ignored(they can shoot awp as before).

Taken some examples from Restrict plugin, but it looks too difficult.

Can someone suggest me, how to check each team AWP holders, and then take some actions?

Thanks
FYI: Weapon restrict already does what you want. If you enable weapon restrict immunity and set restrictions for awp to 1 it ignores vip when it checks how many people have that weapon on the team.

PHP Code:
                new count 0;
        for(new 
1<= MaxClientsi++)
        {
            if(
IsClientInGame(i) && GetConVarInt(AdminImmunity) == && ((GetUserFlagBits(i) & ADMIN_LEVEL) || (GetUserFlagBits(i) & ADMFLAG_ROOT)))
                continue;
            
            if(
IsClientInGame(i) && != client && GetClientTeam(i) == clientteam)
            {
                new 
weaponindex GetPlayerWeaponSlot(islot);
                new 
String:classname[100];
                if(
weaponindex != -&& IsValidEdict(weaponindex))
                {
                    
GetEdictClassname(weaponindexclassnamesizeof(classname));
                    if(
StrEqual(classnameweapon2false))
                        
count++;
                }
            }
        } 
Thats straight from weapon restrict (not that long) what becomes long is the ways you can bypass stuff. Or if the weapon is a grenade counting grenades isn't as simple. Ive since rewrote that function (and mostly everything else) for the new weapon restrict (I never noticed I have 2 if's when i can do it all in 1..) The new one will have a native for that function and other functions so you can call it straight from your plugin.

Last edited by Dr!fter; 06-26-2011 at 11:12.
Dr!fter is offline
MindeLT
Senior Member
Join Date: Dec 2010
Location: Lithuania
Old 06-26-2011 , 15:16   Re: Count players with AWP in team
Reply With Quote #4

thanks!
MindeLT is offline
Send a message via Skype™ to MindeLT
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 01:33.


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