Advertisement
Guest User

Untitled

a guest
Jul 3rd, 2021
645
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.32 KB | None | 0 0
  1. -- CUP SISTEM --
  2.  
  3. #include <a_samp>
  4.  
  5.  
  6. public OnPlayerDisconnect( playerid, reason ) {
  7. SavePlayer(playerid);
  8. return 1;
  9. }
  10.  
  11. ## NEWS ZA CUP ##
  12. new cup = 0;
  13. new cnagrada = 0;
  14. new cpokusaj = 0;
  15. new codgovor[32];
  16. new cupobj;
  17.  
  18. ## KOLIKO MAX CUPOVA ##
  19. #define MAX_CUPOVA 1000
  20. enum Cupovi
  21. {
  22. Float:CX, # POZICIJA X
  23. Float:CY, # POZICIJA Y
  24. Float:CZ, # POZICIJA X
  25. CPo
  26. };
  27.  
  28.  
  29. new C[MAX_CUPOVA][Cupovi];
  30. new Text3D:CLabel[sizeof(C)]; # TEXT LABEL ZA CUP
  31.  
  32. enum {
  33. DIALOG_CUPODGOVOR ## DIALOG ZA CUP ODGOVOR
  34. }
  35.  
  36. ## KOMANDA
  37. CMD:napravicup(playerid,params[])
  38. {
  39. if(PlayerInfo[playerid][xAdmin] < 6) return GRESKA(playerid, "Nisi ovlasten!");
  40. if(cup == 1) return SCM( playerid, -1, "Vec je startovan kviz." );
  41. if(sscanf(params, "s[32]i", codgovor, cnagrada)) return SCM(playerid, -1, "/napravicup (rec) (golda)" );
  42. if(cnagrada > 50000 || cnagrada < 1) return GRESKA( playerid, "Ne moze vise od $50000 ili manje od $1." ); cup = 1;
  43. new a[256]; format(a, 256, "{FF0000}MAGICNA REC / {FFFFFF}Admin {FF0000}%s {FFFFFF}je kreirao cup negdje po serveru potrudi se da ga nadjes i pogodi rec!", ImeIgraca(playerid)); SCMTA(-1,a);
  44. new string[1024];
  45. new Float:X, Float:Y, Float:Z;
  46. GetPlayerPos(playerid, X,Y,Z);
  47. new labelid = 0;
  48. for(new b = 0; b < sizeof(C); b++)
  49. {
  50. if(C[b][CPo] == 1)
  51. {
  52. labelid = b + 1;
  53. }
  54. }
  55. C[labelid][CX] = X;
  56. C[labelid][CY] = Y;
  57. C[labelid][CZ] = Z;
  58. C[labelid][CPo] = 1;
  59. format(string,sizeof(string),"{FF0000}[MAGICNA REC]\n{FFFFFF}Pogodi magicnu rec i obogati se!\nKomanda: {FF0000}/magicnarec\n{FFFFFF}Nagrada: {FF0000}%d golda\n{FFFFFF}Pokusaji: {FF0000}%d", cnagrada, cpokusaj);
  60. CLabel[labelid] = CreateDynamic3DTextLabel(string ,-1,C[labelid][CX], C[labelid][CY], C[labelid][CZ],20);
  61. new Float:x, Float:y, Float:z;
  62. GetPlayerPos(playerid, x,y,z);
  63. cupobj = CreateDynamicObject(19527, x, y, z-1, 0, 0, 0);
  64. return true;
  65. }
  66.  
  67. CMD:magicnarec(playerid,params[])
  68. {
  69. for(new id; id < MAX_CUPOVA; id++)
  70. {
  71. if(IsPlayerInRangeOfPoint(playerid, 2.5, C[id][CX], C[id][CY], C[id][CZ]))
  72. {
  73. if(C[id][CPo] == 1)
  74. {
  75.  
  76. SPD( playerid, DIALOG_CUPODGOVOR, DSI, "Magicna Rec", "{FFFFFF}Pogodi /magicnurec i obogati se!", "OK", "");
  77. }
  78. else { GRESKA(playerid, "Nisi kod cupa!"); }
  79. }
  80. }
  81. return true;
  82. }
  83.  
  84. public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[])
  85. {
  86. //==========================================================================
  87. else if(dialogid == DIALOG_CUPODGOVOR)
  88. {
  89. if(!response) return true;
  90. if(response)
  91. {
  92. if(cup == 0) return GRESKA( playerid, "Nije startovana magicna rec." );
  93. if(strlen(inputtext) < 1) return GRESKA( playerid, "Moras nesto upisati!" );
  94. if(!strcmp(codgovor, inputtext, true))
  95. {
  96. for(new labelid; labelid < MAX_CUPOVA; labelid++)
  97. {
  98. if(IsPlayerInRangeOfPoint(playerid, 4.0, C[labelid][CX], C[labelid][CY], C[labelid][CZ]))
  99. {
  100. if(C[labelid][CPo] == 1)
  101. {
  102. DestroyDynamic3DTextLabel(CLabel[labelid]);
  103. C[labelid][CX] = 0;
  104. C[labelid][CY] = 0;
  105. C[labelid][CZ] = 0;
  106. C[labelid][CPo] = 0;
  107. DestroyDynamicObject(cupobj);
  108. new mr[400];
  109. format(mr, 400, "{FF0000}MAGICNA REC / {FFFFFF}Gradjanin {FF0000}(%s) {FFFFFF}je prvi pronasao cup i pogodio rec {FF0000}(%d) golda.", ImeIgraca( playerid ), cnagrada);
  110. SCMTA(-1, mr);
  111. new sss[128];
  112. format(sss, 128, "{FF0000}MAGICNA REC / {FFFFFF}Magicna rec je bila: {FF0000}(%s)", codgovor);
  113. SCMTA(-1, sss);
  114. PlayerInfo[playerid][xZlato] += cnagrada;
  115. cup = 0;
  116. cnagrada = 1;
  117. cpokusaj = 0;
  118. }
  119. }
  120. }
  121. }
  122. else
  123. {
  124. for(new labelid; labelid < MAX_CUPOVA; labelid++)
  125. {
  126. if(IsPlayerInRangeOfPoint(playerid, 4.0, C[labelid][CX], C[labelid][CY], C[labelid][CZ]))
  127. {
  128. if(C[labelid][CPo] == 1)
  129. {
  130. new trcic[400];
  131. format(trcic, sizeof(trcic), "{FF0000}[MAGICNA REC]\n{FFFFFF}Pogodi magicnu rec i obogati se!\nKomanda: {FF0000}/magicnarec\n{FFFFFF}Nagrada: {FF0000}%d golda\n{FFFFFF}Pokusaji: {FF0000}%d", cnagrada, cpokusaj);
  132. UpdateDynamic3DTextLabelText(CLabel[labelid], -1, trcic);
  133. cpokusaj++;
  134. SCM( playerid,-1, "Ta rec nije ni upola magicna!" );
  135. }
  136. }
  137. }
  138. }
  139. }
  140. }
  141. return 1;
  142. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement