AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Weapon problem [Solved] (https://forums.alliedmods.net/showthread.php?t=62871)

Toster v2.1 11-06-2007 11:39

Weapon problem [Solved]
 
So I used this function:

PHP Code:

public eq_med(id)
{
    
strip_user_weapons(id)
    
give_item(id,"weapon_knife"
    
give_item(id,"weapon_usp")
    
cs_set_user_bpammo(idCSW_USP200)


And after that people can't pick up spawned weapons from ground (only dropped ones). They have to be killed to pick them up again. :(

Alka 11-06-2007 11:41

Re: Weapon problem
 
I don't think that code should be a reason... :s That is the only thing you have it in you'r code about weapons ? oO

Toster v2.1 11-06-2007 11:43

Re: Weapon problem
 
Hmm...

Theres also this:

PHP Code:

public fw_prethink(id)
{
    new 
clipammo
    
new wpn
    
    
if(id==med_c || id==med_t)
    {
        
wpn get_user_weapon(idclipammo)
        if(
wpn!=CSW_USP && wpn!=CSW_KNIFE && wpn!=CSW_C4eq_med(id)
        
        ...
    }


I didn't know any better way to stop someone from using other weapons, but even if I set med_c and med_t to 0 I still can't pick them up..

Toster v2.1 11-06-2007 12:18

Re: Weapon problem
 
I replaced this:
PHP Code:

if(wpn!=CSW_USP && wpn!=CSW_KNIFE && wpn!=CSW_C4eq_med(id

With this:
PHP Code:

if(wpn!=CSW_USP && wpn!=CSW_KNIFE && wpn!=CSW_C4client_cmd(id"weapon_usp"

And it works!

Anyone knows how can i restrict dropping the usp??

M249-M4A1 11-06-2007 12:45

Re: Weapon problem
 
I know for a fact that you can block the drop command, so this should work

PHP Code:

public plugin_init() {
    
register_clcmd("drop""hookDrop"0)
}

public 
hookDrop(id) {
    if (
get_user_weapon(id) == CSW_USP) {
        
client_print(idprint_chat"[AMXX] You are not allowed to drop the USP!")
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE



Orangutanz 11-06-2007 12:56

Re: Weapon problem
 
Code:
new weapons weapons = (1<<29)|(1<<16) set_pev(id, pev_weapons, weapons)
Above will only allow usage of Knife and USP, the good thing about the above code you only need to run it whenever they get a new weapon, so you don't need to do any fancy pants blocking :mrgreen:

Toster v2.1 11-06-2007 13:00

Re: Weapon problem
 
Actually I only need the hooking so the players wont drop the usp...

@M249-M4A1 Thx, works great!

Alka 11-10-2007 05:42

Re: Weapon problem
 
Quote:

Originally Posted by Orangutanz (Post 550148)
Code:
<font face="monospace"><font color="#007700">new</font> weaponsweapons = <font color="#000000">(</font><font color="#0000dd">1</font><<<font color="#0000dd">29</font><font color="#000000">)</font>|<font color="#000000">(</font><font color="#0000dd">1</font><<<font color="#0000dd">16</font><font color="#000000">)</font>set_pev<font color="#000000">(</font>id, pev_weapons, weapons<font color="#000000">)</font></font>



Above will only allow usage of Knife and USP, the good thing about the above code you only need to run it whenever they get a new weapon, so you don't need to do any fancy pants blocking :mrgreen:

When i call that, my HUD is messed. :s

Orangutanz 11-10-2007 10:37

Re: Weapon problem [Solved]
 
Exactly it blocks those weapons from being selected altogether, you have to set it correctly otherwise you won't have access to weapons you should have.

Alka 11-10-2007 10:56

Re: Weapon problem [Solved]
 
You don't get it. my HUD is messed up. Round timer is upper, no health, armor... :S... and i can't select any weapon. How much correct ? I've tried what you wrote o.O


All times are GMT -4. The time now is 01:24.

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