This reverts commit bee4b47b07
.
This commit is contained in:
parent
bee4b47b07
commit
70d1aff519
|
@ -799,26 +799,6 @@ static cell AMX_NATIVE_CALL is_user_connected(AMX *amx, cell *params) /* 1 param
|
||||||
|
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
|
|
||||||
if(pPlayer->IsBot())
|
|
||||||
{
|
|
||||||
// For legacy bot's
|
|
||||||
// which are using is_user_connected
|
|
||||||
// to check out is bot connected to server
|
|
||||||
return (pPlayer->initialized ? 1 : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (pPlayer->ingame ? 1 : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL is_user_connected_ex(AMX *amx, cell *params) /* 1 param */
|
|
||||||
{
|
|
||||||
int index = params[1];
|
|
||||||
|
|
||||||
if (index < 1 || index > gpGlobals->maxClients)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
|
||||||
|
|
||||||
return (pPlayer->ingame ? 1 : 0);
|
return (pPlayer->ingame ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4796,7 +4776,6 @@ AMX_NATIVE_INFO amxmodx_Natives[] =
|
||||||
{"is_user_authorized", is_user_authorized},
|
{"is_user_authorized", is_user_authorized},
|
||||||
{"is_user_bot", is_user_bot},
|
{"is_user_bot", is_user_bot},
|
||||||
{"is_user_connected", is_user_connected},
|
{"is_user_connected", is_user_connected},
|
||||||
{"is_user_connected_ex", is_user_connected_ex},
|
|
||||||
{"is_user_connecting", is_user_connecting},
|
{"is_user_connecting", is_user_connecting},
|
||||||
{"is_user_hltv", is_user_hltv},
|
{"is_user_hltv", is_user_hltv},
|
||||||
{"lang_exists", lang_exists},
|
{"lang_exists", lang_exists},
|
||||||
|
|
|
@ -1021,19 +1021,7 @@ void C_ClientUserInfoChanged_Post(edict_t *pEntity, char *infobuffer)
|
||||||
if (pPlayer->ingame)
|
if (pPlayer->ingame)
|
||||||
{
|
{
|
||||||
pPlayer->name =name; // Make sure player have name up to date
|
pPlayer->name =name; // Make sure player have name up to date
|
||||||
}
|
} else if (pEntity && pEntity->pvPrivateData && pPlayer->IsBot()) {
|
||||||
else
|
|
||||||
if(infobuffer /* just for safety */
|
|
||||||
&& pEntity
|
|
||||||
&& pEntity->pvPrivateData /* have a private data (same as player) */
|
|
||||||
&& pPlayer->initialized /* needless check due strstr, but we should confirm that there's no putinserver before client_connect */
|
|
||||||
&& pPlayer->IsBot() && strstr(infobuffer, "\\*bot\\1")) {
|
|
||||||
|
|
||||||
pPlayer->PutInServer();
|
|
||||||
++g_players_num;
|
|
||||||
executeForwards(FF_ClientPutInServer, static_cast<cell>(pPlayer->index));
|
|
||||||
}
|
|
||||||
else if (pEntity && pPlayer->IsBot()) {
|
|
||||||
pPlayer->Connect(name, "127.0.0.1"/*CVAR_GET_STRING("net_address")*/);
|
pPlayer->Connect(name, "127.0.0.1"/*CVAR_GET_STRING("net_address")*/);
|
||||||
|
|
||||||
executeForwards(FF_ClientConnect, static_cast<cell>(pPlayer->index));
|
executeForwards(FF_ClientConnect, static_cast<cell>(pPlayer->index));
|
||||||
|
@ -1051,6 +1039,11 @@ void C_ClientUserInfoChanged_Post(edict_t *pEntity, char *infobuffer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
executeForwards(FF_ClientAuthorized, static_cast<cell>(pPlayer->index), authid);
|
executeForwards(FF_ClientAuthorized, static_cast<cell>(pPlayer->index), authid);
|
||||||
|
|
||||||
|
pPlayer->PutInServer();
|
||||||
|
++g_players_num;
|
||||||
|
|
||||||
|
executeForwards(FF_ClientPutInServer, static_cast<cell>(pPlayer->index));
|
||||||
}
|
}
|
||||||
|
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
|
|
|
@ -943,32 +943,12 @@ native is_user_authorized(index);
|
||||||
* 1 to MaxClients range. That means you can safely use this native
|
* 1 to MaxClients range. That means you can safely use this native
|
||||||
* without manually verifying that the index is a valid client index.
|
* without manually verifying that the index is a valid client index.
|
||||||
*
|
*
|
||||||
* @note Due back-compatibility return's true after bot proceed client_connect
|
|
||||||
* stage (when bot's pdata isn't created yet).
|
|
||||||
*
|
|
||||||
* @note Use is_user_connected_ex to check player against real connection state
|
|
||||||
*
|
|
||||||
* @param index Client index
|
* @param index Client index
|
||||||
*
|
*
|
||||||
* @return 1 if client is connected, 0 otherwise
|
* @return 1 if client is connected, 0 otherwise
|
||||||
* always returns 1 if bot passed client_connect stage
|
|
||||||
*/
|
*/
|
||||||
native is_user_connected(index);
|
native is_user_connected(index);
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Returns if the client is fully connected (proceed client_putinserver state).
|
|
||||||
*
|
|
||||||
* @note This does not throw an error if the provided index is out of the
|
|
||||||
* 1 to MaxClients range. That means you can safely use this native
|
|
||||||
* without manually verifying that the index is a valid client index.
|
|
||||||
*
|
|
||||||
* @param index Client index
|
|
||||||
*
|
|
||||||
* @return 1 if bot is connected, 0 otherwise
|
|
||||||
*/
|
|
||||||
native is_user_connected_ex(const index);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns if the client is connecting.
|
* Returns if the client is connecting.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user