Raised This Month: $32 Target: $400
 8% 

Block a player to use his weapons


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sudzone
Member
Join Date: Jan 2010
Location: Bucharest
Old 05-31-2012 , 13:17   Block a player to use his weapons
Reply With Quote #1

How i block a player to use his weapons?

ex: amx_block xplayer (and after 15 seconds can use weapons but not in 15 sec after command is executed on player)
sudzone is offline
Send a message via Yahoo to sudzone
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 06-02-2012 , 03:26   Re: Block a player to use his weapons
Reply With Quote #2

Try this: Hook cmdStart (fakemeta I think). Check whether the player is shooting, if yes, simply block it.
__________________
Quote:
#define true ((rand() % 2)? true: false) //Happy debugging suckers
mottzi is offline
Send a message via MSN to mottzi
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-02-2012 , 16:20   Re: Block a player to use his weapons
Reply With Quote #3

Code:
#include <amxmodx> #include <amxmisc> #include <fakemeta> new const Version[] = "0.1"; const MAX_PLAYERS = 32; const OFFSET_LINUX = 5; const m_flNextAttack = 83; enum BlockInfo {     BlockTime,     BlockDuration } new g_iBlockData[ MAX_PLAYERS + 1 ][ BlockInfo ]; public plugin_init() {     register_plugin( "Block Attack" , Version , "bugsy" );         register_event( "CurWeapon" , "fw_EvCurWeapon" , "be" , "1=1" );         register_clcmd( "amx_block" , "BlockPlayer" , ADMIN_BAN , "<Name> <BlockTime>" ); } public client_disconnect( id ) {     g_iBlockData[ id ][ BlockTime ] = 0;     g_iBlockData[ id ][ BlockDuration ] = 0; } public BlockPlayer( id , level , cid ) {     if ( cmd_access( id , level , cid , 3 ) )     {         new szName[ 33 ] , szNum[ 6 ] , iPlayer;                 read_argv( 1 , szName , charsmax( szName ) );         read_argv( 2 , szNum , charsmax( szNum ) );                 if ( ( iPlayer = cmd_target( id , szName , CMDTARGET_OBEY_IMMUNITY | CMDTARGET_ONLY_ALIVE ) ) )         {             g_iBlockData[ iPlayer ][ BlockTime ] = get_systime();             g_iBlockData[ iPlayer ][ BlockDuration ] = str_to_num( szNum );                         set_pdata_float( iPlayer , m_flNextAttack , str_to_float( szNum ) , OFFSET_LINUX );         }     }         return PLUGIN_HANDLED;  } public fw_EvCurWeapon( id ) {     if ( g_iBlockData[ id ][ BlockDuration ] )     {         if ( ( get_systime() - g_iBlockData[ id ][ BlockTime ] ) < g_iBlockData[ id ][ BlockDuration ] )         {             set_pdata_float( id , m_flNextAttack , float( ( g_iBlockData[ id ][ BlockTime ] + g_iBlockData[ id ][ BlockDuration ] ) - get_systime() ) , OFFSET_LINUX );         }            else         {             g_iBlockData[ id ][ BlockTime ] = 0;             g_iBlockData[ id ][ BlockDuration ] = 0;         }     } }
__________________

Last edited by Bugsy; 06-02-2012 at 16:59.
Bugsy 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 16:03.


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