mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-25 06:15:37 +03:00
set_user_footsteps()
This commit is contained in:
parent
680caf60c2
commit
942ebf6562
136
dlls/fun/fun.cpp
136
dlls/fun/fun.cpp
@ -615,6 +615,41 @@ static cell AMX_NATIVE_CALL get_user_noclip(AMX *amx, cell *params) // get_user_
|
||||
return pPlayer->v.movetype == MOVETYPE_NOCLIP;
|
||||
}
|
||||
|
||||
// JustinHoMi made this one originally
|
||||
static cell AMX_NATIVE_CALL set_user_footsteps(AMX *amx, cell *params) // set_user_footsteps(id, set = 1); = 2 params
|
||||
{
|
||||
// Gives player silent footsteps.
|
||||
// if set=0 it will return footsteps to normal
|
||||
// params[1] = index of player
|
||||
// params[2] = 0 = normal footstep sound, 1 = silent slippers
|
||||
|
||||
// Check index
|
||||
if (params[1] < 1 || params[1] > gpGlobals->maxClients)
|
||||
{
|
||||
AMX_RAISEERROR(amx, AMX_ERR_NATIVE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Fetch player pointer
|
||||
edict_t *pPlayer = INDEXENT(params[1]);
|
||||
|
||||
// Check validity.
|
||||
if (FNullEnt(pPlayer)) {
|
||||
AMX_RAISEERROR(amx, AMX_ERR_NATIVE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (params[2]) {
|
||||
pPlayer->v.flTimeStepSound = 999;
|
||||
silent[params[1]] = true;
|
||||
}
|
||||
else {
|
||||
pPlayer->v.flTimeStepSound = STANDARDTIMESTEPSOUND;
|
||||
silent[params[1]] = false;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
AMX_NATIVE_INFO fun_Exports[] = {
|
||||
{"get_client_listen", get_client_listening},
|
||||
@ -624,7 +659,6 @@ AMX_NATIVE_INFO fun_Exports[] = {
|
||||
{"set_user_health", set_user_health},
|
||||
{"give_item", give_item},
|
||||
{"spawn", spawn},
|
||||
//{"user_spawn", spawn}, // No, it's not a typo! Uses the same as "spawn", because they do the same stuff! This is made only to maintain comp. with old plugins!
|
||||
{"set_user_money", set_user_money},
|
||||
{"get_user_money", get_user_money},
|
||||
{"set_user_deaths_cs", set_user_deaths_cs},
|
||||
@ -640,11 +674,111 @@ AMX_NATIVE_INFO fun_Exports[] = {
|
||||
{"get_hitzones", get_hitzones},
|
||||
{"set_user_noclip", set_user_noclip},
|
||||
{"get_user_noclip", get_user_noclip},
|
||||
{"set_user_footsteps", set_user_footsteps},
|
||||
/////////////////// <--- 19 chars max in current small version
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
/******************************************************************************************/
|
||||
void PlayerPreThink( edict_t *pEntity)
|
||||
{
|
||||
int index = ENTINDEX(pEntity);
|
||||
|
||||
if (silent[index]) {
|
||||
pEntity->v.flTimeStepSound = 999;
|
||||
RETURN_META(MRES_HANDLED);
|
||||
}
|
||||
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
void ClientDisconnect( edict_t *pEntity)
|
||||
{
|
||||
int index = ENTINDEX(pEntity);
|
||||
silent[index] = false;
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
DLL_FUNCTIONS gFunctionTable = {
|
||||
NULL, // pfnGameInit
|
||||
NULL, // pfnSpawn
|
||||
NULL, // pfnThink
|
||||
NULL, // pfnUse
|
||||
NULL, // pfnTouch
|
||||
NULL, // pfnBlocked
|
||||
NULL, // pfnKeyValue
|
||||
NULL, // pfnSave
|
||||
NULL, // pfnRestore
|
||||
NULL, // pfnSetAbsBox
|
||||
|
||||
NULL, // pfnSaveWriteFields
|
||||
NULL, // pfnSaveReadFields
|
||||
|
||||
NULL, // pfnSaveGlobalState
|
||||
NULL, // pfnRestoreGlobalState
|
||||
NULL, // pfnResetGlobalState
|
||||
|
||||
NULL, // pfnClientConnect
|
||||
ClientDisconnect, // pfnClientDisconnect
|
||||
NULL, // pfnClientKill
|
||||
NULL, // pfnClientPutInServer
|
||||
NULL, // pfnClientCommand
|
||||
NULL, // pfnClientUserInfoChanged
|
||||
NULL, // pfnServerActivate
|
||||
NULL, // pfnServerDeactivate
|
||||
|
||||
PlayerPreThink, // pfnPlayerPreThink
|
||||
NULL, // pfnPlayerPostThink
|
||||
|
||||
NULL, // pfnStartFrame
|
||||
NULL, // pfnParmsNewLevel
|
||||
NULL, // pfnParmsChangeLevel
|
||||
|
||||
NULL, // pfnGetGameDescription
|
||||
NULL, // pfnPlayerCustomization
|
||||
|
||||
NULL, // pfnSpectatorConnect
|
||||
NULL, // pfnSpectatorDisconnect
|
||||
NULL, // pfnSpectatorThink
|
||||
|
||||
NULL, // pfnSys_Error
|
||||
|
||||
NULL, // pfnPM_Move
|
||||
NULL, // pfnPM_Init
|
||||
NULL, // pfnPM_FindTextureType
|
||||
|
||||
NULL, // pfnSetupVisibility
|
||||
NULL, // pfnUpdateClientData
|
||||
NULL, // pfnAddToFullPack
|
||||
NULL, // pfnCreateBaseline
|
||||
NULL, // pfnRegisterEncoders
|
||||
NULL, // pfnGetWeaponData
|
||||
NULL, // pfnCmdStart
|
||||
NULL, // pfnCmdEnd
|
||||
NULL, // pfnConnectionlessPacket
|
||||
NULL, // pfnGetHullBounds
|
||||
NULL, // pfnCreateInstancedBaselines
|
||||
NULL, // pfnInconsistentFile
|
||||
NULL, // pfnAllowLagCompensation
|
||||
};
|
||||
|
||||
C_DLLEXPORT int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion)
|
||||
{
|
||||
if(!pFunctionTable) {
|
||||
LOG_ERROR(PLID, "GetEntityAPI2 called with null pFunctionTable");
|
||||
return(FALSE);
|
||||
}
|
||||
else if(*interfaceVersion != INTERFACE_VERSION) {
|
||||
LOG_ERROR(PLID, "GetEntityAPI2 version mismatch; requested=%d ours=%d", *interfaceVersion, INTERFACE_VERSION);
|
||||
//! Tell metamod what version we had, so it can figure out who is out of date.
|
||||
*interfaceVersion = INTERFACE_VERSION;
|
||||
return(FALSE);
|
||||
}
|
||||
memcpy(pFunctionTable, &gFunctionTable, sizeof(DLL_FUNCTIONS));
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
/********/
|
||||
|
||||
void TraceLine(const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr)
|
||||
{
|
||||
|
@ -15,7 +15,7 @@ globalvars_t *gpGlobals; // JGHG says: contains info on server, like maxclien
|
||||
static META_FUNCTIONS gMetaFunctionTable = {
|
||||
NULL, // pfnGetEntityAPI HL SDK; called before game DLL
|
||||
NULL, // pfnGetEntityAPI_Post META; called after game DLL
|
||||
NULL, // pfnGetEntityAPI2 HL SDK2; called before game DLL
|
||||
GetEntityAPI2, // pfnGetEntityAPI2 HL SDK2; called before game DLL
|
||||
NULL, // pfnGetEntityAPI2_Post META; called after game DLL
|
||||
NULL, // pfnGetNewDLLFunctions HL SDK2; called before game DLL
|
||||
NULL, // pfnGetNewDLLFunctions_Post META; called after game DLL
|
||||
@ -37,7 +37,8 @@ pfnmodule_engine_g* g_engModuleFunc; // These seem to be meta/amxmod related
|
||||
#define CVAR_FUN_VERSION "fun_version"
|
||||
#define GETCLIENTLISTENING (*g_engfuncs.pfnVoice_GetClientListening)
|
||||
#define SETCLIENTLISTENING (*g_engfuncs.pfnVoice_SetClientListening)
|
||||
#define SF_NORESPAWN ( 1 << 30 )// !!!set this bit on guns and stuff that should never respawn.
|
||||
#define SF_NORESPAWN (1 << 30)// !!!set this bit on guns and stuff that should never respawn.
|
||||
#define STANDARDTIMESTEPSOUND 400
|
||||
|
||||
#if defined __linux__
|
||||
#define OFFSET_CSMONEY 115 + 5
|
||||
@ -55,6 +56,7 @@ pfnmodule_engine_g* g_engModuleFunc; // These seem to be meta/amxmod related
|
||||
#define HITGROUP_RIGHTARM 5
|
||||
#define HITGROUP_LEFTLEG 6
|
||||
#define HITGROUP_RIGHTLEG 7
|
||||
|
||||
// Fun-specific defines above
|
||||
|
||||
// Globals below
|
||||
@ -76,6 +78,7 @@ module_info_s module_info = {
|
||||
AMX_INTERFACE_VERSION,
|
||||
RELOAD_MODULE,
|
||||
};
|
||||
int g_body = 0; // bits of parts of body to hit
|
||||
cvar_t fun_version = {"fun_version", "0.1", FCVAR_EXTDLL};
|
||||
int g_body = 0; // bits of parts of body to hit
|
||||
bool silent[33]; // used for set_user_footsteps()
|
||||
// Globals above
|
||||
|
@ -94,3 +94,7 @@ native set_user_noclip(index, noclip = 0);
|
||||
|
||||
/* Returns 1 if noclip is set. */
|
||||
native get_user_noclip(index);
|
||||
|
||||
/* Gives player silent footsteps.
|
||||
* if set = 0 it will return footsteps to normal */
|
||||
native set_user_footsteps(id, set = 1);
|
||||
|
Loading…
Reference in New Issue
Block a user