Advertisement
Harexe2

Glasanje Fs

Aug 2nd, 2016
360
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.70 KB | None | 0 0
  1.  
  2.  
  3. #include <a_samp>
  4. #include <ocmd>
  5.  
  6. #include <sscanf2>
  7.  
  8. #define SCM SendClientMessage
  9. #define SCMTA SendClientMessageToAll
  10. #define MSGBOX DIALOG_STYLE_MSGBOX
  11. new votetimer;
  12. new glasanje;
  13. new glasanjeyes;
  14. new glasanjeno;
  15. new beingglasanje;
  16. new glasanjerecently[MAX_PLAYERS];
  17. new Text:Textdraw0;
  18. new Text:Textdraw1;
  19. new Text:Textdraw2;
  20. new Text:Textdraw3;
  21. new Text:Textdraw4;
  22. new Text:Textdraw5;
  23. new Text:Textdraw6;
  24. new Text:Textdraw7;
  25. new Text:Textdraw8;
  26. #define SVETLOPLAVA 0x33CCFFAA
  27. #define COLOR_GREY 0xAFAFAFAA
  28. #define SIVA "{C0C0C0}"
  29. #define BELA "{FFFFFF}"
  30.  
  31. public OnFilterScriptInit()
  32. {
  33. print("Glasanje FS by Harexe 1.0");
  34. glasanje = 0;
  35. beingglasanje = 255;
  36. glasanjeyes = 0;
  37. glasanjeno = 0;
  38. beingglasanje = 255;
  39. Textdraw0 = TextDrawCreate(397.625000, 1.500000, "usebox");
  40. TextDrawLetterSize(Textdraw0, 0.000000, 7.655555);
  41. TextDrawTextSize(Textdraw0, 200.500000, 0.000000);
  42. TextDrawAlignment(Textdraw0, 1);
  43. TextDrawColor(Textdraw0, 0);
  44. TextDrawUseBox(Textdraw0, true);
  45. TextDrawBoxColor(Textdraw0, 102);
  46. TextDrawSetShadow(Textdraw0, 0);
  47. TextDrawSetOutline(Textdraw0, 0);
  48. TextDrawFont(Textdraw0, 0);
  49.  
  50. Textdraw1 = TextDrawCreate(203.750000, 0.000000, "LD_SPAC:white");
  51. TextDrawLetterSize(Textdraw1, 0.000000, 0.000000);
  52. TextDrawTextSize(Textdraw1, -1.250000, 73.500000);
  53. TextDrawAlignment(Textdraw1, 1);
  54. TextDrawColor(Textdraw1, -16776961);
  55. TextDrawSetShadow(Textdraw1, 0);
  56. TextDrawSetOutline(Textdraw1, 0);
  57. TextDrawFont(Textdraw1, 4);
  58.  
  59. Textdraw2 = TextDrawCreate(395.000000, 74.083328, "LD_SPAC:white");
  60. TextDrawLetterSize(Textdraw2, 0.000000, 0.000000);
  61. TextDrawTextSize(Textdraw2, -192.500000, -1.166657);
  62. TextDrawAlignment(Textdraw2, 1);
  63. TextDrawColor(Textdraw2, -16776961);
  64. TextDrawSetShadow(Textdraw2, 0);
  65. TextDrawSetOutline(Textdraw2, 0);
  66. TextDrawFont(Textdraw2, 4);
  67.  
  68. Textdraw3 = TextDrawCreate(394.375000, 0.000000, "LD_SPAC:white");
  69. TextDrawLetterSize(Textdraw3, 0.000000, 0.000000);
  70. TextDrawTextSize(Textdraw3, 1.250000, 74.083328);
  71. TextDrawAlignment(Textdraw3, 1);
  72. TextDrawColor(Textdraw3, -16776961);
  73. TextDrawSetShadow(Textdraw3, 0);
  74. TextDrawSetOutline(Textdraw3, 0);
  75. TextDrawFont(Textdraw3, 4);
  76.  
  77. Textdraw4 = TextDrawCreate(224.375000, 0.583338, "] Glasanje ]");
  78. TextDrawLetterSize(Textdraw4, 0.449999, 1.600000);
  79. TextDrawAlignment(Textdraw4, 1);
  80. TextDrawColor(Textdraw4, -1);
  81. TextDrawSetShadow(Textdraw4, 0);
  82. TextDrawSetOutline(Textdraw4, 1);
  83. TextDrawBackgroundColor(Textdraw4, 51);
  84. TextDrawFont(Textdraw4, 2);
  85. TextDrawSetProportional(Textdraw4, 1);
  86.  
  87. Textdraw5 = TextDrawCreate(204.375000, 23.333328, "Bakar Bakar Bakar Bakar Bakar Bakar Bakar Bakar Bakar Bakar Bakar");
  88. TextDrawLetterSize(Textdraw5, 0.178749, 1.063333);
  89. TextDrawTextSize(Textdraw5, 397.500000, -91.583381);
  90. TextDrawAlignment(Textdraw5, 1);
  91. TextDrawColor(Textdraw5, -1);
  92. TextDrawUseBox(Textdraw5, true);
  93. TextDrawBoxColor(Textdraw5, 0);
  94. TextDrawSetShadow(Textdraw5, 0);
  95. TextDrawSetOutline(Textdraw5, 1);
  96. TextDrawBackgroundColor(Textdraw5, 51);
  97. TextDrawFont(Textdraw5, 2);
  98. TextDrawSetProportional(Textdraw5, 1);
  99.  
  100. Textdraw6 = TextDrawCreate(210.000000, 56.000007, "Da");
  101. TextDrawLetterSize(Textdraw6, 0.449999, 1.600000);
  102. TextDrawAlignment(Textdraw6, 1);
  103. TextDrawColor(Textdraw6, -1);
  104. TextDrawSetShadow(Textdraw6, 0);
  105. TextDrawSetOutline(Textdraw6, 1);
  106. TextDrawBackgroundColor(Textdraw6, 51);
  107. TextDrawFont(Textdraw6, 2);
  108. TextDrawSetProportional(Textdraw6, 1);
  109. TextDrawSetSelectable(Textdraw6, true);
  110.  
  111. Textdraw7 = TextDrawCreate(366.250000, 55.416660, "Ne");
  112. TextDrawLetterSize(Textdraw7, 0.449999, 1.600000);
  113. TextDrawAlignment(Textdraw7, 1);
  114. TextDrawColor(Textdraw7, -1);
  115. TextDrawSetShadow(Textdraw7, 0);
  116. TextDrawSetOutline(Textdraw7, 1);
  117. TextDrawBackgroundColor(Textdraw7, 51);
  118. TextDrawFont(Textdraw7, 2);
  119. TextDrawSetProportional(Textdraw7, 1);
  120. TextDrawSetSelectable(Textdraw7, true);
  121.  
  122. Textdraw8 = TextDrawCreate(509.375000, 440.416748, "Glasanje FS by Harexe");
  123. TextDrawLetterSize(Textdraw8, 0.238749, 0.759999);
  124. TextDrawAlignment(Textdraw8, 1);
  125. TextDrawColor(Textdraw8, -1);
  126. TextDrawSetShadow(Textdraw8, 0);
  127. TextDrawSetOutline(Textdraw8, 1);
  128. TextDrawBackgroundColor(Textdraw8, 51);
  129. TextDrawFont(Textdraw8, 2);
  130. TextDrawSetProportional(Textdraw8, 1);
  131.  
  132.  
  133. return 1;
  134. }
  135.  
  136. forward KrajGlasanja(playerid);
  137. public KrajGlasanja(playerid)
  138. {
  139. new string[128];
  140. format(string,sizeof(string),"[Rezultat Glasanja]: Da (%d), Ne (%d)",glasanjeyes,glasanjeno);
  141. SCMTA(SVETLOPLAVA,string);
  142. glasanjeno = 0;
  143. glasanjeyes = 0;
  144. glasanje = 0;
  145. TextDrawHideForAll(Textdraw0);
  146. TextDrawHideForAll(Textdraw1);
  147. TextDrawHideForAll(Textdraw2);
  148. TextDrawHideForAll(Textdraw3);
  149. TextDrawHideForAll(Textdraw4);
  150. TextDrawHideForAll(Textdraw5);
  151. TextDrawHideForAll(Textdraw6);
  152. TextDrawHideForAll(Textdraw7);
  153. TextDrawHideForAll(Textdraw8);
  154. for(new i;i < MAX_PLAYERS;i++)
  155. {
  156. glasanjerecently[i] = 0;
  157. i++;
  158. }
  159.  
  160.  
  161.  
  162. }
  163.  
  164.  
  165. public OnPlayerConnect(playerid)
  166. {
  167. return 1;
  168. }
  169. ocmd:gh(playerid, params[])
  170. {{
  171. new glasanjehelp[2048];
  172. if(IsPlayerConnected(playerid))
  173. {
  174. strcat(glasanjehelp, "{FFFFFF}|----------------------------------------------------------------------[ {0A85FF}Glasanje{FFFFFF} ]--------------------------------------------------------------------|\n\n", sizeof(glasanjehelp));
  175. strcat(glasanjehelp, "{0A85FF}- /glasanjestart - Da pokrenete glasanje.\n", sizeof(glasanjehelp));
  176. strcat(glasanjehelp, "{0A85FF}- /glasanjestop - Da ugasite glasanje.\n", sizeof(glasanjehelp));
  177. strcat(glasanjehelp, "{FFFFFF}|------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n\n", sizeof(glasanjehelp));
  178. ShowPlayerDialog(playerid, 9843, MSGBOX, "{FFFFFF}Glasanje Help", glasanjehelp, "Ok", "Izlaz");
  179. }
  180. return 1;
  181. }}
  182. ocmd:glasanjestart(playerid, params[],help)
  183. {
  184. if(IsPlayerConnected(playerid))
  185. {
  186. if(glasanje == 0)
  187. {
  188. for(new i;i < MAX_PLAYERS;i++)
  189. {
  190.  
  191. SelectTextDraw(i, 0x00FF00FF);
  192. i++;
  193. }
  194. TextDrawShowForAll(Textdraw0);
  195. TextDrawShowForAll(Textdraw1);
  196. TextDrawShowForAll(Textdraw2);
  197. TextDrawShowForAll(Textdraw3);
  198. TextDrawShowForAll(Textdraw4);
  199. TextDrawShowForAll(Textdraw5);
  200. TextDrawShowForAll(Textdraw6);
  201. TextDrawShowForAll(Textdraw7);
  202. TextDrawShowForAll(Textdraw8);
  203. new rezultat[128],string[256];
  204. if(sscanf(params,"s[128]",rezultat)) return SCM(playerid,COLOR_GREY,""SIVA"[Glasanje]: "BELA"/glasanjestart [Pitanje]");
  205. votetimer = SetTimer("KrajGlasanja",300000,false);
  206. format(string,sizeof(string),"%s?",rezultat);
  207. TextDrawSetString(Textdraw5, string);
  208. glasanje = 1;
  209. }
  210. else
  211. {
  212. SCM(playerid,-1,"Vec je pokrenuto glasanje!");
  213. }
  214.  
  215. }
  216. return 1;
  217. }
  218. public OnPlayerClickTextDraw(playerid, Text:clickedid)
  219. {
  220. if(clickedid == Textdraw6)
  221. {
  222. if(glasanje == 1)
  223. {
  224. if(glasanjerecently[playerid] == 0)
  225. {
  226. new string[128];
  227. glasanjeyes ++;
  228. glasanjerecently[playerid] = 1;
  229. new GivePlayer[MAX_PLAYER_NAME];
  230. GetPlayerName(beingglasanje, GivePlayer,sizeof(GivePlayer));
  231. SCM(playerid, SVETLOPLAVA, "Glasali ste za!");
  232. format(string,sizeof(string),"[Glasanje]: (%s) Da %d -- Ne %d",GivePlayer,glasanjeyes,glasanjeno);
  233. SCMTA(SVETLOPLAVA,string);
  234. CancelSelectTextDraw(playerid);
  235. }
  236. else
  237. {
  238. SCM(playerid, SVETLOPLAVA, "Vec ste glasali!");
  239. CancelSelectTextDraw(playerid);
  240. return 1;
  241. }
  242. }
  243. else
  244. {
  245. SCM(playerid, SVETLOPLAVA, "Trenutno nema glasanja!");
  246. return 1;
  247. }
  248.  
  249. }
  250. if(clickedid == Textdraw7)
  251. {
  252. if(glasanjerecently[playerid] == 0)
  253. {
  254. if(glasanje == 1)
  255. {
  256. new string[128];
  257. glasanjeno ++;
  258. glasanjerecently[playerid] = 1;
  259. new giveplayer2[MAX_PLAYER_NAME];
  260. GetPlayerName(beingglasanje, giveplayer2,sizeof(giveplayer2));
  261. SCM(playerid, SVETLOPLAVA, "Glasali ste protiv.");
  262. format(string,sizeof(string),"[Rezultati]: (%s) Da %d -- Ne %d",giveplayer2,glasanjeyes,glasanjeno);
  263. SCMTA(SVETLOPLAVA,string);
  264. CancelSelectTextDraw(playerid);
  265. }
  266. else
  267. {
  268. SCM(playerid, SVETLOPLAVA,"Trenutno nema glasanja!");
  269. CancelSelectTextDraw(playerid);
  270. return 1;
  271. }
  272. }
  273. else
  274. {
  275. SCM(playerid, SVETLOPLAVA,"Vec ste glasali!");
  276. return 1;
  277. }
  278.  
  279. }
  280. return 1;
  281.  
  282.  
  283. }
  284. ocmd:glasanjestop(playerid, params[],help)
  285. {
  286. if(glasanje == 1)
  287. {
  288. new string[128],sendername[MAX_PLAYER_NAME];
  289. GetPlayerName(playerid, sendername,sizeof(sendername));
  290. glasanjeyes = 0;
  291. glasanjeno = 0;
  292. glasanje = 0;
  293. beingglasanje = 255;
  294.  
  295.  
  296. for(new i;i < MAX_PLAYERS;i++)
  297. {
  298. glasanjerecently[i] = 0;
  299. i++;
  300. }
  301.  
  302. KillTimer(votetimer);
  303. format(string,sizeof(string),"[Glasanje]: %s je prekinuo glasanje",sendername);
  304. SCMTA(SVETLOPLAVA,string);
  305. TextDrawHideForAll(Textdraw0);
  306. TextDrawHideForAll(Textdraw1);
  307. TextDrawHideForAll(Textdraw2);
  308. TextDrawHideForAll(Textdraw3);
  309. TextDrawHideForAll(Textdraw4);
  310. TextDrawHideForAll(Textdraw5);
  311. TextDrawHideForAll(Textdraw6);
  312. TextDrawHideForAll(Textdraw7);
  313. TextDrawHideForAll(Textdraw8);
  314. CancelSelectTextDraw(playerid);
  315. }
  316. else
  317. {
  318. SCM(playerid, SVETLOPLAVA,"Trenutno nema glasanja!");
  319. return 1;
  320. }
  321. return 1;
  322. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement