diff --git a/addons/sourcemod/scripting/include/umc-core.inc b/addons/sourcemod/scripting/include/umc-core.inc index 20ad8c2..21e8557 100644 --- a/addons/sourcemod/scripting/include/umc-core.inc +++ b/addons/sourcemod/scripting/include/umc-core.inc @@ -46,6 +46,7 @@ public __pl_umccore_SetNTVOptional() MarkNativeAsOptional("UMC_VoteManagerClientVoted"); MarkNativeAsOptional("UMC_FormatDisplayString"); MarkNativeAsOptional("UMC_IsNewVoteAllowed"); + MarkNativeAsOptional("UMC_ForceChangeMap"); } #define INVALID_GROUP "" @@ -359,6 +360,15 @@ forward UMC_OnNextmapSet(Handle:kv, const String:map[], const String:group[], */ forward UMC_RequestReloadMapcycle(); +/** + * Called immediately after UMC ForceChangeMap Native was called + * + * @param time The time before the map change + * + * @noreturn + */ +forward UMC_OnForceMapChange(const Float:time); + /** * Retrieves the name of the current map group. @@ -519,3 +529,8 @@ native UMC_FormatDisplayString(String:display[], maxlen, Handle:mapcycle, const * @return True if we can start a new vote, false otherwise. */ native bool:UMC_IsNewVoteAllowed(const String:id[]="core"); + +/** + * Changes the map after the specified time period. + */ +native UMC_ForceChangeMap(const String:map[], Float:time, const String:reason[]=""); \ No newline at end of file diff --git a/addons/sourcemod/scripting/include/umc_utils.inc b/addons/sourcemod/scripting/include/umc_utils.inc index 7098886..e67f9d7 100644 --- a/addons/sourcemod/scripting/include/umc_utils.inc +++ b/addons/sourcemod/scripting/include/umc_utils.inc @@ -250,7 +250,7 @@ enum CustomHudFallbackType { HudFallback_Chat, HudFallback_Hint, HudFallback_Center, - HudFallback_None + HudFallback_None } //Color Arrays for colors in warning messages. @@ -425,7 +425,7 @@ public Action:Timer_CenterAd(Handle:timer, Handle:pack) // // stock TF2_SendCustomHudMessage(client, const String:icon[], team=-1, CustomHudFallbackType:fallback, -// const String:format[], any:...) +// const String:format[], any:...) // { // decl String:message[256]; // VFormat(message, sizeof(message), format, 6); @@ -442,7 +442,7 @@ public Action:Timer_CenterAd(Handle:timer, Handle:pack) // // // stock TF2_SendCustomHudMessageAll(const String:icon[], team=-1, CustomHudFallbackType:fallback, -// const String:format[], any:...) +// const String:format[], any:...) // { // decl String:message[256]; // VFormat(message, sizeof(message), format, 5); @@ -465,7 +465,7 @@ public Action:Timer_CenterAd(Handle:timer, Handle:pack) // // // public MinModeCheckFinished(QueryCookie:cookie, uid, ConVarQueryResult:result, const String:cvarName[], -// const String:cvarValue[], any:pack) +// const String:cvarValue[], any:pack) // { // ResetPack(pack); // new client = GetClientOfUserId(ReadPackCell(pack)); @@ -634,44 +634,9 @@ stock ForceChangeInFive(const String:map[], const String:reason[]="") PrintToChatAll("\x03[UMC]\x01 %t", "Map Change in 5"); //Setup the change. - ForceChangeMap(map, 5.0, reason); + UMC_ForceChangeMap(map, 5.0, reason); } - -//Changes the map after the specified time period. -stock ForceChangeMap(const String:map[], Float:time, const String:reason[]="") -{ - LogUMCMessage("%s: Changing map to '%s' in %.f seconds.", reason, map, time); - - //Setup the timer. - new Handle:pack; - CreateDataTimer( - time, - Handle_MapChangeTimer, - pack, - TIMER_FLAG_NO_MAPCHANGE - ); - WritePackString(pack, map); - WritePackString(pack, reason); -} - - -//Called after the mapchange timer is completed. -public Action:Handle_MapChangeTimer(Handle:timer, Handle:pack) -{ - //Get map from the timer's pack. - decl String:map[MAP_LENGTH], String:reason[255]; - ResetPack(pack); - ReadPackString(pack, map, sizeof(map)); - ReadPackString(pack, reason, sizeof(reason)); - - DEBUG_MESSAGE("Changing map to %s: %s", map, reason) - - //Change the map. - ForceChangeLevel(map, reason); -} - - //Determines if the current server time is between the given min and max. stock bool:IsTimeBetween(min, max) { diff --git a/addons/sourcemod/scripting/umc-core.sp b/addons/sourcemod/scripting/umc-core.sp index a909e88..057d22b 100644 --- a/addons/sourcemod/scripting/umc-core.sp +++ b/addons/sourcemod/scripting/umc-core.sp @@ -611,6 +611,9 @@ new Handle:cvar_winlimit = INVALID_HANDLE; new Handle:cvar_nextlevel = INVALID_HANDLE; //GE:S +/* ForceChangeMap System */ +new Handle:forceChangeMap_forward = INVALID_HANDLE; + #if RUNTESTS RunTests() { @@ -652,6 +655,7 @@ public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max) CreateNative("UMC_VoteManagerClientVoted", Native_UMCVoteManagerVoted); CreateNative("UMC_FormatDisplayString", Native_UMCFormatDisplay); CreateNative("UMC_IsNewVoteAllowed", Native_UMCIsNewVoteAllowed); + CreateNative("UMC_ForceChangeMap", Native_UMCForceChangeMap); RegPluginLibrary("umccore"); @@ -868,6 +872,10 @@ public OnPluginStart() Param_String, Param_Cell, Param_Cell, Param_String, Param_String ); + forceChangeMap_forward = CreateGlobalForward( + "UMC_OnForceMapChange", ET_Ignore, Param_Cell + ); + vote_managers = CreateTrie(); vote_manager_ids = CreateArray(ByteCountToCells(64)); @@ -1269,7 +1277,7 @@ public Native_UMCUnregVoteManager(Handle:plugin, numParams) CloseHandle(hndl); GetTrieValue(vM, "checkprogress", hndl); CloseHandle(hndl); - + CloseHandle(vM); @@ -1892,6 +1900,41 @@ public Native_UMCGetCurrentGroup(Handle:plugin, numParams) SetNativeString(1, current_cat, GetNativeCell(2), false); } +//const String:map[], Float:time, const String:reason[]="" +public Native_UMCForceChangeMap(Handle:plugin, numParams) +{ + new mapLen; + GetNativeStringLength(1,mapLen); + new String:map[mapLen]; + GetNativeString(1, map, mapLen); + + new Float:time = Float:GetNativeCell(2); + + new reasonLen; + GetNativeStringLength(3,reasonLen); + new String:reason[reasonLen]; + GetNativeString(1, reason, reasonLen); + + LogUMCMessage("%s: Changing map to '%s' in %.f seconds.", reason, map, time); + + // Send an advertisment + Call_StartForward(forceChangeMap_forward); + Call_PushCell(time); + Call_Finish(); + + //Setup the timer. + new Handle:pack; + CreateDataTimer( + time, + Handle_MapChangeTimer, + pack, + TIMER_FLAG_NO_MAPCHANGE + ); + WritePackString(pack, map); + WritePackString(pack, reason); + +} + //************************************************************************************************// // COMMANDS // @@ -2029,7 +2072,7 @@ new bool:core_vote_active; public bool:VM_IsVoteInProgress() { - return IsVoteInProgress(); + return IsVoteInProgress(); } // @@ -2422,7 +2465,7 @@ bool:IsVMVoteInProgress(Handle:voteManager) new Handle:progressCheck; GetTrieValue(voteManager, "checkprogress", progressCheck); new bool:result; - + if (GetForwardFunctionCount(progressCheck) == 0) { result = IsVoteInProgress(); @@ -3395,7 +3438,7 @@ public UMC_OnFormatTemplateString(String:template[], maxlen, Handle:kv, const St DEBUG_MESSAGE("OFTS: '%s' '%s' '%s'", map, group, template) decl String:resolvedMap[MAP_LENGTH]; - + if (GetFeatureStatus(FeatureType_Native, "GetMapDisplayName") == FeatureStatus_Available) { // SM 1.8 @@ -4106,8 +4149,8 @@ Handle:BuildRunoffOptions(Handle:vM, Handle:clientArray) return newMenu; } - - + + //Called when the runoff timer for an end-of-map vote completes. public Action:Handle_RunoffVoteTimer(Handle:timer, Handle:datapack) { @@ -5560,4 +5603,17 @@ bool:GetRandomCat(Handle:kv, String:buffer[], size) return result; } - +//Called after the mapchange timer is completed. +public Action:Handle_MapChangeTimer(Handle:timer, Handle:pack) +{ + //Get map from the timer's pack. + decl String:map[MAP_LENGTH], String:reason[255]; + ResetPack(pack); + ReadPackString(pack, map, sizeof(map)); + ReadPackString(pack, reason, sizeof(reason)); + + DEBUG_MESSAGE("Changing map to %s: %s", map, reason) + + //Change the map. + ForceChangeLevel(map, reason); +} diff --git a/addons/sourcemod/translations/fr/ultimate-mapchooser-adminmenu.phrases.txt b/addons/sourcemod/translations/fr/ultimate-mapchooser-adminmenu.phrases.txt new file mode 100644 index 0000000..ff74557 --- /dev/null +++ b/addons/sourcemod/translations/fr/ultimate-mapchooser-adminmenu.phrases.txt @@ -0,0 +1,230 @@ +//Translation Phrases for the UMC Admin Menu module. + +"Phrases" +{ + "AM Stop Vote" + { + "fr" "Stop Current UMC Vote" + } + + "AM Start Vote" + { + "fr" "Start a Map Vote" + } + + "AM Vote Type" + { + "fr" "Select Vote Type" + } + + "Maps" + { + "fr" "Maps" + } + + "Groups" + { + "fr" "Groups" + } + + "Tiered" + { + "fr" "Tiered" + } + + "AM Populate Vote" + { + "fr" "Add Maps To Vote" + } + + "AM Vote Settings" + { + "fr" "Vote Settings" + } + + "AM-VS Defaults" + { + "fr" "Use Defaults" + } + + "Manually Choose" + { + "fr" "Manually Choose" + } + + "AM Scramble Menu" + { + "fr" "Scramble Vote Menu?" + } + + "Default Yes" + { + "fr" "Yes (default)" + } + + "Default No" + { + "fr" "No (default)" + } + + "AM Threshold Menu" + { + "fr" "Set Vote Threshold" + } + + "AM Threshold Menu Message 1" + { + "fr" "Type in chat what threshold you would" + } + + "AM Threshold Menu Message 2" + { + "fr" "like to set the vote to [0 to 100]." + } + + "Default" + { + "fr" "default" + } + + "Previously Entered" + { + "fr" "previously entered" + } + + "AM Fail Action Menu" + { + "fr" "Set Fail Action" + } + + "Do Nothing" + { + "fr" "Do Nothing" + } + + "Perform Runoff Vote" + { + "fr" "Perform Runoff Vote" + } + + "Default Do Nothing" + { + "fr" "Do Nothing (default)" + } + + "Default Perform Runoff Vote" + { + "fr" "Perform Runoff Vote (default)" + } + + "AM Max Runoff Menu" + { + "fr" "Set Maximum Amount of Runoffs" + } + + "AM Max Runoff Menu Message 1" + { + "fr" "Type in chat what maximum you would like" + } + + "AM Max Runoff Menu Message 2" + { + "fr" "to set the number of runoffs to (>= 0)." + } + + "AM Max Runoff Menu Message 3" + { + //Note to translators: keep the leading space in this phrase. + "fr" " 0 = unlimited" + } + + "AM Runoff Fail Action Menu" + { + "fr" "Set Runoff Fail Action" + } + + "Accept Winner" + { + "fr" "Accept Winner" + } + + "Default Accept Winner" + { + "fr" "Accept Winner (default)" + } + + "AM Extend Menu" + { + "fr" "Add Extend Map Option?" + } + + "AM Don't Change Menu" + { + "fr" "Add Don't Change Option?" + } + + "AM Admin Flag Menu" + { + "fr" "Make vote available to..." + } + + "Everyone" + { + "fr" "Everyone" + } + + "Admins Only" + { + "fr" "Admins Only" + } + + "AM Change When Menu" + { + "fr" "Change Map When?" + } + + "Now" + { + "fr" "Now" + } + + "End of Round" + { + "fr" "End Of This Round" + } + + "End of Map" + { + "fr" "End Of Map" + } + + "Select A Map" + { + "fr" "Select a Map" + } + + "Select A Group" + { + "fr" "Select a Group" + } + + "Auto Select" + { + "fr" "Auto Select" + } + + "Manual Select" + { + "fr" "Manual Select" + } + + "AM Change Map" + { + "fr" "Change Map" + } + + "AM Set Next Map" + { + "fr" "Set Next Map" + } +} \ No newline at end of file diff --git a/addons/sourcemod/translations/fr/ultimate-mapchooser.phrases.txt b/addons/sourcemod/translations/fr/ultimate-mapchooser.phrases.txt new file mode 100644 index 0000000..b7c4a79 --- /dev/null +++ b/addons/sourcemod/translations/fr/ultimate-mapchooser.phrases.txt @@ -0,0 +1,214 @@ +//Phrases for Ultimate Mapchooser by Steell + +"Phrases" +{ + "Slot Block Message 1" + { + "fr" "Quelle map veux-tu jouer ?" + } + + "Slot Block Message 2" + { + "fr" "Ne vote pas un abrutis." + } + + "Map Vote Menu Title" + { + "fr" "Vote pour la prochaine map!" + } + + "Group Vote Menu Title" + { + "fr" "Vote pour le prochain groupe de map!" + } + + "Extend Map" + { + "fr" "Etendre la map" + } + + "Don't Change" + { + "fr" "Ne pas changer" + } + + "End of Map Vote Over" + { + "fr" "Le vote est fini." + } + + "Map Extended" + { + "fr" "La map actuelle va être prolongée." + } + + "End of Map Vote Map Won" + { + "fr" "La prochaine map sera {1}." + } + + "Vote Win Percentage" + { + "fr" "Reçu {1}%% de {2} votes" + } + + "Map Unchanged" + { + "fr" "La map ne sera pas changée." + } + + "Map Change in 5" + { + "fr" "La map change dans 5 secondes !" + } + + "Map Change at Round End" + { + "fr" "Map will change at the end of this round." + } + + "End of Map Vote Group Won" + { + "fr" "La prochaine map sera '{1}', choisi depuis le groupe '{2}'." + } + + "Runoff Msg" + { + "fr" "Le vote a échoué ! La majorité n'a pas été atteinte." + } + + "Another Vote" + { + "fr" "Un autre vote arrive dans {1} secondes." + } + + "Player Disconnect RTV" + { + "fr" "Déconnexion du joueur qui a lancé le RTV." + } + + "Not Enough Players" + { + "fr" "Pas assez de joueur sur le serveur pour la prochaine map ({1} min)." + } + + "Too Many Players" + { + "fr" "Trop de joueur sur le serveur pour la prochaine map ({1} max)." + } + + "No RTV Player Count" + { + "fr" "Impossible de lancer un RTV avant que {1} joueurs en plus se connectent." + } + + "No RTV Nextmap" + { + "fr" "Impossible de lancer un RTV avant la prochaine map." + } + + "No RTV Time" + { + "fr" "Impossible de lancer un RTV avant {1} secondes." + } + + "More Required" + { + "fr" "{1} en plus requis" + } + + "RTV Entered" + { + "fr" "{1} veut lancer un RTV." + } + + "RTV Info Msg" + { + "fr" "Tape 'rtv' pour le rejoindre, ou tape 'nominate' pour nominer une map." + } + + "RTV Start" + { + "fr" "Rocking the Vote!" + } + + "Vote In Progress" + { + "fr" "Un vote est déjà en cours." + } + + "RTV Already Entered" + { + "fr" "Vous avez déjà rejoin le RTV." + } + + "No Nominate Nextmap" + { + "fr" "Impossible de nominer avant la prochaine map." + } + + "Pending Vote" + { + "fr" "Vote en cours" + } + + "Next Map" + { + "fr" "Prochaine map: {1}" + } + + "Player Nomination" + { + "fr" "{1} a nominé {2}." + } + + "Nomination Menu Title" + { + "fr" "Nominer une map." + } + + "Yes/No Menu Title" + { + "fr" "Changer la map pour {1}?" + } + + "Yes" + { + "fr" "Oui" + } + + "No" + { + "fr" "Non" + } + + "Starting Map Vote" + { + "fr" "Vote de la map démarré. La map changera une fois le vote fini." + } + + "Default Warning" + { + "fr" "{TIME} secondes avant le début du vote." + } + + "Vote Failed" + { + "fr" "Le vote a échoué. L'option gagnante n'a pas atteind un pourcentage suffisant." + } + + "Selective Runoff" + { + "fr" "Afficher le vote aux joueurs qui n'ont pas voté ou ceux dont le vote n'a pas été retenu." + } + + "No RTV Admin" + { + "fr" "Vous n'avez pas l'autorisation nécessaire pour lancer un RTV." + } + + "No Nominate Admin" + { + "fr" "Vous n'avez pas l'autorisation nécessaire pour nominer une map." + } +}