Auto Pause :)

Questions, comments, and news on the server side plug-ins and it's API
Post Reply
User avatar
Links 2004
Private First Class
Private First Class
Posts: 85
Joined: Sat Jan 01, 2005 6:54 pm
Location: Ger
Contact:

Auto Pause :)

Post by Links 2004 »

hi,
i have make a plugin there auto paused a game when a player go paused :)






Player XXX go pause! Game Paused! <-- player XXX go pause
Player XXX is Resume! Game Resume! <-- player XXX resume
Player XXX is Resume! ( When more then 1 player paused ) <-- player XXX resume

__________________________________

in pause mode:

when player XXX shot player YYY:
say "Player XXX do kill a Player! DO not kill!!!!!!"
kill player XXX

when player XXX kicked or ban and he is paused --> countdown resume


set _shotSpeed to 0
set _jumpVelocity to 0
set _tankAngVel to 0.000001
set _tankSpeed to 0.000001

in "resume" mode

set _shotSpeed to 100
set _jumpVelocity to 19
set _tankSpeed to 25
set _tankAngVel to 0.785398
set _tankSpeed to 25



comands:
/pause <-- make the game pause and stop all tanks
/resume <-- make the game resume alowe to swam
Attachments
1.0.5 Source.zip
Source V1.0.5
(731.93 KiB) Downloaded 300 times
Playerpausemakegamepause.zip
V 1.0.5
(8.15 KiB) Downloaded 323 times
Last edited by Links 2004 on Sat May 27, 2006 9:19 pm, edited 4 times in total.
Clan: Links
Clan web: http://links-clan.net
ImageImageImageImageImageImageImageImageImageImage
Legolas_
Private First Class
Private First Class
Posts: 513
Joined: Thu Jan 20, 2005 10:24 pm

Post by Legolas_ »

So...

This plugin will automatically stop play and stop the countdown when a player pauses? If so, good job.

I dont know if this is possible but:
A plugin that will;
1). If a player says 'stop' the countdown pauses, and everyone stops movi ng.
2). Same as what this plugin does (when a player presses pause)
User avatar
Links 2004
Private First Class
Private First Class
Posts: 85
Joined: Sat Jan 01, 2005 6:54 pm
Location: Ger
Contact:

Post by Links 2004 »

my plugin stop the game when a player presse Pause
when all player resume the game go resumet
Clan: Links
Clan web: http://links-clan.net
ImageImageImageImageImageImageImageImageImageImage
Legolas_
Private First Class
Private First Class
Posts: 513
Joined: Thu Jan 20, 2005 10:24 pm

Post by Legolas_ »

Ok, it stops the game when a player presses 'p' and waits. Now, with the newer releases it will also stop the game when you press f5. wil that in turn pause the game?
User avatar
The Red Baron
Sergeant First Class
Sergeant First Class
Posts: 987
Joined: Sat Dec 07, 2002 6:21 am
Contact:

Post by The Red Baron »

links

What i think would be better, especially for the leagues, is when some one types /countdown pause - it pauses all the players in their position.
Beware! I'm going to clone myself and spread those clones all over the world!
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5196
Joined: Fri Dec 13, 2002 4:11 am

Post by JeffM »

a plugin can not stop players from moving. the server can not even do that.
ImageJeffM
User avatar
A Meteorite
Private First Class
Private First Class
Posts: 1786
Joined: Thu Apr 28, 2005 12:56 am
Location: California, U.S.
Contact:

Post by A Meteorite »

JeffM2501
Well, maybe that would be a nice protocol change for 2.1 then? :P

I would find it quite useful for matches - especially if it stopped all shots (since getting hit from a shot while being forcefully paused is just not fair ;) ).
Image
Owner @ BZFX
Core Admin @ CAN

Email me: bzmet…@gmail.com
User avatar
Links 2004
Private First Class
Private First Class
Posts: 85
Joined: Sat Jan 01, 2005 6:54 pm
Location: Ger
Contact:

Post by Links 2004 »

my plugin resume the game wenn no player is paused
Clan: Links
Clan web: http://links-clan.net
ImageImageImageImageImageImageImageImageImageImage
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5196
Joined: Fri Dec 13, 2002 4:11 am

