Guest User

FS GLASANJE by LIMIX

a guest
Aug 10th, 2014
587
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.29 KB | None | 0 0
  1. //-------------------[FS] Izradio: LiMiX -----------------------//
  2. //////////////////////////////////////////////////////////////////
  3. #include <a_samp>
  4. #include <YSI\y_ini>
  5. #include <zcmd>
  6. #include <foreach>
  7. #include <sscanf2>
  8. //////////////////////////////////////////////////////////////////
  9. #define LIMIX:%0(%1) \
  10. forward%0(%1); \
  11. public%0(%1)
  12. #define SCM SendClientMessage
  13. #define SCMTA SendClientMessageToAll
  14. #define MSGBOX DIALOG_STYLE_MSGBOX
  15. //////////////////////////////////////////////////////////////////
  16. new votetimer;
  17. new glasanje;
  18. new glasanjeyes;
  19. new glasanjeno;
  20. new beingglasanje;
  21. new glasanjerecently[MAX_PLAYERS];
  22. /////////////////////BOJE/////////////////////////////////////////
  23. #define SVETLOPLAVA 0x33CCFFAA
  24. #define COLOR_GREY 0xAFAFAFAA
  25. #define SIVA "{C0C0C0}"
  26. #define BELA "{FFFFFF}"
  27. //////////////////////////////////////////////////////////////////
  28. LIMIX: OnFilterScriptInit()
  29. {
  30. glasanje = 0;
  31. beingglasanje = 255;
  32. glasanjeyes = 0;
  33. glasanjeno = 0;
  34. beingglasanje = 255;
  35. return 1;
  36. }
  37.  
  38. LIMIX: KrajGlasanja(playerid)
  39. {
  40. new string[128];
  41. format(string,sizeof(string),"[Rezultat Glasanja]: Da (%d), Ne (%d)",glasanjeyes,glasanjeno);
  42. SCMTA(SVETLOPLAVA,string);
  43. glasanjeno = 0;
  44. glasanjeyes = 0;
  45. glasanje = 0;
  46. foreach(Player,i)
  47. {
  48. glasanjerecently[i] = 0;
  49. }
  50. return 1;
  51. }
  52. ////////////////////////////////ZCMD////////////////////////////////////////////
  53. CMD:glasanjehelp(playerid, params[])
  54. {
  55. new glasanjehelp[2048];
  56. if(IsPlayerConnected(playerid))
  57. {
  58. strcat(glasanjehelp, "{FFFFFF}|----------------------------------------------------------------------[ {0A85FF}Glasanje{FFFFFF} ]--------------------------------------------------------------------|\n\n", sizeof(glasanjehelp));
  59. strcat(glasanjehelp, "{0A85FF}- /pocniglasanje - Da pokrenete glasanje.\n", sizeof(glasanjehelp));
  60. strcat(glasanjehelp, "{0A85FF}- /ugasiglasanje - Da ugasite glasanje.\n", sizeof(glasanjehelp));
  61. strcat(glasanjehelp, "{0A85FF}- /yes - Da glasate za.\n", sizeof(glasanjehelp));
  62. strcat(glasanjehelp, "{0A85FF}- /no - Da glasate protiv.\n\n", sizeof(glasanjehelp));
  63. strcat(glasanjehelp, "{FFFFFF}|------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n\n", sizeof(glasanjehelp));
  64. ShowPlayerDialog(playerid, 9843, MSGBOX, "{FFFFFF}Glasanje Help", glasanjehelp, "Ok", "Izlaz");
  65. }
  66. return 1;
  67. }
  68. CMD:pocniglasanje(playerid, params[],help)
  69. {
  70. if(IsPlayerConnected(playerid))
  71. {
  72. new rezultat[128],sendername[MAX_PLAYER_NAME],string[256];
  73. if(sscanf(params,"s[128]",rezultat)) return SCM(playerid,COLOR_GREY,""SIVA"[Glasanje]: "BELA"/pocniglasanje [Pitanje]");
  74. votetimer = SetTimer("KrajGlasanja",60000,false);
  75. GetPlayerName(playerid, sendername, sizeof(sendername));
  76. format(string,sizeof(string),"* %s (%d) %s?, Glasajte sa /yes ili /no",sendername,playerid,rezultat);
  77. SCMTA(SVETLOPLAVA,string);
  78. glasanje = 1;
  79. new y, m, d;
  80. new h,mi,s;
  81. getdate(y,m,d);
  82. gettime(h,mi,s);
  83. format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s je poceo glasanje %s",d,m,y,h,mi,s,sendername,rezultat);
  84. }
  85. return 1;
  86. }
  87. CMD:yes(playerid, params[],help)
  88. {
  89. if(glasanje == 1)
  90. {
  91. if(glasanjerecently[playerid] == 0)
  92. {
  93. new string[128];
  94. glasanjeyes ++;
  95. glasanjerecently[playerid] = 1;
  96. new GivePlayer[MAX_PLAYER_NAME];
  97. GetPlayerName(beingglasanje, GivePlayer,sizeof(GivePlayer));
  98. SCM(playerid, SVETLOPLAVA, "Glasali ste za!");
  99. format(string,sizeof(string),"[Glasanje]: (%s) Da %d -- Ne %d",GivePlayer,glasanjeyes,glasanjeno);
  100. SCMTA(SVETLOPLAVA,string);
  101. }
  102. else
  103. {
  104. SCM(playerid, SVETLOPLAVA, "Vec ste glasali!");
  105. return 1;
  106. }
  107. }
  108. else
  109. {
  110. SCM(playerid, SVETLOPLAVA, "Trenutno nema glasanja!");
  111. return 1;
  112. }
  113. return 1;
  114. }
  115.  
  116. CMD:no(playerid, params[],help)
  117. {
  118. if(glasanjerecently[playerid] == 0)
  119. {
  120. if(glasanje == 1)
  121. {
  122. new string[128];
  123. glasanjeno ++;
  124. glasanjerecently[playerid] = 1;
  125. new giveplayer2[MAX_PLAYER_NAME];
  126. GetPlayerName(beingglasanje, giveplayer2,sizeof(giveplayer2));
  127. SCM(playerid, SVETLOPLAVA, "Glasali ste protiv.");
  128. format(string,sizeof(string),"[Rezultati]: (%s) Da %d -- Ne %d",giveplayer2,glasanjeyes,glasanjeno);
  129. SCMTA(SVETLOPLAVA,string);
  130. }
  131. else
  132. {
  133. SCM(playerid, SVETLOPLAVA,"Trenutno nema glasanja!");
  134. return 1;
  135. }
  136. }
  137. else
  138. {
  139. SCM(playerid, SVETLOPLAVA,"Vec ste glasali!");
  140. return 1;
  141. }
  142. return 1;
  143. }
  144.  
  145. CMD:ugasiglasanje(playerid, params[],help)
  146. {
  147. if(glasanje == 1)
  148. {
  149. new string[128],sendername[MAX_PLAYER_NAME];
  150. GetPlayerName(playerid, sendername,sizeof(sendername));
  151. glasanjeyes = 0;
  152. glasanjeno = 0;
  153. glasanje = 0;
  154. beingglasanje = 255;
  155. foreach(Player, i)
  156. {
  157. if(IsPlayerConnected(i))
  158. {
  159. glasanjerecently[i] = 0;
  160. }
  161. }
  162. KillTimer(votetimer);
  163. format(string,sizeof(string),"[Glasanje]: %s je prekinuo glasanje",sendername);
  164. SCMTA(SVETLOPLAVA,string);
  165. }
  166. else
  167. {
  168. SCM(playerid, SVETLOPLAVA,"Trenutno nema glasanja!");
  169. return 1;
  170. }
  171. return 1;
  172. }
  173. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Advertisement
Add Comment
Please, Sign In to add comment