AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Block the stwich weapon of players. (https://forums.alliedmods.net/showthread.php?t=95440)

lolzin123 06-23-2009 16:45

Block the stwich weapon of players.
 
I need the code for block the players of stwich weapons for 10s.

Hawk552 06-24-2009 09:24

Re: Block the stwich weapon of players.
 
Not possible, afaik. You might try hooking it in Ham and blocking it using this:

PHP Code:

    /**
     * Description:        Deploys the entity (usually a weapon).
     * Forward params:    function(this);
     * Return type:        Integer (boolean).
     * Execute params:    ExecuteHam(Ham_Item_Deploy, this);
     */
    
Ham_Item_Deploy 

I suspect, however, that this will just crash the server as opposed to preventing weapon switching.

What you can do, though, is simply switch the player's weapon back to their old weapon or drop the new one.

lolzin123 06-24-2009 12:04

Re: Block the stwich weapon of players.
 
I'm Trying to use this code:
PHP Code:

if( get_gametime() - gSlowedTime[plr] < 3.0
            
&& gEntSlowed[plr] == ent )
            {
                
set_pev(plrpev_maxspeed75.0);
            }
            
            if( !
task_exists(TASK_ID_MAXSPEED plr0) )
            {
                new 
szEntId[5];
                
num_to_str(entszEntId4);
                
                
set_task(3.0"tskMaxSpeed"TASK_ID_MAXSPEED plrszEntId4""0);
            } 

but when the plr stwitch the weapons, the slowtime disappears

Any idea?

Sylwester 06-24-2009 14:28

Re: Block the stwich weapon of players.
 
add to plugin init:
PHP Code:

register_event("CurWeapon""event_CurWeapon""be""1=1"

event_CurWeapon will be called every time player switch weapons, so you just need to check if player should be slowed and set his maxspeed there...
If you want to see some example of using this event to set maxspeed then check this:
http://forums.alliedmods.net/showpos...73&postcount=7

lolzin123 06-25-2009 13:24

Re: Block the stwich weapon of players.
 
show me how i add this code to make the plr slow , because when he switch the weapon the slowtime is finish. THX

hleV 06-25-2009 13:45

Re: Block the stwich weapon of players.
 
Just block all weapon ("weapon_m4a1", etc), slot ("slot1", etc), inventory ("inv_next", etc) cmds.

Sylwester 06-25-2009 14:27

Re: Block the stwich weapon of players.
 
Don't try to block weapons, just learn how to use CurWeapon event to make player maxspeed constant. I already gave you link with an example in my previous post. There are also a lot of other examples, just use Search...

If you are not able to understand how to use CurWeapon then post your plugin and someone will edit it.

lolzin123 06-25-2009 15:03

Re: Block the stwich weapon of players.
 
It's a BCM 4 of HNS if i strip the weapons, the game is over...
I need a mod to strip the weapons and give the same weapons with the same bullets.Or block the switching of weapons, understand?


All times are GMT -4. The time now is 15:35.

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