Advertisement
Guest User

Untitled

a guest
Nov 8th, 2017
335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.83 KB | None | 0 0
  1. // Santa Claus system by Hrustanovic
  2.  
  3. // ============================== { includes } ============================== //
  4.  
  5. #include < a_samp >
  6. #include < zcmd >
  7. #include < a_actor >
  8. #include < YSI\y_ini >
  9.  
  10. // =============================== { maxovi } =============================== //
  11.  
  12. #define MAX_SANTA_CLAUS (50)
  13. #define MAX_PLAYER (500) // vi ne morate ovo ima vam vec u scripti logicno
  14.  
  15. // =============================== { fajlovi } ============================== //
  16.  
  17. #define SC_FILE "SantaClaus/%d.ini"
  18.  
  19. // =============================== { colors } =============================== //
  20.  
  21. #define server "{0B68F4}"
  22. #define bela "{FFFFFF}"
  23.  
  24. // ============================== { script } ================================ //
  25.  
  26. #define function%0(%1) forward%0(%1); \
  27. public%0(%1)
  28.  
  29. // ============================ { santa claus } ============================= //
  30.  
  31. enum SantaClaus
  32. {
  33. Float:scX,
  34. Float:scY,
  35. Float:scZ,
  36. Float:scR
  37. }
  38.  
  39. new Santa_Claus[MAX_SANTA_CLAUS][SantaClaus];
  40.  
  41. // =============================== { new-ovi } ============================== //
  42.  
  43. new DedaMraz_Actor[MAX_SANTA_CLAUS];
  44.  
  45. // ============================== { commands } ============================== //
  46.  
  47. CMD:csc(playerid, params[])
  48. {
  49. // ovdje dodati provjere nemoj zaboravit jer ako ubacis a ne dodas svaka ce ti budala moc kreirat deda mraza
  50. // ====================================================================== //
  51. new SantaClaus_ID = SledeciDedaMraz(), string[500], msg[500], Float:Pos[4];
  52. // ====================================================================== //
  53. GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]); GetPlayerFacingAngle(playerid, Pos[3]);
  54. // ====================================================================== //
  55. DedaMraz_Actor[SantaClaus_ID] = CreateActor(25002, Pos[0], Pos[1], Pos[2], Pos[3]); ApplyActorAnimation(DedaMraz_Actor[SantaClaus_ID], "PED", "IDLE_CHAT", 4.1, 1, 0, 0, 0, 0);
  56. // ====================================================================== //
  57. Santa_Claus[SantaClaus_ID][scX] = Pos[0];
  58. Santa_Claus[SantaClaus_ID][scY] = Pos[1];
  59. Santa_Claus[SantaClaus_ID][scZ] = Pos[2];
  60. Santa_Claus[SantaClaus_ID][scR] = Pos[3];
  61. // ====================================================================== //
  62. format(string, sizeof(string), ""server" (( "bela" Merry Christmas and Happy New Year - 2018 "server" ))");
  63. Create3DTextLabel(string, 0x33CCFFAA, Pos[0], Pos[1], Pos[2], 5.0, 0, 0);
  64. // ====================================================================== //
  65. format(msg, sizeof(msg), ""server"CREATE: "bela"Administrator "server"%s "bela"je kreirao Santa Claus-a ID: "server"%d", GetName(playerid), SantaClaus_ID);
  66. SendClientMessage(playerid, -1, msg);
  67. // ====================================================================== //
  68. SaveSantaClaus(SantaClaus_ID);
  69. return 1;
  70. }
  71.  
  72. // ========================================================================== //
  73.  
  74. CMD:gifts(playerid, params[])
  75. {
  76. // ================================================================== //
  77. for(new i; i < sizeof(Santa_Claus); i++)
  78. {
  79. // ============================================================== //
  80. if(IsPlayerInRangeOfPoint(playerid, 3.0, Santa_Claus[i][scX], Santa_Claus[i][scY], Santa_Claus[i][scZ]))
  81. {
  82. // ============================================================== //
  83. switch(random(3))
  84. {
  85. // ============================================================== //
  86. case 0:
  87. {
  88. // ============================================================== //
  89. new h_money = random(5000), string[500]; GivePlayerMoney(playerid, h_money);
  90. // ============================================================== //
  91. format(string, sizeof(string), ""server"INFO: "bela"Santa Claus ti je poklonio "server"%d$"bela". Merry Christmas and Happy New Year!", h_money);
  92. SendClientMessage(playerid, -1, string);
  93. // ============================================================== //
  94. }
  95. // ============================================================== //
  96. case 1:
  97. {
  98. // ============================================================== //
  99. new string[500]; SetPlayerScore(playerid, GetPlayerScore(playerid)+1);
  100. // ============================================================== //
  101. format(string, sizeof(string), ""server"INFO: "bela"Santa Claus ti je dao Level-Up "server"(%d)"bela". Merry Christmas and Happy New Year!", GetPlayerScore(playerid));
  102. SendClientMessage(playerid, -1, string);
  103. // ============================================================== //
  104. }
  105. // ============================================================== //
  106. case 2:
  107. {
  108. // ============================================================== //
  109. new string[500]; format(string, sizeof(string), ""server"INFO: "bela"Ti si na crnoj listi kod Santa Claus-a. Za tebe nema poklona. Budi dobar sljedece godine!");
  110. SendClientMessage(playerid, -1, string);
  111. // ============================================================== //
  112. }
  113. }
  114. }
  115. }
  116. return 1;
  117. }
  118.  
  119. // ============================== { callback } ============================== //
  120.  
  121. public OnGameModeInit()
  122. {
  123. // ====================================================================== //
  124. for(new scid = 1; scid < MAX_SANTA_CLAUS; scid++)
  125. {
  126. new scidFile[50];
  127. format(scidFile, sizeof(scidFile), SC_FILE, scid);
  128. if(fexist(scidFile))
  129. {
  130. INI_ParseFile(scidFile, "LoadSantaClaus", .bExtra = true, .extra = scid);
  131. DedaMraz_Actor[scid] = CreateActor(25002, Santa_Claus[scid][scX], Santa_Claus[scid][scY], Santa_Claus[scid][scZ], Santa_Claus[scid][scR]);
  132. ApplyActorAnimation(DedaMraz_Actor[scid], "PED", "IDLE_CHAT", 4.1, 1, 0, 0, 0, 0);
  133. new string[500]; format(string, sizeof(string), ""server" (( "bela" Merry Christmas and Happy New Year - 2018 "server" ))");
  134. Create3DTextLabel(string, 0x33CCFFAA, Santa_Claus[scid][scX], Santa_Claus[scid][scY], Santa_Claus[scid][scZ], 5.0, 0, 0);
  135. }
  136. }
  137. // ====================================================================== //
  138. return 1;
  139. }
  140.  
  141. // =============================== { stocks } =============================== //
  142.  
  143. stock SledeciDedaMraz() //stock by Slay_
  144. {
  145. new id = -1;
  146. for(new loop = (0), provjera = (-1), Data_[64] = "\0"; loop != MAX_SANTA_CLAUS; ++ loop)
  147. {
  148. provjera = (loop + 1);
  149. format(Data_, (sizeof Data_), SC_FILE, provjera);
  150. if(!fexist(Data_))
  151. {
  152. id = (provjera);
  153. break;
  154. }
  155. }
  156. return id;
  157. }
  158.  
  159. // ========================================================================== //
  160.  
  161. stock SaveSantaClaus(SantaClaus_ID)
  162. {
  163. new aFile[40];
  164. format(aFile, sizeof(aFile), SC_FILE, SantaClaus_ID);
  165. new INI:File = INI_Open(aFile);
  166. INI_WriteFloat(File,"SantaClaus_X", Santa_Claus[SantaClaus_ID][scX]);
  167. INI_WriteFloat(File,"SantaClaus_Y", Santa_Claus[SantaClaus_ID][scY]);
  168. INI_WriteFloat(File,"SantaClaus_Z", Santa_Claus[SantaClaus_ID][scZ]);
  169. INI_WriteFloat(File,"SantaClaus_R", Santa_Claus[SantaClaus_ID][scR]);
  170. INI_Close(File);
  171. return 1;
  172. }
  173.  
  174. // ========================================================================== //
  175.  
  176. stock GetName(playerid)
  177. {
  178. new Ime_Igraca[MAX_PLAYER_NAME];
  179. GetPlayerName(playerid, Ime_Igraca, MAX_PLAYER_NAME);
  180. return Ime_Igraca;
  181. }
  182.  
  183. // ============================== { function } ============================== //
  184.  
  185. function LoadSantaClaus(SantaClaus_ID, name[], value[])
  186. {
  187. INI_Float("SantaClaus_X", Santa_Claus[SantaClaus_ID][scX]);
  188. INI_Float("SantaClaus_Y", Santa_Claus[SantaClaus_ID][scY]);
  189. INI_Float("SantaClaus_Z", Santa_Claus[SantaClaus_ID][scZ]);
  190. INI_Float("SantaClaus_R", Santa_Claus[SantaClaus_ID][scR]);
  191. return 1;
  192. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement