mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-24 13:55:36 +03:00
some changes in bot's code
This commit is contained in:
parent
3155a300c6
commit
796a7ad4d7
@ -91,7 +91,6 @@ void CPlayer::PutInServer(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CPlayer::Connect(const char* address ){
|
void CPlayer::Connect(const char* address ){
|
||||||
bot = IsBot();
|
|
||||||
strcpy(ip,address);
|
strcpy(ip,address);
|
||||||
rank = 0;
|
rank = 0;
|
||||||
clearStats = 0.0f;
|
clearStats = 0.0f;
|
||||||
|
@ -21,7 +21,6 @@ struct CPlayer {
|
|||||||
int index;
|
int index;
|
||||||
int aiming;
|
int aiming;
|
||||||
int current;
|
int current;
|
||||||
bool bot;
|
|
||||||
float clearStats;
|
float clearStats;
|
||||||
RankSystem::RankStats* rank;
|
RankSystem::RankStats* rank;
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
// *****************************************************
|
// *****************************************************
|
||||||
|
|
||||||
void CPlayer::Disconnect(){
|
void CPlayer::Disconnect(){
|
||||||
ingame = staminaSet = fuseSet = false;
|
ingame = staminaSet = fuseSet = bot = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlayer::PutInServer(){
|
void CPlayer::PutInServer(){
|
||||||
@ -55,7 +55,7 @@ void CPlayer::Init( int pi, edict_t* pe )
|
|||||||
pEdict = pe;
|
pEdict = pe;
|
||||||
index = pi;
|
index = pi;
|
||||||
current = 0;
|
current = 0;
|
||||||
ingame = staminaSet = false;
|
ingame = staminaSet = fuseSet = bot = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,6 +90,7 @@ void Grenades::clear()
|
|||||||
|
|
||||||
void CPlayer::Disconnect(){
|
void CPlayer::Disconnect(){
|
||||||
ingame = false;
|
ingame = false;
|
||||||
|
bot = false;
|
||||||
savedScore = 0;
|
savedScore = 0;
|
||||||
|
|
||||||
if ( ignoreBots(pEdict) || !isModuleActive() ) // ignore if he is bot and bots rank is disabled or module is paused
|
if ( ignoreBots(pEdict) || !isModuleActive() ) // ignore if he is bot and bots rank is disabled or module is paused
|
||||||
@ -150,6 +151,7 @@ void CPlayer::Init( int pi, edict_t* pe )
|
|||||||
current = 0;
|
current = 0;
|
||||||
clearStats = 0.0f;
|
clearStats = 0.0f;
|
||||||
ingame = false;
|
ingame = false;
|
||||||
|
bot = false;
|
||||||
savedScore = 0;
|
savedScore = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,13 +195,13 @@ void ServerDeactivate() {
|
|||||||
|
|
||||||
BOOL ClientConnect_Post( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] ){
|
BOOL ClientConnect_Post( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] ){
|
||||||
GET_PLAYER_POINTER(pEntity)->Connect(pszName,pszAddress);
|
GET_PLAYER_POINTER(pEntity)->Connect(pszName,pszAddress);
|
||||||
|
|
||||||
RETURN_META_VALUE(MRES_IGNORED, TRUE);
|
RETURN_META_VALUE(MRES_IGNORED, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientDisconnect( edict_t *pEntity ) {
|
void ClientDisconnect( edict_t *pEntity ) {
|
||||||
CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity);
|
CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity);
|
||||||
|
|
||||||
if (pPlayer->ingame)
|
if (pPlayer->ingame)
|
||||||
pPlayer->Disconnect();
|
pPlayer->Disconnect();
|
||||||
|
|
||||||
|
@ -93,6 +93,7 @@ void Grenades::clear()
|
|||||||
void CPlayer::Disconnect(){
|
void CPlayer::Disconnect(){
|
||||||
|
|
||||||
ingame = false;
|
ingame = false;
|
||||||
|
bot = false;
|
||||||
|
|
||||||
if ( ignoreBots(pEdict) || !isModuleActive() ) // ignore if he is bot and bots rank is disabled or module is paused
|
if ( ignoreBots(pEdict) || !isModuleActive() ) // ignore if he is bot and bots rank is disabled or module is paused
|
||||||
return;
|
return;
|
||||||
@ -145,6 +146,8 @@ void CPlayer::Init( int pi, edict_t* pe )
|
|||||||
current = 0;
|
current = 0;
|
||||||
clearStats = 0.0f;
|
clearStats = 0.0f;
|
||||||
rank = 0;
|
rank = 0;
|
||||||
|
ingame = false;
|
||||||
|
bot = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlayer::saveKill(CPlayer* pVictim, int wweapon, int hhs, int ttk){
|
void CPlayer::saveKill(CPlayer* pVictim, int wweapon, int hhs, int ttk){
|
||||||
|
@ -75,7 +75,6 @@ void CPlayer::PutInServer(){
|
|||||||
ingame = false;
|
ingame = false;
|
||||||
}
|
}
|
||||||
void CPlayer::Connect( const char* ippp ){
|
void CPlayer::Connect( const char* ippp ){
|
||||||
bot = IsBot();
|
|
||||||
strcpy(ip,ippp);
|
strcpy(ip,ippp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,6 @@ struct CPlayer {
|
|||||||
int frags; // suma dla kontroli ostatniego fraga, to - v.frags = lastfrag
|
int frags; // suma dla kontroli ostatniego fraga, to - v.frags = lastfrag
|
||||||
|
|
||||||
bool ingame;
|
bool ingame;
|
||||||
bool bot;
|
|
||||||
float clearStats;
|
float clearStats;
|
||||||
|
|
||||||
struct PlayerWeapon : public Stats {
|
struct PlayerWeapon : public Stats {
|
||||||
@ -117,6 +116,7 @@ struct CPlayer {
|
|||||||
void saveHit(CPlayer* pVictim, int weapon, int damage, int aiming);
|
void saveHit(CPlayer* pVictim, int weapon, int damage, int aiming);
|
||||||
void saveShot(int weapon);
|
void saveShot(int weapon);
|
||||||
void restartStats(bool all = true);
|
void restartStats(bool all = true);
|
||||||
|
|
||||||
inline bool IsBot(){
|
inline bool IsBot(){
|
||||||
const char* auth= (*g_engfuncs.pfnGetPlayerAuthId)(pEdict);
|
const char* auth= (*g_engfuncs.pfnGetPlayerAuthId)(pEdict);
|
||||||
return ( auth && !strcmp( auth , "BOT" ) );
|
return ( auth && !strcmp( auth , "BOT" ) );
|
||||||
|
@ -188,7 +188,7 @@ void ClientUserInfoChanged_Post( edict_t *pEntity, char *infobuffer ) {
|
|||||||
const char* name = INFOKEY_VALUE(infobuffer,"name");
|
const char* name = INFOKEY_VALUE(infobuffer,"name");
|
||||||
const char* oldname = STRING(pEntity->v.netname);
|
const char* oldname = STRING(pEntity->v.netname);
|
||||||
|
|
||||||
if ( pPlayer->ingame){
|
if ( pPlayer->ingame ){
|
||||||
if ( strcmp(oldname,name) ) {
|
if ( strcmp(oldname,name) ) {
|
||||||
if (!tsstats_rank->value)
|
if (!tsstats_rank->value)
|
||||||
pPlayer->rank = g_rank.findEntryInRank( name, name );
|
pPlayer->rank = g_rank.findEntryInRank( name, name );
|
||||||
@ -197,7 +197,6 @@ void ClientUserInfoChanged_Post( edict_t *pEntity, char *infobuffer ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( pPlayer->IsBot() ) {
|
else if ( pPlayer->IsBot() ) {
|
||||||
pPlayer->Connect( "127.0.0.1" );
|
|
||||||
pPlayer->PutInServer();
|
pPlayer->PutInServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user