BigETI

SetMostVotedMap [TW]

Apr 29th, 2011
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.37 KB | None | 0 0
  1. #define MAX_TW_MAPS 28
  2.  
  3. #define SendRconCommandF(%0,%1);    UseBrackets\
  4.     {\
  5.     new formatstring[512];\
  6.     format(formatstring,sizeof(formatstring),%0,%1);\
  7.     SendRconCommand(formatstring);\
  8.     }
  9.  
  10. stock SetMostVotedMap()
  11. {
  12.     new getVotes[MAX_TW_MAPS], mostVotes, pendingvotes = 1, storemapsarray[MAX_TW_MAPS];
  13.     for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i)) if(GetPVarInt(playerid, "HasVoted") == 1) getVotes[GetPVarInt(playerid, "VoteMapID")]++;
  14.     for(new i = 0; i < MAX_TW_MAPS; i++)
  15.     {
  16.         if(mostvotes < getVotes[i])
  17.         {
  18.             pendingvotes = 1;
  19.             mostvotes = getVotes[i];
  20.             storemapsarray[0] = i;
  21.             for(new j = 1; j < MAX_TW_MAPS; j++) storemapsarray[j] = 0;
  22.         }
  23.         else if(mostvotes == getVotes[i])
  24.         {
  25.             storemapsarray[pendingvotes] = i;
  26.             pendingvotes++;
  27.         }
  28.     }
  29.     SendRconCommandF("changemode %s", MissionNames[storemapsarray[random(pendingvotes)]]};
  30. }
  31.  
  32. MissionNames[][32] = {
  33. {"MorningSun"},
  34. {"2060"},
  35. {"Oil"},
  36. {"CJ"},
  37. {"Area69"},
  38. {"TunnelFighting"},
  39. {"StairFight"},
  40. {"CellWars"},
  41. {"AttackTheOutpost"},
  42. {"BeatTheCock"},
  43. {"NarrowBattle"},
  44. {"AvenueRide"},
  45. {"BackyardCombat"},
  46. {"Fire"},
  47. {"FasterThenFastest"},
  48. {"FasterThenFastest 2"},
  49. {"GunGame"},
  50. {"LoveForTheHood"},
  51. {"TeritorryWar4"},
  52. {"TeritorryWar"},
  53. {"PrisonBreak"},
  54. {"Maps"},
  55. {"PrisonBreak2"},
  56. {"TheAttack"},
  57. {"SkyLift"},
  58. {"BusinessTown"},
  59. {"ContainerWars"},
  60. {"OperationX"}
  61. };
Advertisement
Add Comment
Please, Sign In to add comment