Post by JeffM »

A Meteorite
I am making it so you can push all players to observer, then push them back.
ImageJeffM
User avatar
CannonBallGuy
Private First Class
Private First Class
Posts: 2083
Joined: Wed Apr 12, 2006 1:31 am
Contact:

Post by CannonBallGuy »

Links 2004

Should be a very useful plugin!
Can you also make the server say:
"Stop player_name has paused! Please stay still!"
when someone pauses and the countdown is paused..?
:)
Image

Merry Christmas!

"Look, if I don't buy booze for the kids, I don't get any incriminating pictures to show to their parents, my business goes down the sink, my girlfriend leaves me and the baby goes on ebay. So help me search..."

"go Play With Toys urself in a dark alley u donkey ******" - Lt-Kirby2007
User avatar
Links 2004
Private First Class
Private First Class
Posts: 85
Joined: Sat Jan 01, 2005 6:54 pm
Location: Ger
Contact:

Post by Links 2004 »

my plugin say to all :

Player XXX go pause! Game Paused!
Player XXX is Resume! Game Resume!
Player XXX is Resume! ( When more then 1 player paused )


Edit:

my plugin say:

Player XXX go pause! Game Paused! <-- player XXX go pause
Player XXX is Resume! Game Resume! <-- player XXX resume
Player XXX is Resume! ( When more then 1 player paused ) <-- player XXX resume

Player Paused!! Do not Play !!! <-- >1 player paused and player XXX shot
Player XXX do kill a Player! DO not kill!!!!!! <-- >1 player paused and player XXX kill player YYY


Edit 2:

Know anyone the setfunction for vriable in a plugin?
Attachments
Playerpausemakegamepause.zip
V 1.0.1
(157.34 KiB) Downloaded 286 times
Clan: Links
Clan web: http://links-clan.net
ImageImageImageImageImageImageImageImageImageImage
User avatar
Tanner
Private First Class
Private First Class
Posts: 575
Joined: Sat Sep 17, 2005 3:46 am
Location: Atl, GA
Contact:

Post by Tanner »

You could set the shot speed to 0, tank speed to 0, and angular to 0.

-Tanner
Tanner - Segway HT i180 Red Owner - Random Map Creator - BZStocks - TS Software

Image
User avatar
Links 2004
Private First Class
Private First Class
Posts: 85
Joined: Sat Jan 01, 2005 6:54 pm
Location: Ger
Contact:

Post by Links 2004 »

yes i make it .
but i need the API function to set the tanxSpeed the shotSpeet i have found but no function for tanx.

i need a set for float

i have found in the api:
BZF_API bool bz_setBZDBDouble ( const char* variable, double val, int perms = 0, bool persistent = false );
BZF_API bool bz_setBZDBString( const char* variable, const char *val, int perms = 0, bool persistent = false );
BZF_API bool bz_setBZDBBool( const char* variable, bool val, int perms = 0, bool persistent = false );
BZF_API bool bz_setBZDBInt( const char* variable, int val, int perms = 0, bool persistent = false );

but no for set a float
Clan: Links
Clan web: http://links-clan.net
ImageImageImageImageImageImageImageImageImageImage
User avatar
Links 2004
Private First Class
Private First Class
Posts: 85
Joined: Sat Jan 01, 2005 6:54 pm
Location: Ger
Contact:

Post by Links 2004 »

hi all
new in 1.0.3:

in pause mode:

when player XXX shot player YYY --> player XXX DIE
when player XXX kicked or ban and he is paused --> countdown resume

set _shotSpeed to 0
set _jumpVelocity to 0
set _tankSpeed to 0 <-- do not work ???


in "resume" mode

set _shotSpeed to 100
set _jumpVelocity to 19
set _tankSpeed to 25 <-- do not work ???



I need assistance: White someone like one the tank speed seten can I get it not work!
Attachments
Playerpausemakegamepause.zip
V1.0.3
(6.88 KiB) Downloaded 291 times
Clan: Links
Clan web: http://links-clan.net
ImageImageImageImageImageImageImageImageImageImage
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5196
Joined: Fri Dec 13, 2002 4:11 am

Post by JeffM »

use the double one, it'll cast a float to a double and be fine. both doubles and floats are floating point values.
ImageJeffM
User avatar
Links 2004
Private First Class
Private First Class
Posts: 85
Joined: Sat Jan 01, 2005 6:54 pm
Location: Ger
Contact:

Post by Links 2004 »

i use bz_setBZDBDouble("_tankSpeed",25.0);
but it do not work


Edit:

I look for examples of a CustomSlashCommand ?
Clan: Links
Clan web: http://links-clan.net
ImageImageImageImageImageImageImageImageImageImage
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5196
Joined: Fri Dec 13, 2002 4:11 am

Post by JeffM »

play history tracker has an example of a custom slash command.

the double should set it.

give me an example of the problem and I can see what's up.
ImageJeffM
User avatar
Links 2004
Private First Class
Private First Class
Posts: 85
Joined: Sat Jan 01, 2005 6:54 pm
Location: Ger
Contact:

Post by Links 2004 »

here is my code to set the tanx speed:

Code: Select all

// Playerpausemakegamepause.cpp : Defines the entry point for the DLL application.
//

#include "bzfsAPI.h"
#include <string>

BZ_GET_PLUGIN_VERSION

// event handler callback

class start : public bz_EventHandler
{
public:
  virtual void	process ( bz_EventData *eventData );
};
class playerPause : public bz_EventHandler
{
public:
  virtual void	process ( bz_EventData *eventData );
};
class stop : public bz_EventHandler
{
public:
  virtual void	process ( bz_EventData *eventData );
};

class schuss : public bz_EventHandler
{
public:
  virtual void	process ( bz_EventData *eventData );
};

class die : public bz_EventHandler
{
public:
  virtual void	process ( bz_EventData *eventData );
};
class kick : public bz_EventHandler
{
public:
  virtual void	process ( bz_EventData *eventData );
};

class ban : public bz_EventHandler
{
public:
  virtual void	process ( bz_EventData *eventData );
};

class join : public bz_EventHandler
{
public:
  virtual void	process ( bz_EventData *eventData );
};

//bz_CustomSlashCommandHandler
/*
class makepause : public bz_CustomSlashCommandHandler, public bz_EventHandler
{
public:
  virtual void	process ( bz_EventData *eventData );
};

class makeresume : public bz_CustomSlashCommandHandler, public bz_EventHandler
{
public:
  virtual void	process ( bz_EventData *eventData );
};
*/
////////////////////////////////////
int isstartg = 0;
int Userpause[999];
int pausecount = 0;



start	start;
stop	stop;
playerPause	playerPause;
schuss	schuss;
die	die;
kick	kick;
ban	ban;
join join;
/*makepause	makepause;
makeresume	makeresume;*/
BZF_PLUGIN_CALL int bz_Load ( const char* commandLine )
{
  bz_debugMessage(4,"Auto Paused plugin loaded");

 /* 
  bz_registerCustomSlashCommand("pause",&makepause);
  bz_registerCustomSlashCommand("resume",&makeresume);
  */

  bz_registerEvent(bz_ePlayerJoinEvent,&join);
  bz_registerEvent(bz_eGameStartEvent,&start);
  bz_registerEvent(bz_ePlayerPausedEvent,&playerPause);
  bz_registerEvent(bz_eGameEndEvent,&stop);
  bz_registerEvent(bz_eShotFiredEvent,&schuss);
  bz_registerEvent(bz_ePlayerDieEvent,&die);
  bz_registerEvent(bz_eKickEvent,&kick);
  bz_registerEvent(bz_eBanEvent,&ban);
  std::string param = commandLine;

  if (param == "usevictim")
	  bz_debugMessage(0,"Auto Paused plugin no longer takes any paramaters");
  return 0;
}

BZF_PLUGIN_CALL int bz_Unload ( void )
{
/*
bz_removeCustomSlashCommand("pause",&makepause);
bz_removeCustomSlashCommand("resume",&makeresume);
*/
  bz_removeEvent(bz_ePlayerJoinEvent,&join);
  bz_removeEvent(bz_eGameStartEvent,&start);
  bz_removeEvent(bz_ePlayerPausedEvent,&playerPause);
  bz_removeEvent(bz_eGameEndEvent,&stop);
  bz_removeEvent(bz_ePlayerDieEvent,&die);
  bz_removeEvent(bz_eShotFiredEvent,&schuss);
  bz_removeEvent(bz_eKickEvent,&kick);
  bz_removeEvent(bz_eBanEvent,&ban);
  bz_debugMessage(4,"Auto Paused plugin unloaded");
  return 0;
}



///////////////////////////////////////////////////////
/*
void makepause::process( bz_EventData *eventData){
	if(isstartg != 0){
bz_pauseCountdown("Server");
pausecount=pausecount+1;
bz_setBZDBDouble("_tankSpeed",0.0);
bz_setBZDBDouble("_shotSpeed",0.0);
bz_setBZDBDouble("_jumpVelocity",0.0);
	} else {
bz_sendTextMessage(BZ_SERVER, BZ_ALLUSERS,"No Game runing!");
	}
}
void makeresume::process( bz_EventData *eventData){
if(isstartg != 0){
bz_resumeCountdown("Server");
pausecount=0;
bz_setBZDBDouble("_tankSpeed",25.0);
bz_setBZDBDouble("_shotSpeed",100.0);
bz_setBZDBDouble("_jumpVelocity",19.0);
} else {
bz_sendTextMessage(BZ_SERVER, BZ_ALLUSERS,"No Game runing!");
	}
}

*/

///////////////////////////////////////////////////
//JOIN
void join::process( bz_EventData *eventData ){

std::string soundToPlay;
  if (eventData->eventType != bz_ePlayerJoinEvent)
    return;
bz_PlayerJoinPartEventData *joinData = (bz_PlayerJoinPartEventData*)eventData;

bz_sendTextMessage(BZ_SERVER,joinData->playerID,"Auto Paused Plugin is loaded.");
bz_sendTextMessage(BZ_SERVER,joinData->playerID,"Use /countdown <sec>  to start  a game.");
bz_sendTextMessage(BZ_SERVER,joinData->playerID,"Use /pause            to Paused a game.");
bz_sendTextMessage(BZ_SERVER,joinData->playerID,"Use /resume           to Resume a game.");
bz_sendTextMessage(BZ_SERVER,joinData->playerID,"      Auto Pause is make by Links      ");

Userpause[joinData->playerID] = 0; 
}
///////////////////////////////////////////////////
//BAN
void ban::process( bz_EventData *eventData ){

std::string soundToPlay;
  if (eventData->eventType != bz_eBanEvent)
    return;

bz_BanEventData *BanData = (bz_BanEventData*)eventData;



if(Userpause[BanData->banneeID] == 1){ 
Userpause[BanData->banneeID] = 0; 
pausecount=pausecount-1;
}

///////////
std::string killerCallSign = "UNKNOWN";
bz_PlayerRecord	*killerData;

killerData = bz_getPlayerByIndex(BanData->banneeID);
if (killerData)
 killerCallSign = killerData->callsign.c_str();

std::string message;

message = std::string("Player ")+ killerCallSign + std::string(" Baned!");
bz_sendTextMessage(BZ_SERVER, BZ_ALLUSERS,message.c_str());
///////////

if(pausecount == 0){
/////////////////////////////////
bz_setBZDBDouble("_tankSpeed",25.0);
bz_setBZDBDouble("_shotSpeed",100.0);
bz_setBZDBDouble("_jumpVelocity",19.0);
/////////////////////////////////
bz_resumeCountdown("Server");

}

}
///////////////////////////////////////////////////
//Kick
void kick::process( bz_EventData *eventData ){

std::string soundToPlay;
  if (eventData->eventType != bz_eKickEvent)
    return;

bz_KickEventData *kickData = (bz_KickEventData*)eventData;

if(Userpause[kickData->kickedID] == 1){ 
Userpause[kickData->kickedID] = 0; 
pausecount=pausecount-1;
}

///////////
std::string killerCallSign = "UNKNOWN";
bz_PlayerRecord	*killerData;

killerData = bz_getPlayerByIndex(kickData->kickedID);
if (killerData)
 killerCallSign = killerData->callsign.c_str();

std::string message;

message = std::string("Player ")+ killerCallSign + std::string(" Kicked!");
bz_sendTextMessage(BZ_SERVER, BZ_ALLUSERS,message.c_str());
///////////
if(pausecount == 0){
/////////////////////////////////
bz_setBZDBDouble("_tankSpeed",25.0);
bz_setBZDBDouble("_shotSpeed",100.0);
bz_setBZDBDouble("_jumpVelocity",19.0);
/////////////////////////////////
bz_resumeCountdown("Server");

}
}
///////////////////////////////////////////////////
//DIE
void die::process( bz_EventData *eventData ){
std::string soundToPlay;
  if (eventData->eventType != bz_ePlayerDieEvent)
    return;
bz_PlayerDieEventData *dieData = (bz_PlayerDieEventData*)eventData;

if(pausecount != 0){
int playerToUse = BZ_SERVER;
///////////////////////////////////
std::string killerCallSign = "UNKNOWN";
bz_PlayerRecord	*killerData;

killerData = bz_getPlayerByIndex(dieData->killerID);
if (killerData)
 killerCallSign = killerData->callsign.c_str();

std::string message;

message = std::string("Player ")+ killerCallSign + std::string(" do kill a Player! DO not kill!!!!!!");
bz_killPlayer(dieData->killerID,true,dieData->playerID);
bz_sendPlayCustomLocalSound ( dieData->killerID, "killteam" );
//bz_sendTextMessage(playerToUse, joinData->playerID,message.c_str());

//bz_sendTextMessage(BZ_SERVER, BZ_ALLUSERS,"Player Paused!! Do not Play !!!");
bz_sendTextMessage(BZ_SERVER, BZ_ALLUSERS,message.c_str());

///////////////////////////////


}

}
///////////////////////////////////////////////////
//shot
void schuss::process( bz_EventData *eventData ){
std::string soundToPlay;
  if (eventData->eventType != bz_eShotFiredEvent)
    return;

bz_ShotFiredEventData *FiredData = (bz_ShotFiredEventData*)eventData;

if(pausecount != 0){
  int playerToUse = BZ_SERVER;

 // Kill the player when he shote!
 /*

 float reloadTime = (float)bz_getBZDBDouble("_reloadTime");

 if (bz_BZDBItemExists("_swDeathReloadFactor") && bz_getBZDBDouble("_swDeathReloadFactor") > 0)
 reloadTime *= (float)bz_getBZDBDouble("_swDeathReloadFactor");

bz_fireWorldWep("SW",reloadTime,playerToUse,FiredData->pos,0,0,0,0.0f);
*/
bz_sendTextMessage(BZ_SERVER, BZ_ALLUSERS,"Player Paused!! Do not Play !!!");
}


}
///////////////////////////////////////////////////
//End Game
void stop::process( bz_EventData *eventData ){
std::string soundToPlay;
  if (eventData->eventType != bz_eGameEndEvent)
    return;

    bz_resetTeamScores();
	bz_resetFlags(true);
isstartg = 0;
}

///////////////////////////////////////////////////
//Start Game
void start::process( bz_EventData *eventData ){
std::string soundToPlay;
  if (eventData->eventType != bz_eGameStartEvent)
    return;
  	//bz_sendTextMessage(BZ_SERVER, BZ_ALLUSERS, " ");
	//bz_sendTextMessage(BZ_SERVER, BZ_ALLUSERS, "Have fun! Do not Cheat!");
	//bz_sendTextMessage(BZ_SERVER, BZ_ALLUSERS, "Good Luck!");
    bz_resetTeamScores();
	bz_resetFlags(true);
isstartg = 1;
}

///////////////////////////////////////////////////
//player go pause
void playerPause::process(bz_EventData *eventData)
{
	std::string soundToPlay;
  if (eventData->eventType != bz_ePlayerPausedEvent)
    return;

bz_GameStartEndEventData *gameData = (bz_GameStartEndEventData*)eventData;
bz_PlayerPausedEventData *pauseData = (bz_PlayerPausedEventData*)eventData;


if(isstartg == 1){

std::string killerCallSign = "UNKNOWN";
bz_PlayerRecord	*killerData;

killerData = bz_getPlayerByIndex(pauseData->player);
if (killerData)
 killerCallSign = killerData->callsign.c_str();

std::string message;

if(Userpause[pauseData->player] == 0){ Userpause[pauseData->player] = 1; 
message = std::string("Player ")+ killerCallSign + std::string(" go pause! Game Paused!");
//bz_sendTextMessage(playerToUse, joinData->playerID,message.c_str());


bz_sendTextMessage(BZ_SERVER, BZ_ALLUSERS,message.c_str());
/////////////////////////////////
bz_setBZDBDouble("_tankSpeed",0.0);
bz_setBZDBDouble("_shotSpeed",0.0);
bz_setBZDBDouble("_jumpVelocity",0.0);
/////////////////////////////////
bz_pauseCountdown("Server");
pausecount=pausecount+1;
} else {
pausecount=pausecount-1;
if(pausecount == 0){
message = std::string("Player ")+ killerCallSign + std::string(" is Resume! Game Resume!");
//bz_sendTextMessage(playerToUse, joinData->playerID,message.c_str());


bz_sendTextMessage(BZ_SERVER, BZ_ALLUSERS,message.c_str());
/////////////////////////////////
bz_setBZDBDouble("_tankSpeed",25.0);
bz_setBZDBDouble("_shotSpeed",100.0);
bz_setBZDBDouble("_jumpVelocity",19.0);
/////////////////////////////////
bz_resumeCountdown("Server");

Userpause[pauseData->player] = 0;

} else {
	message = std::string("Player ")+ killerCallSign + std::string(" is Resume! ");
//bz_sendTextMessage(playerToUse, joinData->playerID,message.c_str());


bz_sendTextMessage(BZ_SERVER, BZ_ALLUSERS,message.c_str());
Userpause[pauseData->player] = 0;

}
}

}

}

// Local Variables: ***
// mode:C++ ***
// tab-width: 8 ***
// c-basic-offset: 2 ***
// indent-tabs-mode: t ***
// End: ***
// ex: shiftwidth=2 tabstop=8




edit:

i find no "CustomSlashCommand" in the play history tracker
Clan: Links
Clan web: http://links-clan.net
ImageImageImageImageImageImageImageImageImageImage
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5196
Joined: Fri Dec 13, 2002 4:11 am

Post by JeffM »

umm yeah an atachment, link, or PM would have been fine.

I'll have to set that up to build.


your right, I was incorect, it's chat history, not play history, that does the custom slash commands.
ImageJeffM
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5196
Joined: Fri Dec 13, 2002 4:11 am

Post by JeffM »

your code is rather complex and I'm not sure how it works. so I just made a simple sample. I don't want to go and debug your entire plugin for you.

the function works fine ( set the speed to 100 ).

perhaps your code isn't doing what you think it's doing.
Attachments
SAMPLE_PLUGIN.cpp
(583 Bytes) Downloaded 302 times
ImageJeffM
User avatar
Links 2004
Private First Class
Private First Class
Posts: 85
Joined: Sat Jan 01, 2005 6:54 pm
Location: Ger
Contact:

Post by Links 2004 »

i have make:

bz_setBZDBDouble("_shotSpeed",0.0);

in my code but the tank speed is´n 0
Clan: Links
Clan web: http://links-clan.net
ImageImageImageImageImageImageImageImageImageImage
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5196
Joined: Fri Dec 13, 2002 4:11 am

Post by JeffM »

0 is not a valid value for tank speed. the system will detect it as an invalid set and prevent it from being used.

tank speed was not meant to be used to stop tanks.
ImageJeffM
User avatar
Links 2004
Private First Class
Private First Class
Posts: 85
Joined: Sat Jan 01, 2005 6:54 pm
Location: Ger
Contact:

Post by Links 2004 »

new in V 1.0.5:

pausemode:

set _tankAngVel to 0.000001
set _tankSpeed to 0.000001

resumemode:

set _tankAngVel to 0.785398
set _tankSpeed to 25

comands:
/pause <-- make the game pause and stop all tanks
/resume <-- make the game resume alowe to swam
Attachments
Playerpausemakegamepause.zip
V 1.0.5
(8.15 KiB) Downloaded 295 times
Clan: Links
Clan web: http://links-clan.net
ImageImageImageImageImageImageImageImageImageImage
Post Reply