Hi everybody. Im making plugin with helping of Neeeeeeeel and I got this error all the time
This plugin is for weapon spawning on specific origins. Help please
PHP Code:
#include < amxmodx >
#include < amxmisc >
#include < fun >
#include < cstrike >
#include < fakemeta >
#include < engine >
#define PLUGIN "Spawn Ents Example"
#define VERSION "v1.0"
#define AUTHOR "Neeeeeeeeeel.-"
#define WEAPON_ID pev_iuser1
new const g_Conf_File[ ] = { "weaponspawn.ini" };
new Array:spawn_points_X;
new Array:spawn_points_Y;
new Array:spawn_points_Z;
enum {
X = 0,
Y,
Z
};
enum _:Weapons {
Classname[ 32 ],
Model[ 32 ],
WeaponID,
AmmoAmount
}
new const WeaponList[ ][ ] = {
{ "weapon_glock18", "w_glock18.mdl", CSW_GLOCK18, 120 },
{ "weapon_usp", "w_usp.mdl", CSW_USP, 100 },
{ "weapon_deagle", "w_deagle.mdl", CSW_DEAGLE, 35 },
{ "weapon_ak47", "w_ak47.mdl", CSW_AK47, 90 },
{ "weapon_m4a1", "w_m4a1.mdl", CSW_M4A1, 90 },
{ "weapon_famas", "w_famas.mdl", CSW_FAMAS, 90 },
{ "weapon_galil", "w_galil.mdl", CSW_GALIL, 90 },
{ "weapon_awp", "w_awp.mdl", CSW_AWP, 30 },
{ "weapon_mp5", "w_mp5.mdl", CSW_MP5NAVY, 120 },
{ "weapon_mac10", "w_mac10.mdl", CSW_MAC10, 100 }
};
public plugin_precache( )
{
new data[ 64 ];
for( new i = 0; i < sizeof WeaponList; i++ )
{
formatex( data, charsmax( data ), "models/%s", WeaponList[ i ][ Model ] );
precache_model( data );
}
}
public plugin_init( )
{
register_plugin( PLUGIN, VERSION, AUTHOR );
register_clcmd( "say /savespawn", "cmdSaveSpawn" );
register_event( "HLTV", "event_round_start", "a", "1=0", "2=0" );
register_touch( "dropped_weapon", "player", "dropped_weapon_touch" );
spawn_points_X = ArrayCreate( 1, 1 );
spawn_points_Y = ArrayCreate( 1, 1 );
spawn_points_Z = ArrayCreate( 1, 1 );
}
public plugin_cfg( )
{
new confdir[ 64 ], inifile[ 64 ], data[ 128 ], originX[ 11 ], originY[ 11 ], originZ[ 11 ];
get_configsdir( confdir, charsmax( confdir ) );
formatex( inifile, charsmax( confdir ), "%s/%s", confdir, g_Conf_File );
new file = fopen( inifile, "r" );
while( !feof( file ) )
{
fgets( file, data, charsmax( data ) );
if( !data[ 0 ] )
continue;
parse( data, originX, 10, originY, 10, originZ, 10 );
ArrayPushCell( spawn_points_X, str_to_float( originX ) );
ArrayPushCell( spawn_points_Y, str_to_float( originY ) );
ArrayPushCell( spawn_points_Z, str_to_float( originZ ) );
}
console_print( 0, "Points loaded succesfuly" );
}
public dropped_weapon_touch( ent, toucher )
{
static weaponid;
weaponid = pev( ent, WEAPON_ID );
give_item( toucher, WeaponList[ weaponid ][ Classname ] );
cs_set_user_bpammo( toucher, WeaponList[ weaponid ][ WeaponID ], WeaponList[ weaponid ][ AmmoAmount ] );
}
public cmdSaveSpawn( id )
{
new Float:uOrigin[ 3 ], text[ 64 ];
pev( id, pev_origin, uOrigin );
new configdir[ 64 ], file[ 64 ];
get_configsdir( configdir, charsmax( configdir ) );
formatex( file, charsmax( file ), "%s/%s", configdir, g_Conf_File );
formatex( text, charsmax( text ), "%f %f %f", uOrigin[ 0 ], uOrigin[ 1 ], uOrigin[ 2 ] );
write_file( file, text );
client_print( id, print_chat, "WeaponSpawn Point saved!" );
}
public event_round_start( )
{
if( ArraySize( spawn_points_X ) < 10 )
return;
console_print( 0, "spawning weapons..." );
for( new i = 0; i < sizeof WeaponList; i++ )
{
static ent;
ent = create_weapon( i, i );
engfunc( EngFunc_DropToFloor, ent );
}
console_print( 0, "weapons spawned!" );
}
create_weapon( weaponid, originid )
{
static Ent;
Ent = engfunc( EngFunc_CreateNamedEntity, engfunc( EngFunc_AllocString, "info_target" ) );
set_pev( Ent, pev_classname, WeaponList[ weaponid ][ Classname ] );
engfunc( EngFunc_SetModel, Ent, WeaponList[ weaponid ][ Model ] );
set_pev( Ent, pev_solid, SOLID_TRIGGER );
set_pev( Ent, WEAPON_ID, weaponid );
engfunc( EngFunc_SetSize, Ent, Float:{ -50.0, -50.0, -50.0 }, Float:{ 50.0, 50.0, 50.0 } );
static Float:origin[ 3 ];
origin[ 0 ] = Float:ArrayGetCell( spawn_points_X, originid );
origin[ 1 ] = Float:ArrayGetCell( spawn_points_Y, originid );
origin[ 2 ] = Float:ArrayGetCell( spawn_points_Z, originid );
set_pev( Ent, pev_origin, origin );
return Ent;
}