ShockWave Death from Player = Crash?

Questions, comments, and news on the server side plug-ins and it's API
Post Reply
Theme97
Private First Class
Private First Class
Posts: 221
Joined: Fri Nov 11, 2005 8:04 pm
Contact:

ShockWave Death from Player = Crash?

Post by Theme97 »

I've been poking around with the shockwaveDeath source and tried making my own. I discovered that the plugin can fire ShockWave world weapons from rogues but not from any other team because BZF would crash. Can anyone explain?

Edit: I tried it again, recently. It wouldn't work with Rogues either. What causes BZF to crash?
Last edited by Theme97 on Fri Mar 24, 2006 4:17 am, edited 1 time in total.
Image
User avatar
RPG
Lieutenant, Junior Grade
Lieutenant, Junior Grade
Posts: 2015
Joined: Fri Sep 17, 2004 2:37 am
Location: Chicago, Illinois
Contact:

Post by RPG »

What version of BZFS and what version client are you using? What OS? Does the original ShockwaveDeath plugin cause it to crash, or is it your modified one that is making it crash?

Before you try anything though, the most common source of plugin crashes is caused by not checking for NULL player records before using them. If you use the function bz_getPlayerByIndex, then you MUST check the return data to make sure it is not NULL. Because if it is NULL, your plugin will crash. A simple way to do it is like this:

Code: Select all

bz_PlayerRecord *data = bz_getPlayerByIndex(i);
  if(data){
    //Stuff goes here
  }
  //Also free the player record to prevent memory leaks
  bz_freePlayerRecord(data);
Theme97
Private First Class
Private First Class
Posts: 221
Joined: Fri Nov 11, 2005 8:04 pm
Contact:

Post by Theme97 »

Happy Tanker is hosting it with 2.0.5b5 on Linux. The client versions 2.0.2, 2.0.4, 2.0.5b4, and 2.0.5b5 seem to crash. With the original shockwaveDeath plugin, simply add the "usevictim" parameter. Everyone except the person who died crashes. My modified version uses:

Code: Select all

void SWDeath::process ( bz_EventData *eventData )
{
  bz_PlayerDieEventData *dieData = (bz_PlayerDieEventData*)eventData;
  float reloadTime = (float)bz_getBZDBDouble("_reloadTime");
  bz_fireWorldWep("SW",reloadTime,dieData->playerID,dieData->pos,0,0,0,0.0f);
}
Image
Gnurdux
Corporal
Corporal
Posts: 25
Joined: Thu Jun 16, 2005 10:12 pm

Hmmm

Post by Gnurdux »

Its the clients that crash, not the server. And it only happens when the wep kills someone.
Gnurdux
Corporal
Corporal
Posts: 25
Joined: Thu Jun 16, 2005 10:12 pm

Post by Gnurdux »

Oh and the error on linux is the ever popular segfault.
Post Reply