summaryrefslogtreecommitdiff
path: root/sourcemod/scripting/include/gokz/racing.inc
diff options
context:
space:
mode:
authornavewindre <nw@moneybot.cc>2023-12-04 18:06:10 +0100
committernavewindre <nw@moneybot.cc>2023-12-04 18:06:10 +0100
commitaef0d1c1268ab7d4bc18996c9c6b4da16a40aadc (patch)
tree43e766b51704f4ab8b383583bdc1871eeeb9c698 /sourcemod/scripting/include/gokz/racing.inc
parent38f1140c11724da05a23a10385061200b907cf6e (diff)
bbbbbbbbwaaaaaaaaaaa
Diffstat (limited to 'sourcemod/scripting/include/gokz/racing.inc')
-rw-r--r--sourcemod/scripting/include/gokz/racing.inc189
1 files changed, 189 insertions, 0 deletions
diff --git a/sourcemod/scripting/include/gokz/racing.inc b/sourcemod/scripting/include/gokz/racing.inc
new file mode 100644
index 0000000..d6819ea
--- /dev/null
+++ b/sourcemod/scripting/include/gokz/racing.inc
@@ -0,0 +1,189 @@
+/*
+ gokz-racing Plugin Include
+
+ Website: https://bitbucket.org/kztimerglobalteam/gokz
+*/
+
+#if defined _gokz_racing_included_
+#endinput
+#endif
+#define _gokz_racing_included_
+
+
+
+// =====[ ENUMS ]=====
+
+enum RaceInfo:
+{
+ RaceInfo_ID,
+ RaceInfo_Status,
+ RaceInfo_HostUserID,
+ RaceInfo_FinishedRacerCount,
+ RaceInfo_Type,
+ RaceInfo_Course,
+ RaceInfo_Mode,
+ RaceInfo_CheckpointRule,
+ RaceInfo_CooldownRule,
+ RACEINFO_COUNT
+};
+
+enum
+{
+ RaceType_Normal,
+ RaceType_Duel,
+ RACETYPE_COUNT
+};
+
+enum
+{
+ RaceStatus_Pending,
+ RaceStatus_Countdown,
+ RaceStatus_Started,
+ RaceStatus_Aborting,
+ RACESTATUS_COUNT
+};
+
+enum
+{
+ RacerStatus_Available,
+ RacerStatus_Pending,
+ RacerStatus_Accepted,
+ RacerStatus_Racing,
+ RacerStatus_Finished,
+ RacerStatus_Surrendered,
+ RACERSTATUS_COUNT
+};
+
+enum
+{
+ CheckpointRule_None,
+ CheckpointRule_Limit,
+ CheckpointRule_Cooldown,
+ CheckpointRule_Unlimited,
+ CHECKPOINTRULE_COUNT
+};
+
+
+
+// =====[ CONSTANTS ]=====
+
+#define RC_COUNTDOWN_TIME 10.0
+#define RC_REQUEST_TIMEOUT_TIME 15.0
+
+
+
+// =====[ FORWARDS ]=====
+
+/**
+ * Called when a player has finished their race.
+ *
+ * @param client Client index.
+ * @param raceID ID of the race.
+ * @param place Final placement in the race.
+ */
+forward void GOKZ_RC_OnFinish(int client, int raceID, int place);
+
+/**
+ * Called when a player has surrendered their race.
+ *
+ * @param client Client index.
+ * @param raceID ID of the race.
+ */
+forward void GOKZ_RC_OnSurrender(int client, int raceID);
+
+/**
+ * Called when a player receives a race request.
+ *
+ * @param client Client index.
+ * @param raceID ID of the race.
+ */
+forward void GOKZ_RC_OnRequestReceived(int client, int raceID)
+
+/**
+ * Called when a player accepts a race request.
+ *
+ * @param client Client index.
+ * @param raceID ID of the race.
+ */
+forward void GOKZ_RC_OnRequestAccepted(int client, int raceID)
+
+/**
+ * Called when a player declines a race request.
+ *
+ * @param client Client index.
+ * @param raceID ID of the race.
+ * @param timeout Whether the client was too late to respond.
+ */
+forward void GOKZ_RC_OnRequestDeclined(int client, int raceID, bool timeout)
+
+/**
+ * Called when a race has been registered.
+ * The initial status of a race is RaceStatus_Pending.
+ *
+ * @param raceID ID of the race.
+ */
+forward void GOKZ_RC_OnRaceRegistered(int raceID);
+
+/**
+ * Called when a race's info property has changed.
+ *
+ * @param raceID ID of the race.
+ * @param prop Info property that was changed.
+ * @param oldValue Previous value.
+ * @param newValue New value.
+ */
+forward void GOKZ_RC_OnRaceInfoChanged(int raceID, RaceInfo prop, int oldValue, int newValue);
+
+
+
+// =====[ NATIVES ]=====
+
+/**
+ * Gets the value of a race info property.
+ *
+ * @param raceID Race index.
+ * @param prop Info property to get.
+ * @return Value of the info property.
+ */
+native int GOKZ_RC_GetRaceInfo(int raceID, RaceInfo prop);
+
+/**
+ * Gets a player's racer status.
+ * Refer to the RacerStatus enumeration.
+ *
+ * @param client Client index.
+ * @return Racer status of the client.
+ */
+native int GOKZ_RC_GetStatus(int client);
+
+/**
+ * Gets the ID of the race a player is in.
+ *
+ * @param client Client index.
+ * @return ID of the race the player is in, or -1 if not in a race.
+ */
+native int GOKZ_RC_GetRaceID(int client);
+
+
+
+// =====[ DEPENDENCY ]=====
+
+public SharedPlugin __pl_gokz_racing =
+{
+ name = "gokz-racing",
+ file = "gokz-racing.smx",
+ #if defined REQUIRE_PLUGIN
+ required = 1,
+ #else
+ required = 0,
+ #endif
+};
+
+#if !defined REQUIRE_PLUGIN
+public void __pl_gokz_racing_SetNTVOptional()
+{
+ MarkNativeAsOptional("GOKZ_RC_GetRaceInfo");
+ MarkNativeAsOptional("GOKZ_RC_GetStatus");
+ MarkNativeAsOptional("GOKZ_RC_GetRaceID");
+}
+#endif \ No newline at end of file