From 287b8ef9ef727d4c5c6dd054f45c21f61503d681 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kau=C3=AA?= Date: Wed, 10 Jan 2024 16:10:33 -0300 Subject: [PATCH] Default value of timers (#820) Timers need to be reset to 0 --- docs/scripting/functions/GetPlayerPing.md | 6 +++--- docs/scripting/functions/KillTimer.md | 4 ++-- docs/scripting/functions/SetVehicleParamsEx.md | 6 +++--- docs/translations/bs/scripting/functions/KillTimer.md | 4 ++-- .../bs/scripting/functions/SetVehicleParamsEx.md | 6 +++--- docs/translations/th/scripting/functions/GetPlayerPing.md | 6 +++--- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/docs/scripting/functions/GetPlayerPing.md b/docs/scripting/functions/GetPlayerPing.md index df13ee939..eb5b7404a 100644 --- a/docs/scripting/functions/GetPlayerPing.md +++ b/docs/scripting/functions/GetPlayerPing.md @@ -20,9 +20,9 @@ The current ping of the player (expressed in milliseconds). ```c // Declare an array of all possible timer identifiers for timers for kicking players with -// generally high ping with default value of -1 +// generally high ping with default value of 0 new - gPlayerPingTimer[MAX_PLAYERS] = {-1, ...}; + gPlayerPingTimer[MAX_PLAYERS] = {0, ...}; // A constant (nice documentation :)) const @@ -38,7 +38,7 @@ public OnPlayerDisconnect(playerid, reason) { // Kill the timer and reset the value to invalid KillTimer(gPlayerPingTimer[playerid]); - gPlayerPingTimer[playerid] = -1; + gPlayerPingTimer[playerid] = 0; } // A forwarded function (callback) diff --git a/docs/scripting/functions/KillTimer.md b/docs/scripting/functions/KillTimer.md index fa1c4e7f1..217b87a19 100644 --- a/docs/scripting/functions/KillTimer.md +++ b/docs/scripting/functions/KillTimer.md @@ -20,7 +20,7 @@ This function always returns 0. ```c new - gConnectTimer[MAX_PLAYERS] = {-1, ...}; + gConnectTimer[MAX_PLAYERS] = {0, ...}; public OnPlayerConnect(playerid) { @@ -32,7 +32,7 @@ public OnPlayerConnect(playerid) public OnPlayerDisconnect(playerid) { KillTimer(gConnectTimer[playerid]); - gConnectTimer[playerid] = -1; + gConnectTimer[playerid] = 0; return 1; } diff --git a/docs/scripting/functions/SetVehicleParamsEx.md b/docs/scripting/functions/SetVehicleParamsEx.md index 118ff041b..a78feffd2 100644 --- a/docs/scripting/functions/SetVehicleParamsEx.md +++ b/docs/scripting/functions/SetVehicleParamsEx.md @@ -32,7 +32,7 @@ Sets a vehicle's parameters for all players. ```c // On top of our script, declaring a global variable new - gVehicleAlarmTimer[MAX_VEHICLES] = {-1, ...}; + gVehicleAlarmTimer[MAX_VEHICLES] = {0, ...}; // If setting a single parameter, you should obtain the current parameters so they aren't ALL changed new @@ -50,7 +50,7 @@ SetVehicleParamsEx_Fixed(vehicleid, &engine, &lights, &alarm, &doors, &bonnet, & { // Kill the timer, reset the timer identifier and then restart it if it was already running KillTimer(gVehicleAlarmTimer[vehicleid]); - gVehicleAlarmTimer[vehicleid] = -1; + gVehicleAlarmTimer[vehicleid] = 0; gVehicleAlarmTimer[vehicleid] = SetTimerEx("DisableVehicleAlarm", 20000, false, "d", vehicleid); } } @@ -68,7 +68,7 @@ public DisableVehicleAlarm(vehicleid) } // Reset the timer identifier - gVehicleAlarmTimer[vehicleid] = -1; + gVehicleAlarmTimer[vehicleid] = 0; } ``` diff --git a/docs/translations/bs/scripting/functions/KillTimer.md b/docs/translations/bs/scripting/functions/KillTimer.md index fc42343b0..4371c1772 100644 --- a/docs/translations/bs/scripting/functions/KillTimer.md +++ b/docs/translations/bs/scripting/functions/KillTimer.md @@ -20,7 +20,7 @@ Ova funkcija uvijek returna/vraća 0. ```c new - gConnectTimer[MAX_PLAYERS] = {-1, ...}; + gConnectTimer[MAX_PLAYERS] = {0, ...}; public OnPlayerConnect(playerid) { @@ -32,7 +32,7 @@ public OnPlayerConnect(playerid) public OnPlayerDisconnect(playerid) { KillTimer(gConnectTimer[playerid]); - gConnectTimer[playerid] = -1; + gConnectTimer[playerid] = 0; return 1; } diff --git a/docs/translations/bs/scripting/functions/SetVehicleParamsEx.md b/docs/translations/bs/scripting/functions/SetVehicleParamsEx.md index b8f49c514..049127271 100644 --- a/docs/translations/bs/scripting/functions/SetVehicleParamsEx.md +++ b/docs/translations/bs/scripting/functions/SetVehicleParamsEx.md @@ -36,7 +36,7 @@ Postavlja parametre vozila za sve igrače. ```c // Na vrhu naše skripte, deklarišemo globalnu varijablu new - gVehicleAlarmTimer[MAX_VEHICLES] = {-1, ...}; + gVehicleAlarmTimer[MAX_VEHICLES] = {0, ...}; // Ako postavljate jedan parametar, trebali biste dobiti trenutne parametre kako se ne bi SVE promijenili new @@ -54,7 +54,7 @@ SetVehicleParamsEx_Fixed(vehicleid, &engine, &lights, &alarm, &doors, &bonnet, & { // Ubij tajmer, resetirajte identifikator tajmera, a zatim ga ponovo pokrenite ako je već bio pokrenut KillTimer(gVehicleAlarmTimer[vehicleid]); - gVehicleAlarmTimer[vehicleid] = -1; + gVehicleAlarmTimer[vehicleid] = 0; gVehicleAlarmTimer[vehicleid] = SetTimerEx("DisableVehicleAlarm", 20000, false, "d", vehicleid); } } @@ -72,7 +72,7 @@ public DisableVehicleAlarm(vehicleid) } // Reset the timer identifier - gVehicleAlarmTimer[vehicleid] = -1; + gVehicleAlarmTimer[vehicleid] = 0; } ``` diff --git a/docs/translations/th/scripting/functions/GetPlayerPing.md b/docs/translations/th/scripting/functions/GetPlayerPing.md index 14e961cc1..81bf134c7 100644 --- a/docs/translations/th/scripting/functions/GetPlayerPing.md +++ b/docs/translations/th/scripting/functions/GetPlayerPing.md @@ -20,9 +20,9 @@ The current ping of the player (expressed in milliseconds). ```c // Declare an array of all possible timer identifiers for timers for kicking players with -// generally high ping with default value of -1 +// generally high ping with default value of 0 new - gPlayerPingTimer[MAX_PLAYERS] = {-1, ...}; + gPlayerPingTimer[MAX_PLAYERS] = {0, ...}; // A constant (nice documentation :)) const @@ -38,7 +38,7 @@ public OnPlayerDisconnect(playerid, reason) { // Kill the timer and reset the value to invalid KillTimer(gPlayerPingTimer[playerid]); - gPlayerPingTimer[playerid] = -1; + gPlayerPingTimer[playerid] = 0; } // A forwarded function (callback)