fixing Unranked style getting credits to fix issue ()

This commit is contained in:
SaengerItsWar 2021-01-18 16:37:13 +01:00
parent 7dafd29d28
commit a37dee48af
3 changed files with 92 additions and 6 deletions

Binary file not shown.

View file

@ -425,6 +425,32 @@ stock void FormatSeconds(float time, char[] newtime, int newtimesize, bool preci
}
}
stock bool GuessBestMapName(ArrayList maps, const char[] input, char[] output, int size)
{
if(maps.FindString(input) != -1)
{
strcopy(output, size, input);
return true;
}
char sCache[128];
for(int i = 0; i < maps.Length; i++)
{
maps.GetString(i, sCache, 128);
if(StrContains(sCache, input) != -1)
{
strcopy(output, size, sCache);
return true;
}
}
return false;
}
/**
* Called before shavit-core processes the client's usercmd.
* Before this is called, safety checks (fake/dead clients) happen.
@ -585,9 +611,10 @@ forward void Shavit_OnWorldRecord(int client, int style, float time, int jumps,
* @param style Style the record was done on.
* @param id Record ID. -1 if mass deletion.
* @param track Timer track.
* @param accountid The account ID of the wr holder
* @noreturn
*/
forward void Shavit_OnWRDeleted(int style, int id, int track);
forward void Shavit_OnWRDeleted(int style, int id, int track, int accountid);
/**
* Called when a player's timer paused.
@ -672,6 +699,15 @@ forward Action Shavit_OnTeleport(int client, int index);
*/
forward Action Shavit_OnSave(int client, int index, bool overflow);
/**
* Called when a player deletes a checkpoint.
*
* @param client Client index.
* @param index Checkpoint that will be deleted.
* @return Plugin_Continue to continue deletion, anything else to prevent.
*/
forward Action Shavit_OnDelete(int client, int index);
/**
* Called when a player enters a zone.
*
@ -835,7 +871,7 @@ forward void Shavit_OnTimescaleChanged(int client, float oldtimescale, float new
forward Action Shavit_OnCheckPointMenuMade(int client, bool segmented);
/**
* Called when before a selection is processed in the main checkpoint menu.
* Called before a selection is processed in the main checkpoint menu.
*
* @param client Client index.
* @param param2 Second parameter in the callback, usually the item selected.
@ -847,6 +883,34 @@ forward Action Shavit_OnCheckPointMenuMade(int client, bool segmented);
*/
forward Action Shavit_OnCheckpointMenuSelect(int client, int param2, char[] info, int maxlength, int currentCheckpoint, int maxCPs);
/**
* Called before a sound is played by shavit-sounds.
*
* @param client Index of the client that triggered the sound event.
* @param sound Reference to the sound that will be played.
* @param maxlength Length of the sound buffer, always PLATFORM_MAX_PATH.
* @param clients Reference to the array of clients to receive the sound, maxsize of MaxClients.
* @param count Reference to the number of clients to receive the sound.
* @return Plugin_Handled or Plugin_Stop to block the sound from being played. Anything else to continue the operation.
*/
forward Action Shavit_OnPlaySound(int client, char[] sound, int maxlength, int[] clients, int &count);
/**
* Called before the server & timer handle the ProcessMovement method.
*
* @param client Client Index.
* @noreturn
*/
forward void Shavit_OnProcessMovement(int client);
/**
* Called After the server handles the ProcessMovement method, but before the timer handles the method.
*
* @param client Client Index.
* @noreturn
*/
forward void Shavit_OnProcessMovementPost(int client);
/**
* Returns the game type the server is running.
*
@ -1013,6 +1077,15 @@ native int Shavit_GetBhopStyle(int client);
*/
native TimerStatus Shavit_GetTimerStatus(int client);
/**
* Retrieve the zone ID for a given stage number.
* Will return exception if stagenumber doesn't have a zone.
*
* @param client Stage number.
* @return Zone ID of stage.
*/
native int Shavit_GetStageZone(int stage);
/**
* Retrieve the amount of strafes done since the timer started.
* Will return 0 if timer isn't running.
@ -1111,6 +1184,17 @@ native void Shavit_GetPlayerPB(int client, int style, float &time, int track);
*/
native float Shavit_GetClientPB(int client, int style, int track);
/**
* Sets the cached pb directly for the given client, style and track.
*
* @param client Client index.
* @param style Style to get the PB for.
* @param track Timer track.
* @param time Time to set
* @noreturn
*/
native void Shavit_SetClientPB(int client, int style, int track, float time);
/**
* Retrieves the completions of a player.
*
@ -1246,9 +1330,10 @@ native float Shavit_GetDistanceOffset(int client, int zonetype);
* @param map Map display name.
* @param style Bhop style.
* @param track Timer track.
* @return true if replay existed, false otherwise.
* @param accountid Account ID to validate against, 0 to skip validation.
* @return true if replay existed, false if the steam id didn't match or the file didn't exist.
*/
native bool Shavit_DeleteReplay(const char[] map, int style, int track);
native bool Shavit_DeleteReplay(const char[] map, int style, int track, int accountid = 0);
/**
* Retrieves the engine time of the replay bot's first frame.
@ -1899,6 +1984,7 @@ public void __pl_shavit_SetNTVOptional()
MarkNativeAsOptional("Shavit_GetReplayName");
MarkNativeAsOptional("Shavit_GetReplayStatus");
MarkNativeAsOptional("Shavit_GetReplayTime");
MarkNativeAsOptional("Shavit_GetStageZone");
MarkNativeAsOptional("Shavit_GetStrafeCount");
MarkNativeAsOptional("Shavit_GetStyleCount");
MarkNativeAsOptional("Shavit_GetStyleSettings");

View file

@ -144,7 +144,7 @@ public void Shavit_OnFinish(int client, int style, float time, int jumps, int st
char sStyleSpecialString[sizeof(stylestrings_t::sSpecialString)];
Shavit_GetStyleStrings(style, sSpecialString, sStyleSpecialString, sizeof(sStyleSpecialString));
if (StrContains(sStyleSpecialString, "segments") != -1)
if (StrContains(sStyleSpecialString, "segments") != -1 || gA_StyleSettings[style].bUnranked)
return;
if (!g_cvTasEnabled.BoolValue)
@ -341,7 +341,7 @@ public void Shavit_OnWorldRecord(int client, int style, float time, int jumps, i
char sStyleSpecialString[sizeof(stylestrings_t::sSpecialString)];
Shavit_GetStyleStrings(style, sSpecialString, sStyleSpecialString, sizeof(sStyleSpecialString));
if (StrContains(sStyleSpecialString, "segments") != -1)
if (StrContains(sStyleSpecialString, "segments") != -1 || gA_StyleSettings[style].bUnranked)
return;
if (!g_cvTasEnabled.BoolValue)