From ee40926d1d5075c0d246e969552ec14dfb0ef7b7 Mon Sep 17 00:00:00 2001 From: gsd Date: Wed, 24 Jan 2024 18:53:47 +0300 Subject: [PATCH] road 2 map --- ext/sourcepawn-client/Facti13BackendIntegration.sp | 7 +++++++ .../app/entities/server/request/PlayerOnServer.java | 13 ++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/ext/sourcepawn-client/Facti13BackendIntegration.sp b/ext/sourcepawn-client/Facti13BackendIntegration.sp index 51d52dc..b5ce727 100644 --- a/ext/sourcepawn-client/Facti13BackendIntegration.sp +++ b/ext/sourcepawn-client/Facti13BackendIntegration.sp @@ -136,6 +136,13 @@ stock JSONObject createPayload() { char steam2[32]; GetClientAuthId(client, AuthId_Steam3, steam2, sizeof(steam2)); player.SetString("steam2", steam2); + /* Position on map */ + float pos[3]; + GetClientAbsOrigin(client, pos); + player.SetFloat("pos_x", pos[0]); + player.SetFloat("pos_y", pos[1]); + player.SetFloat("pos_z", pos[2]); + /* push */ players.Push(player); } diff --git a/src/main/java/app/entities/server/request/PlayerOnServer.java b/src/main/java/app/entities/server/request/PlayerOnServer.java index e052211..5b1dc27 100644 --- a/src/main/java/app/entities/server/request/PlayerOnServer.java +++ b/src/main/java/app/entities/server/request/PlayerOnServer.java @@ -2,10 +2,21 @@ package app.entities.server.request; import app.entities.server.players.RCONPlayer; import com.fasterxml.jackson.annotation.JsonGetter; +import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; @Data public class PlayerOnServer extends RCONPlayer { - float[] pos = {}; + + @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + float pos_x = 0.0F; + @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + float pos_y = 0.0F; + @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + float pos_z = 0.0F; //int duration_seconds = 0; + @JsonGetter + public float[] getPos() { + return new float[]{pos_x, pos_y, pos_z}; + } } \ No newline at end of file