mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-26 06:45:37 +03:00
New stuff in cstrike module:
cs_get_user_driving() cs_set_user_tked() cs_get_user_tked Also cs_?et_user_deaths() offset updated. Thanks to Damaged Soul for these.
This commit is contained in:
parent
c3151b312a
commit
c669efd609
@ -1375,6 +1375,105 @@ static cell AMX_NATIVE_CALL cs_set_no_knives(AMX *amx, cell *params) // cs_set_n
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Damaged Soul
|
||||
static cell AMX_NATIVE_CALL cs_get_user_tked(AMX *amx, cell *params) // cs_get_user_tked(index); = 1 param
|
||||
{
|
||||
// Return 1 if user has committed a team killing)
|
||||
// params[1] = user index
|
||||
|
||||
// Check player
|
||||
if (!MF_IsPlayerIngame(params[1]))
|
||||
{
|
||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Make into edict pointer
|
||||
edict_t *pPlayer = INDEXENT(params[1]);
|
||||
|
||||
// Check entity validity
|
||||
if (FNullEnt(pPlayer)) {
|
||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return *((int *)pPlayer->pvPrivateData + OFFSET_TK);
|
||||
}
|
||||
|
||||
// Damaged Soul
|
||||
static cell AMX_NATIVE_CALL cs_set_user_tked(AMX *amx, cell *params) // cs_set_user_tked(index, tk = 1, subtract = 1); = 2 arguments
|
||||
{
|
||||
// Sets whether or not player has committed a TK.
|
||||
// params[1] = user
|
||||
// params[2] = 1: player has TKed, 0: player hasn't TKed
|
||||
// params[3] = number of frags to subtract
|
||||
|
||||
// Check index
|
||||
if (!MF_IsPlayerIngame(params[1]))
|
||||
{
|
||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Fetch player pointer
|
||||
edict_t *pPlayer = INDEXENT(params[1]);
|
||||
|
||||
// Check entity validity
|
||||
if (FNullEnt(pPlayer)) {
|
||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (params[2]) {
|
||||
*((int *)pPlayer->pvPrivateData + OFFSET_TK) = 1;
|
||||
} else {
|
||||
*((int *)pPlayer->pvPrivateData + OFFSET_TK) = 0;
|
||||
}
|
||||
|
||||
if (params[3]) {
|
||||
pPlayer->v.frags = pPlayer->v.frags - params[3];
|
||||
|
||||
MESSAGE_BEGIN(MSG_ALL, GET_USER_MSG_ID(PLID, "ScoreInfo", NULL));
|
||||
WRITE_BYTE(params[1]); // user index
|
||||
WRITE_SHORT((int)pPlayer->v.frags); // frags
|
||||
WRITE_SHORT(*((int *)pPlayer->pvPrivateData + OFFSET_CSDEATHS)); // deaths
|
||||
WRITE_SHORT(0); // ?
|
||||
WRITE_SHORT(*((int *)pPlayer->pvPrivateData + OFFSET_TEAM)); // team
|
||||
MESSAGE_END();
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL cs_get_user_driving(AMX *amx, cell *params) // cs_get_user_driving(index); = 1 param
|
||||
{
|
||||
// Returns different values depending on if user is driving a value - and if so at what speed.
|
||||
// 0: no driving
|
||||
// 1: driving, but standing still
|
||||
// 2-4: different positive speeds
|
||||
// 5: negative speed (backing)
|
||||
// params[1] = user index
|
||||
|
||||
// Check player
|
||||
if (!MF_IsPlayerIngame(params[1]))
|
||||
{
|
||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Make into edict pointer
|
||||
edict_t *pPlayer = INDEXENT(params[1]);
|
||||
|
||||
// Check entity validity
|
||||
if (FNullEnt(pPlayer)) {
|
||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// If player driving, return 1, if not, return 0
|
||||
return *((int *)pPlayer->pvPrivateData + OFFSET_ISDRIVING);
|
||||
}
|
||||
|
||||
AMX_NATIVE_INFO cstrike_Exports[] = {
|
||||
{"cs_set_user_money", cs_set_user_money},
|
||||
{"cs_get_user_money", cs_get_user_money},
|
||||
@ -1409,6 +1508,9 @@ AMX_NATIVE_INFO cstrike_Exports[] = {
|
||||
{"cs_get_no_knives", cs_get_no_knives},
|
||||
{"cs_set_no_knives", cs_set_no_knives},
|
||||
{"cs_get_weapon_type", cs_get_weapon_type},
|
||||
{"cs_get_user_tked", cs_get_user_tked},
|
||||
{"cs_set_user_tked", cs_set_user_tked},
|
||||
{"cs_get_user_driving", cs_get_user_driving},
|
||||
//------------------- <-- max 19 characters!
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
@ -52,6 +52,7 @@
|
||||
|
||||
// "player" entities
|
||||
#if !defined __amd64__
|
||||
// 32 bit offsets here
|
||||
#define OFFSET_TEAM 114 + EXTRAOFFSET
|
||||
#define OFFSET_CSMONEY 115 + EXTRAOFFSET
|
||||
#define OFFSET_PRIMARYWEAPON 116 + EXTRAOFFSET
|
||||
@ -59,7 +60,9 @@
|
||||
#define OFFSET_NVGOGGLES 129 + EXTRAOFFSET
|
||||
#define OFFSET_DEFUSE_PLANT 193 + EXTRAOFFSET
|
||||
#define OFFSET_VIP 209 + EXTRAOFFSET
|
||||
#define OFFSET_TK 216 + EXTRAOFFSET // 040926
|
||||
#define OFFSET_BUYZONE 235 + EXTRAOFFSET
|
||||
#define OFFSET_ISDRIVING 350 + EXTRAOFFSET // 040926
|
||||
|
||||
#define OFFSET_AWM_AMMO 382 + EXTRAOFFSET
|
||||
#define OFFSET_SCOUT_AMMO 383 + EXTRAOFFSET
|
||||
@ -76,7 +79,7 @@
|
||||
#define OFFSET_SMOKE_AMMO 394 + EXTRAOFFSET
|
||||
#define OFFSET_C4_AMMO 395 + EXTRAOFFSET
|
||||
|
||||
#define OFFSET_CSDEATHS 449 + EXTRAOFFSET
|
||||
#define OFFSET_CSDEATHS 444 + EXTRAOFFSET // 040926
|
||||
// "weapon_*" entities
|
||||
#define OFFSET_WEAPONTYPE 43 + EXTRAOFFSET
|
||||
#define OFFSET_CLIPAMMO 51 + EXTRAOFFSET
|
||||
@ -85,6 +88,7 @@
|
||||
#define OFFSET_HOSTAGEFOLLOW 86 + EXTRAOFFSET
|
||||
#define OFFSET_HOSTAGEID 487 + EXTRAOFFSET
|
||||
#else
|
||||
// Amd64 offsets here
|
||||
#define OFFSET_TEAM 139 + EXTRAOFFSET // +25
|
||||
#define OFFSET_CSMONEY 140 + EXTRAOFFSET // +25
|
||||
#define OFFSET_PRIMARYWEAPON 141 + EXTRAOFFSET // +25
|
||||
@ -92,7 +96,9 @@
|
||||
#define OFFSET_NVGOGGLES 155 + EXTRAOFFSET // +26
|
||||
#define OFFSET_DEFUSE_PLANT 219 + EXTRAOFFSET // +26
|
||||
#define OFFSET_VIP 242 + EXTRAOFFSET // +27
|
||||
#define OFFSET_TK å2äA;;#ÖAwä3ä2åa3ÖÄ2e;;åöA"Å! 1ö ÅÄ3åA"Ö <-- this needs to be researched for amd64 ;-) (likely +27 though!)
|
||||
#define OFFSET_BUYZONE 268 + EXTRAOFFSET // +27
|
||||
#define OFFSET_ISDRIVING å2äA#ÖAw;;ä3ä2åa3ÖÄ2eåöA;;"Å! 1ö ÅÄ3åA"Ö <-- this needs to be researched for amd64 ;-)
|
||||
|
||||
#define OFFSET_AWM_AMMO 426 + EXTRAOFFSET // +44
|
||||
#define OFFSET_SCOUT_AMMO 427 + EXTRAOFFSET // +44
|
||||
@ -109,7 +115,7 @@
|
||||
#define OFFSET_SMOKE_AMMO 438 + EXTRAOFFSET // +44
|
||||
#define OFFSET_C4_AMMO 439 + EXTRAOFFSET // +44
|
||||
|
||||
#define OFFSET_CSDEATHS 493 + EXTRAOFFSET // +44
|
||||
#define OFFSET_CSDEATHS 493 + EXTRAOFFSET // +49
|
||||
// "weapon_*" entities
|
||||
#define OFFSET_WEAPONTYPE 57 + EXTRAOFFSET // +14
|
||||
#define OFFSET_CLIPAMMO 65 + EXTRAOFFSET // +14
|
||||
|
@ -152,6 +152,26 @@ native cs_get_user_vip(index);
|
||||
*/
|
||||
native cs_set_user_vip(index, vip = 1);
|
||||
|
||||
/* Returns 1 of specified user has tk:ed (team killed).
|
||||
*/
|
||||
native cs_get_user_tked(index);
|
||||
|
||||
/* Returns 1 of specified user has TKed (team killed).
|
||||
* tk = 1: player has TKed
|
||||
* tk = 0: player hasn't TKed
|
||||
* Set subtract to how many frags to subtract. Set subtract to negative value to add frags.
|
||||
*/
|
||||
native cs_set_user_tked(index, tk = 1, subtract = 1);
|
||||
|
||||
/* Returns different values depending on if user is driving a value - and if so at what speed.
|
||||
* 0: no driving
|
||||
* 1: driving, but standing still
|
||||
* 2-4: driving, different positive speeds
|
||||
* 5: driving, negative speed (backing)
|
||||
* Note: these values were tested quickly, they may differ.
|
||||
*/
|
||||
native cs_get_user_driving(index);
|
||||
|
||||
/* Returns 1 if specified weapon is in burst mode.
|
||||
*/
|
||||
native cs_get_weapon_burst(index);
|
||||
|
Loading…
Reference in New Issue
Block a user