Skip to content

Commit

Permalink
Player: GetJumpOrigin
Browse files Browse the repository at this point in the history
  • Loading branch information
Iswenzz committed Nov 7, 2022
1 parent 2f0870a commit e0b6c69
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/player.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ rightMove = player GetRightMove();
```
<hr>

#### ``<client> GetJumpOrigin()``
Get the player's jump origin Z.

```c
jumpOrigin = player GetJumpOrigin();
```
<hr>

#### ``<client> PmFlags()``
Get the player's movement flags.

Expand Down
1 change: 1 addition & 0 deletions src/plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ PCL int OnInit()
METHOD("getip", &GScr_GetIP);
METHOD("getforwardmove", &GScr_GetForwardMove);
METHOD("getrightmove", &GScr_GetRightMove);
METHOD("getjumporigin", &GScr_GetJumpOrigin);
METHOD("pmflags", &GScr_PmFlags);
METHOD("setpmflags", &GScr_SetPmFlags);
METHOD("pmtime", &GScr_PmTime);
Expand Down
13 changes: 13 additions & 0 deletions src/utils/player.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,19 @@ void GScr_GetRightMove(scr_entref_t num)
Plugin_Scr_AddInt((int)cl->lastUsercmd.rightmove);
}

void GScr_GetJumpOrigin(scr_entref_t num)
{
gentity_t* ent = Plugin_GetGentityForEntityNum(num);

if (!ent || !ent->client)
{
Plugin_Scr_ObjectError("not a client\n");
return;
}

Plugin_Scr_AddInt(ent->client->ps.jumpOriginZ);
}

void GScr_PmFlags(scr_entref_t num)
{
gentity_t *ent = Plugin_GetGentityForEntityNum(num);
Expand Down
5 changes: 5 additions & 0 deletions src/utils/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ void GScr_GetIP(scr_entref_t num);
/// </summary>
void GScr_GetRightMove(scr_entref_t num);

/// <summary>
/// Get the player's jump origin Z.
/// </summary>
void GScr_GetJumpOrigin(scr_entref_t num);

/// <summary>
/// Get the player's forward move state.
/// </summary>
Expand Down

0 comments on commit e0b6c69

Please sign in to comment.