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

Weapon Limit


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Killer12201
Senior Member
Join Date: Dec 2007
Old 01-24-2008 , 23:08   Weapon Limit
Reply With Quote #1

I request a weapon limit for both the shotguns. Just an easy plug-in to have a limit on shotgun for CT cause I'm running a zombie mod and I have knockback on the server so 5 shotguns on 1 zombie is kind of hard, I would like to limit it to 2 shotguns on CT.
Killer12201 is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 01-25-2008 , 07:04   Re: Weapon Limit
Reply With Quote #2

I want to limit shields because I like them but not when all team has it.
hleV is offline
[kirk]./musick`
Senior Member
Join Date: Jun 2007
Location: Tampa, Florida
Old 01-25-2008 , 08:15   Re: Weapon Limit
Reply With Quote #3

eh, this might work.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define MAX_PLAYERS 32

new iCvar

public plugin_init() {
    
register_plugin("Weapon Limit""1.0""kirkhalo")
    
register_event("ItemPickup""event_itemPickup""a")
    
iCvar register_cvar("amx_weaplimit""1")
}

public 
event_itemPickup(item_name){
    if (!
get_pcvar_num(iCvar)) return PLUGIN_HANDLED;
    
    for (new 
id=0id<MAX_PLAYERSid++){
        if ((
cs_get_user_team(id))==CS_TEAM_CT){
            if (
get_user_weapon(id) == 21){
                new 
num 0
                num
++
                if (
num==2) {
                     
client_cmd(id"drop")
                     
num--
                }
            }
        }
    }
    return 
PLUGIN_HANDLED

Good luck,
Kirk
__________________

Last edited by [kirk]./musick`; 01-25-2008 at 16:15.
[kirk]./musick` is offline
Send a message via AIM to [kirk]./musick`
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-25-2008 , 08:43   Re: Weapon Limit
Reply With Quote #4

Really you should stop posting no sense plugins each time. I don't want to offense you but you have no idea what you do.

You should test your plugin before posting... It's nice to help people, but your code is... totaly wrong. :/
__________________

Last edited by Arkshine; 01-25-2008 at 08:46.
Arkshine is offline
[kirk]./musick`
Senior Member
Join Date: Jun 2007
Location: Tampa, Florida
Old 01-25-2008 , 15:58   Re: Weapon Limit
Reply With Quote #5

Wow I don't even see what's wrong with this plugin, it checks the id of the weapon, and if the id is the id of the "m3" (sorry if I don't know the name of the weapon or anything obviously), then it adds 1 to num. Once num reaches 3, it makes the user drop the weapon. It compiled fine, and I'm sorry that I can't seem to test a plugin, when I only have 1 person playing (me). It's correct to my extent, and ItemPickup was the HL Event for picking up weapons, so if a user tried to pickup an m3 while num was at least 3, the item would get dropped.

So, obviously if that is completely wrong code, then what in the world would be correct?
__________________
[kirk]./musick` is offline
Send a message via AIM to [kirk]./musick`
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 01-25-2008 , 16:01   Re: Weapon Limit
Reply With Quote #6

actualy you created the variable "num" within the loop so it does not stay around until next time. it is destroyed when the bracket closes.

also, player indexes start at 1
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
kp_uparrow
Penalized Member
Join Date: Jun 2006
Location: 192.168.0.1
Old 01-25-2008 , 16:04   Re: Weapon Limit
Reply With Quote #7

num doesnt have to stay, he checks all players for m3 each time, script needs is_user_alive
__________________
I USED A SECOND ACCOUNT TO DO MORE KARMA UPS AND DOWNS UNTIL GREENTRYST CAUGHT ME
kp_uparrow is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 01-25-2008 , 16:07   Re: Weapon Limit
Reply With Quote #8

how would this even be possible
Code:
new num = 0 num++ if (num==3) // num will actually equal 1, so dont enter. {     // some code }
its just impossible.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
[kirk]./musick`
Senior Member
Join Date: Jun 2007
Location: Tampa, Florida
Old 01-25-2008 , 16:14   Re: Weapon Limit
Reply With Quote #9

At least you told me my issue. Resolving num as a global integer should work right? Even just initializing it outside of the for/if statement would make it stay, there has to be a way to keep the same variable. And also, it is within another a for loop, so if a user has picked it up, and num is 3, as it cycles through every player, only selecting the ones that have an m3, then it should work, like kp_uparrow said.

On a side note, even if the user was dead, would it still say that the user had an m3?
__________________

Last edited by [kirk]./musick`; 01-25-2008 at 16:16.
[kirk]./musick` is offline
Send a message via AIM to [kirk]./musick`
Killer12201
Senior Member
Join Date: Dec 2007
Old 01-25-2008 , 23:52   Re: Weapon Limit
Reply With Quote #10

Well it is not compiling correctly.

/home/groups/amxmodx/tmp3/textGzjvMY.sma(20) : error 088: number of arguments does not match definition

1 Error.
Could not locate output file /home/groups/amxmodx/public_html/websc3/textGzjvMY.amx (compile failed).
__________________

Last edited by Killer12201; 01-25-2008 at 23:54.
Killer12201 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 19:51.


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