AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Server Crashing (https://forums.alliedmods.net/showthread.php?t=47608)

The Specialist 11-22-2006 07:59

Server Crashing
 
Im trying to get this plugin working right , but every time i switch to AWP my server crashes. The wierd part is there are no run time errors showing up . Any idea what would make this crash ?
Code:
#include <amxmodx> #include <cstrike> #include <engine> // Gloabal Variables new g_Rail_Gun; new beam; public plugin_init() {     register_plugin("Rail Gun","0.1","The Specialist");     g_Rail_Gun = register_cvar("rg_switch","1");     register_cvar("rg_rail_damage","1");     register_clcmd("amx_rail_arena","amx_rail_arena",ADMIN_CVAR,"Starts A Rail Gun Arena");     register_event("CurWeapon","weapon_event","be","1=1");     register_event("Damage","rail_damage","b"); } public plugin_precache() {     // precache the files needed for models and sounds         precache_model("models/v_gauss.mdl");     precache_model("models/p_gauss.mdl");     beam = precache_model("sprites/smoke.spr"); } // current weapon event public weapon_event(id) {     // if cvar is off then end fucntion         if(get_pcvar_num(g_Rail_Gun)==0)     {         return PLUGIN_HANDLED;     }else{         // get weapon and ammo id's                 new Weapon_ID = read_data(2);             // if weapon is awp and plugin is on and mode is 1 then set models             if( Weapon_ID == CSW_AWP)         {             // sets the players awp to the rail gun model                 entity_set_string(id,EV_SZ_weaponmodel,"models/p_gauss.mdl");                     // sets the players view model to the rail guns model                     entity_set_string(id,EV_SZ_viewmodel,"models/v_gauss.mdl");                         // add effects to bullets                         rail_fire();             return PLUGIN_HANDLED;         }     }     return PLUGIN_HANDLED; } // damage event public rail_damage(id) {     // get user attackers , waepons and damage     new g_AWeapon;     new g_Damage = read_data(2);         get_user_attacker(id,g_AWeapon);            // if user was shot by AWP multiply damage by cvar         if(g_AWeapon == CSW_AWP )     {         // hit user with fake damage                 fakedamage(id,"weapon_awp",float(g_Damage),DMG_BULLET  &&  DMG_BLAST && DMG_ENERGYBEAM)         return PLUGIN_HANDLED;     }     return PLUGIN_HANDLED; } // sounds and messages for bullets public rail_fire() {     // effects that follwo the bulelts     message_begin(MSG_BROADCAST, SVC_TEMPENTITY);     write_byte(22);     write_short(beam);     write_byte(45);     write_byte(4);     write_byte(100);     write_byte(100);     write_byte(250);     write_byte(100); }             public amx_rail_arena(id) {     return PLUGIN_HANDLED; }
thanks:up:

[ --<-@ ] Black Rose 11-22-2006 09:10

Re: Server Crashing
 
#define TE_BEAMFOLLOW 22 // Create a line of decaying beam segments until entity stops moving
// write_byte(TE_BEAMFOLLOW)
// write_short(entity:attachment to follow)
// write_short(sprite index)
// write_byte(life in 0.1's)
// write_byte(line width in 0.1's)
// write_byte(red)
// write_byte(green)
// write_byte(blue)
// write_byte(brightness)

jim_yang 11-22-2006 09:50

Re: Server Crashing
 
you forgot "message_end()"

jim_yang 11-22-2006 10:20

Re: Server Crashing
 
Code:
#include <amxmodx> #include <cstrike> #include <engine> // Gloabal Variables new g_Rail_Gun; new beam; public plugin_init() {         register_plugin("Rail Gun","0.1","The Specialist");         g_Rail_Gun = register_cvar("rg_switch","1");         register_cvar("rg_rail_damage","1");         register_clcmd("amx_rail_arena","amx_rail_arena",ADMIN_CVAR,"Starts A Rail Gun Arena");         register_event("CurWeapon","weapon_event","b","1=1");         register_event("Damage","rail_damage","b"); } public plugin_precache() {         precache_model("models/v_gauss.mdl");         precache_model("models/p_gauss.mdl");         beam = precache_model("sprites/smoke.spr"); } public weapon_event(id) {         if(!get_pcvar_num(g_Rail_Gun))                 return         else         {                 if(read_data(2) == CSW_AWP)                 {                         entity_set_string(id,EV_SZ_weaponmodel,"models/p_gauss.mdl");                         entity_set_string(id,EV_SZ_viewmodel,"models/v_gauss.mdl");                         rail_fire(id);                         return                 }         }         return } public rail_damage(id) {         new g_AWeapon;                 get_user_attacker(id,g_AWeapon);                 if(g_AWeapon == CSW_AWP )         {                 fakedamage(id,"weapon_awp",float(read_data(2)),DMG_BULLET  &&  DMG_BLAST && DMG_ENERGYBEAM)                 return PLUGIN_HANDLED;         }         return PLUGIN_HANDLED; } public rail_fire(id) {         message_begin(MSG_BROADCAST, SVC_TEMPENTITY);         write_byte(22);         write_short(id);         write_short(beam)         write_byte(45);         write_byte(4);         write_byte(100);         write_byte(100);         write_byte(250);         write_byte(100);         message_end() } public amx_rail_arena(id) {         return PLUGIN_HANDLED; }
sorry for removing the comment from you code.

The Specialist 11-22-2006 10:21

Re: Server Crashing
 
for the entity: atachment to follow , how would i make it follow awp bullets ?:cry:

jim_yang 11-22-2006 10:35

Re: Server Crashing
 
i guess bullets are not entities in cs, never worked on them.
you'd better try another tempentity message using
get_user_origin(id,origin,4)
4 - Position from last bullet hit (only CS)4 - Position from last bullet hit (only CS)

dutchmeat 11-22-2006 10:38

Re: Server Crashing
 
See the Bullet Time source;
http://forums.alliedmods.net/showthread.php?t=11670

jim_yang 11-22-2006 10:46

Re: Server Crashing
 
oh, my guess was wrong. thanks for the information above.

XxAvalanchexX 11-22-2006 15:50

Re: Server Crashing
 
No, jim_yang is right, there are no bullet entities: damage calculations are done instantly upon firing a round. I believe what bullet time does is create its own fake bullet entity to replicate a slow-mo effect.

dutchmeat 11-22-2006 16:26

Re: Server Crashing
 
I think that quake1 had a cvar called 'cg_debugbullet', wich leaves a trail, you should see into that.


All times are GMT -4. The time now is 06:49.

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