/* AMX Mod script
*
* (c) 2009, fezh
* This file is provided as is (no warranties).
*
*/
#include <amxmodx>
#include <cstrike>
#include <fakemeta>
// Plugin Stats
#define PLUGIN "M4A1 Sniper"
#define VERSION "0.1.2"
#define AUTHOR "fezh"
// M4 Custom Model
new M4A1_MODEL[ 64 ] = "models/v_m4a1.mdl"
// Zoom Array
new g_hasZoom[ 33 ]
// Misc Stuff
new szClip, szAmmo
public plugin_init()
{
// Register Plugin
register_plugin( PLUGIN, VERSION, AUTHOR )
// Check Current Weapon
register_event( "CurWeapon", "event_cur_weapon", "be", "1=1" )
// Command Start
register_forward( FM_CmdStart, "forward_cmdstart" )
// Plugin Version
register_cvar( "M4A1_sniper", VERSION, FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY )
}
public plugin_precache()
{
precache_model( M4A1_MODEL )
}
public client_putinserver( id )
{
set_task( 20.0, "plugin_message", id )
}
public forward_cmdstart( id, uc_handle, seed )
{
if( !is_user_alive( id ) )
return PLUGIN_HANDLED
if( ( get_uc( uc_handle, UC_Buttons ) & IN_ATTACK2 ) && !( pev( id, pev_oldbuttons ) & IN_ATTACK2 ) )
{
new szWeapID = get_user_weapon( id, szClip, szAmmo )
if( szWeapID == CSW_M4A1 && !g_hasZoom[ id ] )
{
g_hasZoom[ id ] = true
cs_set_user_zoom( id, CS_SET_FIRST_ZOOM, 1 )
emit_sound( id, CHAN_ITEM, "weapons/zoom.wav", 0.20, 2.40, 0, 100 )
}
else
{ if( g_hasZoom[ id ] )
{
g_hasZoom[ id ] = false
cs_set_user_zoom( id, CS_RESET_ZOOM, 0 )
}
}
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
public event_cur_weapon( id )
{
new szWeapID = get_user_weapon( id, szClip, szAmmo )
if ( szWeapID == CSW_M4A1 )
{
set_pev( id, pev_viewmodel2, M4A1_MODEL )
}
}
public plugin_message( id )
{
client_print( id, print_chat, "[AMXX] This server is running M4A1 Sniper v%s", VERSION )
client_print( id, print_chat, "[AMXX] You can use the M4A1 as sniper, using +attack2" )
}
I teraz to dodam:
new g_hasZoom[33] = 0
potem
g_hasZoom[id] = 0
I co dalej?
I jak zrobić amx_give na daną flage?
Bo jak wpisuje:
#define FLAGA ADMIN_LEVEL_A == flaga aTo kom;piler wywala błąd.
Użytkownik Screeaam... edytował ten post 04.03.2010 23:41


Dodatki SourceMod



Temat jest zamknięty






