function scan_event()
{
if (event_type == EVENT_SCAN)
{
if(my.weaponToSpawn == 1 && my.weaponAmmoPickup > 0 && my.weaponPickup == 1)
{
weaponInventory[0] = 1;
reloading = 0;
reloadSfxOnce = 0;
shootAnimationSpeed = 100;
user.currentWeapon = 1;
drawWeaponAnimation = 0;
weaponReady = 0;
snd_play(assaultDeploy,100*(sfxVolume/100),0);
my.weaponPickup = 0;
my.weaponRespawnTime = 100;
}
}
}
function spawnWeapon()
{
set(my,PASSABLE);
my.scale_x = 1.5;
my.scale_y = my.scale_x;
my.scale_z = my.scale_x;
add_light(vector(my.x,my.y,my.z+10), vector(106,255,253), 20);
my.material = glowShader;
my.skill41 = floatv(0.02); // adjust the stength of the glow
while(1)
{
my.pan += 5*time_step;
wait(1);
}
}
void weaponSpawnz()
{
while(enet_ent_globpointer(my) == ANET_ERROR) {wait(1);} //wait until the entity gets a global pointer
ENTITY* ent;
var sendVarPickup = 0;
my.emask |= ENABLE_SCAN;
my.weaponRespawnTime = 0;
my.weaponToSpawn = 1;
my.weaponPickup = 0;
set(my,PASSABLE|SHADOW);
weaponSpawnerBaseEmitter();
my.event = scan_event;
if(my.weaponToSpawn == 1)
{
ent = ent_create("w_MK19.mdl", vector(my.x,my.y,my.z+40), spawnWeapon);
my.weaponAmmoPickup = 30;
}
while(1)
{
if(my.weaponRespawnTime>0)
{
my.weaponRespawnTime-=1*time_step;
}
else
{
my.weaponRespawnTime = 0;
my.weaponPickup = 1;
sendVarPickup = 0;
}
if(my.weaponPickup == 0)
{
if(ent!=NULL && sendVarPickup == 0)
{
set(ent,INVISIBLE);
enet_send_skills(enet_ent_globpointer(my),22,22,BROADCAST);
sendVarPickup = 1;
}
}
else
{
if(ent!=NULL)
{
reset(ent,INVISIBLE);
}
}
wait(1);
}
}
//ent_create("placeholder.mdl",vector(0,0,0),weaponSpawnerFunc);
action weaponSpawnerFunc()
{
set(my,PASSABLE|INVISIBLE);
if(MY_CONNECTION == SERVER_MODE)
{
enet_svent_create(WEAPON_SPAWNER,vector(my.x,my.y,my.z));
}
else
{
enet_clent_create(WEAPON_SPAWNER,vector(my.x,my.y,my.z));
}
}