@@ -220,12 +220,6 @@ void InitiateVote(MapChange when, Handle inputlist=INVALID_HANDLE)
220220 randomizeList = INVALID_HANDLE ;
221221 }
222222
223- /* Wipe out our nominations list - Nominations have already been informed of this */
224- g_NominateCount = 0 ;
225- g_NominateReservedCount = 0 ;
226- ClearArray (g_NominateOwners );
227- ClearArray (g_NominateList );
228-
229223 if (! g_bExtendPositionTop ) {
230224 if (InternalGetMapMaxExtends (map ) - g_Extends > 0 )
231225 FormatEx (allMapsBuffer , allMapsSize , " %s \n - %s " , allMapsBuffer , " Extend" );
@@ -362,6 +356,7 @@ public void Handler_VoteFinishedGeneric(Handle menu,
362356 g_HasVoteStarted = false ;
363357 g_PendingRevoteActive = false ;
364358 SetupTimeleftTimer ();
359+ ClearNominationsLists ();
365360
366361 }
367362 else if (strcmp (map , VOTE_DONTCHANGE , false ) == 0 )
@@ -380,6 +375,7 @@ public void Handler_VoteFinishedGeneric(Handle menu,
380375 g_HasVoteStarted = false ;
381376 g_PendingRevoteActive = false ;
382377 SetupTimeleftTimer ();
378+ ClearNominationsLists ();
383379 }
384380 else
385381 {
@@ -408,47 +404,79 @@ public void Handler_VoteFinishedGeneric(Handle menu,
408404
409405 int percent = RoundToFloor (float (item_info [0 ][VOTEINFO_ITEM_VOTES ])/ float (num_votes )* 100.0 );
410406
411- // Check who nominated the map
412- char sPlayer [32 ];
413- for (int i = 1 ; i <= MaxClients ; i ++ )
407+ int owner = - 1 ;
408+ bool foundNomination = false ;
409+
410+ if (g_bShowNominator )
414411 {
415- if (strcmp (g_sNominations [i ], map , false ) != 0 )
416- continue ;
417- if (! IsClientInGame (i ))
418- continue ;
419- FormatEx (sPlayer , sizeof (sPlayer ), " %N " , i );
420- break ;
412+ static char nominatedMap [PLATFORM_MAX_PATH ];
413+ int nominateCount = GetArraySize (g_NominateList );
414+ for (int i = 0 ; i < nominateCount ; i ++ )
415+ {
416+ GetArrayString (g_NominateList , i , nominatedMap , sizeof (nominatedMap ));
417+ if (strcmp (nominatedMap , map , false ) == 0 )
418+ {
419+ owner = GetArrayCell (g_NominateOwners , i );
420+ foundNomination = true ;
421+ break ;
422+ }
423+ }
421424 }
422425
423- char mapInChat [64 ];
424- strcopy (mapInChat , sizeof (mapInChat ), map );
425- int mapTier ;
426- if (InternalShowMapTierInChat () && (mapTier = InternalGetMapTier (map )) && mapTier > 0 )
426+ // Cache Nominator Name
427+ char ownerName [MAX_NAME_LENGTH ];
428+ bool isOwnerConnected = (g_bShowNominator && foundNomination && owner > 0 && IsClientInGame (owner ));
429+ if (isOwnerConnected )
430+ GetClientName (owner , ownerName , sizeof (ownerName ));
431+
432+ // Cache Map Display Name with Tier (Static)
433+ char mapInChat [128 ];
434+ int mapTier = InternalGetMapTier (map );
435+ if (InternalShowMapTierInChat () && mapTier > 0 )
427436 {
428437 char tierName [32 ];
429438 InternalGetTierNameFromInt (mapTier , tierName , sizeof (tierName ));
430- Format (mapInChat , sizeof (mapInChat ), " %s %t " , map , " MapTierDisplay" , tierName );
431- }
432-
433- if (sPlayer [0 ] && g_bShowNominator )
434- {
435- CPrintToChatAll (" {green } [MCE]{default } %t - %t %s " , " Nextmap Voting Finished" , mapInChat , percent , num_votes , " Nominated by" , sPlayer );
436- LogAction (- 1 , - 1 , " [MCE] Voting for next map has finished. \n Nextmap: %s . (Received \" %d \" \% % of %d votes) Nominated by %s " , map , percent , num_votes , sPlayer );
439+ FormatEx (mapInChat , sizeof (mapInChat ), " %s (%s )" , map , tierName );
437440 }
438441 else
439442 {
440- CPrintToChatAll (" {green } [MCE]{default } %t " , " Nextmap Voting Finished" , mapInChat , percent , num_votes );
441- LogAction (- 1 , - 1 , " [MCE] Voting for next map has finished. \n Nextmap: %s . (Received \" %d \" \% % of %d votes)" , map , percent , num_votes );
443+ strcopy (mapInChat , sizeof (mapInChat ), map );
442444 }
443445
444- // Vote has finished, clear nominations
446+ // Per-client chat loop
445447 for (int i = 1 ; i <= MaxClients ; i ++ )
446448 {
447- if (! IsClientConnected (i ) || ! IsClientInGame ( i ))
449+ if (! IsClientInGame (i ) || ( IsFakeClient ( i ) && ! IsClientSourceTV ( i ) ))
448450 continue ;
449451
452+ CPrintToChat (i , " {green } [MCE]{default } %t " , " Nextmap Voting Finished" , mapInChat , percent , num_votes );
453+
454+ if (g_bShowNominator && foundNomination && owner > 0 )
455+ {
456+ if (isOwnerConnected )
457+ CPrintToChat (i , " {green } [MCE]{default } %t %s " , " Nominated by" , ownerName );
458+ else
459+ CPrintToChat (i , " {green } [MCE]{default } %t %t " , " Nominated by" , " Disconnected Player" );
460+ }
461+
450462 ClearStoredNomination (i );
451463 }
464+
465+ // Build Log String (Server Language)
466+ char sPlayerLog [128 ];
467+ if (g_bShowNominator && foundNomination && owner > 0 )
468+ {
469+ SetGlobalTransTarget (LANG_SERVER );
470+ if (isOwnerConnected )
471+ FormatEx (sPlayerLog , sizeof (sPlayerLog ), " \n %t %s " , " Nominated by" , ownerName );
472+ else
473+ FormatEx (sPlayerLog , sizeof (sPlayerLog ), " \n %t %t " , " Nominated by" , " Disconnected Player" );
474+ }
475+
476+ LogAction (- 1 , - 1 , " [MCE] Voting for next map has finished. \n Nextmap: %s . (Received \" %d \" %% of %d votes)%s " ,
477+ map , percent , num_votes , sPlayerLog );
478+
479+ ClearNominationsLists ();
452480 }
453481}
454482
0 commit comments