Advertisement
GiromB

G-Vote Kick

Apr 2nd, 2017
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.44 KB | None | 0 0
  1. /* -=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-==-=-=-=-=-=-=-=-=-=-
  2. POR FAVOR NÃO REMOVA OS CRÉDITOS
  3.  
  4. G-VOTE KICK
  5.  
  6. PERFIL: http://forum.sa-mp.com/member.php?u=286494
  7.  
  8. Meu skype:
  9.  
  10. krazy.samp
  11.  
  12. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=*/
  13.  
  14.  
  15. // INCLUDES
  16.  
  17. #include a_samp
  18. #include zcmd
  19. #include sscanf2
  20.  
  21.  
  22. // DEFINES
  23.  
  24. #define PRESSED(%0) (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
  25. #define MAX_GVotes 5
  26. #define GTimer_Encerrar 60000
  27.  
  28. // VAR
  29.  
  30. new GVotes[MAX_PLAYERS],
  31. GMotivo[30],
  32. pID,
  33. bool:GVotosON,
  34. bool:GVotou[MAX_PLAYERS],
  35. stra[128],
  36. TimerG;
  37.  
  38. // CALLBACKS
  39.  
  40. public OnFilterScriptInit()
  41. {
  42.  
  43. print("\nFS Criado por GiromB - Não remova os créditos\n");
  44.  
  45. GVotosON = false;
  46. return 1;
  47. }
  48.  
  49. public OnPlayerConnect(playerid)
  50. {
  51. GVotes[playerid] = 0;
  52. GVotou[playerid] = false;
  53. SendClientMessage( playerid, -1, "[INFO] Este servidor possui o script- VOTE KICK, Criado por GiromB!");
  54. return 1;
  55. }
  56.  
  57. public OnPlayerDisconnect(playerid, reason)
  58. {
  59. GVotes[playerid] = 0;
  60. GVotou[playerid] = false;
  61. return 1;
  62. }
  63.  
  64.  
  65. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  66. {
  67. if( PRESSED(KEY_YES))
  68. {
  69. if( GVotosON == true)
  70. {
  71. if( GVotou[playerid] == true) return SendClientMessage(playerid, -1, "[ERROR] Você já GVotou!");
  72. ShowPlayerDialog(playerid, 750, DIALOG_STYLE_MSGBOX, "Vote Kick", stra, "sim ", "nao");
  73. }
  74. }
  75. return 1;
  76. }
  77.  
  78.  
  79. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  80. {
  81. if( dialogid == 750)
  82. {
  83. if( response)
  84. {
  85.  
  86. new mNome[MAX_PLAYER_NAME], tNome[MAX_PLAYER_NAME], str[128];
  87. GetPlayerName(pID, tNome, sizeof(tNome));
  88. GetPlayerName(playerid, mNome, sizeof(mNome));
  89. format( str, sizeof( str), "[VOTE KICK] O player %s GVotou para o jogador %s ser kickado [Votos: %i/%i ] ", mNome, tNome, GVotes[pID], MAX_GVotes);
  90. SendClientMessageToAll( -1, str);
  91. GVotou[playerid] = true;
  92. GVotes[pID] ++;
  93. }
  94. if( GVotes[pID] > MAX_GVotes)
  95. {
  96. new tNome[MAX_PLAYER_NAME], str[128], str2[128];
  97. GetPlayerName( pID, tNome, sizeof(tNome));
  98. format( str, sizeof( str), "[VOTE KICK] O player %s foi kickado [GMotivo: %s]", tNome, GMotivo);
  99. format( str2, sizeof( str2), " Você foi kickado GMotivo: %s \n se acha que isto foi um engano/Abuso contate um Adminstrador", GMotivo);
  100. ShowPlayerDialog(pID, 751, DIALOG_STYLE_MSGBOX, "Vote Kick", str2, "ok ", "");
  101. SendClientMessageToAll( -1, str);
  102. SetTimerEx("KickG", 1000, false, "i", pID);
  103. KillTimer( TimerG);
  104. GVotosON = false;
  105. for( new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
  106. {
  107. GVotou[i] = false;
  108. }
  109.  
  110. }
  111. }
  112.  
  113. return 1;
  114. }
  115.  
  116. forward KickG();
  117. public KickG()
  118. {
  119. Kick(pID);
  120. return 1;
  121. }
  122.  
  123. forward VotacaoG();
  124. public VotacaoG()
  125. {
  126. new tNome[MAX_PLAYER_NAME], str[128];
  127. GetPlayerName(pID, tNome, sizeof(tNome));
  128. format( str, sizeof( str), "[VOTE KICK] O player %s NÃO foi kickado pois não houve votos suficientes", tNome);
  129. SendClientMessageToAll( -1, str);
  130. for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
  131. {
  132. GVotou[i] = false;
  133. }
  134. GVotosON = false;
  135. GVotes[pID] = 0;
  136. return 1;
  137. }
  138.  
  139. // COMANDO[S]
  140.  
  141. CMD:votekick(playerid, params[])
  142. {
  143.  
  144. new mNome[MAX_PLAYER_NAME], tNome[MAX_PLAYER_NAME], str[128];
  145. GetPlayerName( pID, tNome, sizeof( tNome));
  146. GetPlayerName( playerid, mNome, sizeof( mNome));
  147.  
  148. if( GVotosON == true) return SendClientMessage( playerid, -1, "[ERRO]: já existe uma votação em andamento");
  149. if( GetMaxPlayers() > MAX_GVotes) return SendClientMessage( playerid, -1, "[ERROR] Não tem players online o suficiente para começar a votaçao");
  150. if( sscanf( params, "is", pID, GMotivo)) return SendClientMessage( playerid, -1, "USE: /votekick [ID] [GMotivo]");
  151. if( !IsPlayerConnected( pID)) return SendClientMessage( playerid, -1, "[ERRO]: Este jogador não esta conectado.");
  152.  
  153. format( str, sizeof( str), "[VOTE KICK] O player %s iniciou uma votação contra o jogador %s [GMotivo: %s]", mNome, tNome, GMotivo);
  154. format( stra, sizeof( stra), "Votação contra o jogador %s, GMotivo: %s você deseja kicka-lo?",tNome, GMotivo);
  155. SendClientMessageToAll( -1, "[VOTE KICK] Se você quiser participar da votação aperte 'Y' no seu teclado!");
  156. SendClientMessageToAll( -1, str);
  157.  
  158. TimerG = SetTimer( "VotacaoG", GTimer_Encerrar, false);
  159. GVotes[pID] = 1;
  160. GVotosON = true;
  161.  
  162. return 1;
  163. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement