Guest User

getgift

a guest
May 4th, 2018
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.19 KB | None | 0 0
  1. CMD:getgift(playerid, params[])
  2. {
  3. if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
  4. if(IsPlayerConnected(playerid))
  5. {
  6. if(GiftBoxActiv > 0)
  7. {
  8. if(PlayerInfo[playerid][pConnectTime] <= 1) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need 2 hours to use /getgift.");
  9. if(PlayerInfo[playerid][pGiftTime] > 0)
  10. {
  11. new string[128];
  12. format(string,sizeof(string),"Mai poti folosi aceasta comanda peste %d ore.",PlayerInfo[playerid][pGiftTime]);
  13. SendClientMessage(playerid, COLOR_YELLOW, string);
  14. return 1;
  15. }
  16. if(IsPlayerInRangeOfPoint(playerid, 5.0, GiftPosX,GiftPosY,GiftPosZ))
  17. {
  18. new randgift = random(150),string[256],sendername[30];
  19. GetPlayerName(playerid,sendername,sizeof(sendername));
  20. if(randgift >= 0 && randgift <= 29)
  21. {
  22. new randmats = 2000 + random(28000);
  23. PlayerInfo[playerid][pMats] += randmats;
  24. Update(playerid, pMatsx);
  25. format(string,sizeof(string),"Ai primit %d materiale.",randmats);
  26. ShowPlayerDialog(playerid, DIALOG_GIFTBOX, DIALOG_STYLE_MSGBOX, "Premiu Giftbox", string, "OK", "");
  27. format(string,sizeof(string),"(( Giftbox: %s a castigat %s materiale din giftbox! Felicitari! ))",sendername,FormatNumber(randmats));
  28. }
  29. if(randgift >= 31 && randgift <= 59)
  30. {
  31. new str[1400];
  32. PlayerInfo[playerid][pCarLic] = 1;
  33. PlayerInfo[playerid][pCarLicT] = 500;
  34. PlayerInfo[playerid][pFlyLic] = 1;
  35. PlayerInfo[playerid][pFlyLicT] = 500;
  36. PlayerInfo[playerid][pBoatLic] = 1;
  37. PlayerInfo[playerid][pBoatLicT] = 500;
  38. PlayerInfo[playerid][pGunLic] = 1;
  39. PlayerInfo[playerid][pGunLicT] = 500;
  40. mysql_format(SQL,str,1400,"UPDATE users SET `CarLic`='1',`CarLicT`='500',`FlyLic`='1',`FlyLicT`='500',`BoatLic`='1',`BoatLicT`='500',`GunLic`='1',`GunLicT`='500' WHERE `name`='%s'",PlayerInfo[playerid][pNormalName]);
  41. mysql_tquery(SQL,str,"","");
  42. ShowPlayerDialog(playerid, DIALOG_GIFTBOX, DIALOG_STYLE_MSGBOX, "Premiu Giftbox", "Ai primit toate licentele pentru 500 ore.", "OK", "");
  43. format(string,sizeof(string),"(( Giftbox: %s a castigat toate licentele pentru 500 ore din giftbox! Felicitari! ))",sendername);
  44. }
  45. if(randgift >= 61 && randgift <= 89)
  46. {
  47. new randfw = 5 + random(20),str2[256];
  48. PlayerInfo[playerid][pFWorks] += randfw;
  49. mysql_format(SQL,str2,sizeof(str2),"UPDATE users SET `FWorks`='%d' WHERE `name`='%s'",PlayerInfo[playerid][pFWorks],PlayerInfo[playerid][pNormalName]);
  50. mysql_tquery(SQL,str2,"","");
  51. format(string,sizeof(string),"Ai primit %d artificii.",randfw);
  52. ShowPlayerDialog(playerid, DIALOG_GIFTBOX, DIALOG_STYLE_MSGBOX, "Premiu Giftbox", string, "OK", "");
  53. format(string,sizeof(string),"(( Giftbox: %s a castigat %d artificii din giftbox! Felicitari! ))",sendername,randfw);
  54. }
  55. if(randgift >= 91 && randgift <= 109)
  56. {
  57. new randm = random(100);
  58. if(randm >= 0 && randm <= 30)
  59. {
  60. new randmoney = 100000 + random(100000);
  61. GivePlayerCash(playerid, randmoney);
  62. Update(playerid, pCashx);
  63. format(string,sizeof(string),"Ai primit $%s.",FormatNumber(randmoney));
  64. ShowPlayerDialog(playerid, DIALOG_GIFTBOX, DIALOG_STYLE_MSGBOX, "Premiu Giftbox", string, "OK", "");
  65. format(string,sizeof(string),"(( Giftbox: %s a castigat $%s din giftbox! Felicitari! ))",sendername,FormatNumber(randmoney));
  66. }
  67. if(randm >= 31 && randm <= 50)
  68. {
  69. new randmoney = 300000 + random(200000);
  70. GivePlayerCash(playerid, randmoney);
  71. Update(playerid, pCashx);
  72. format(string,sizeof(string),"Ai primit $%s.",FormatNumber(randmoney));
  73. ShowPlayerDialog(playerid, DIALOG_GIFTBOX, DIALOG_STYLE_MSGBOX, "Premiu Giftbox", string, "OK", "");
  74. format(string,sizeof(string),"(( Giftbox: %s a castigat $%s din giftbox! Felicitari! ))",sendername,FormatNumber(randmoney));
  75. }
  76. if(randm >= 51 && randm <= 80)
  77. {
  78. new randmoney = 500000 + random(500000);
  79. GivePlayerCash(playerid, randmoney);
  80. Update(playerid, pCashx);
  81. format(string,sizeof(string),"Ai primit $%s.",FormatNumber(randmoney));
  82. ShowPlayerDialog(playerid, DIALOG_GIFTBOX, DIALOG_STYLE_MSGBOX, "Premiu Giftbox", string, "OK", "");
  83. format(string,sizeof(string),"(( Giftbox: %s a castigat $%s din giftbox! Felicitari! ))",sendername,FormatNumber(randmoney));
  84. }
  85. if(randm >= 81 && randm <= 90)
  86. {
  87. new randmoney = 1000000 + random(500000);
  88. GivePlayerCash(playerid, randmoney);
  89. Update(playerid, pCashx);
  90. format(string,sizeof(string),"Ai primit $%s.",FormatNumber(randmoney));
  91. ShowPlayerDialog(playerid, DIALOG_GIFTBOX, DIALOG_STYLE_MSGBOX, "Premiu Giftbox", string, "OK", "");
  92. format(string,sizeof(string),"(( Giftbox: %s a castigat $%s din giftbox! Felicitari! ))",sendername,FormatNumber(randmoney));
  93. }
  94. if(randm >= 91)
  95. {
  96. new randmoney = 2000000 + random(1000000);
  97. GivePlayerCash(playerid, randmoney);
  98. Update(playerid, pCashx);
  99. format(string,sizeof(string),"Ai primit $%s.",FormatNumber(randmoney));
  100. ShowPlayerDialog(playerid, DIALOG_GIFTBOX, DIALOG_STYLE_MSGBOX, "Premiu Giftbox", string, "OK", "");
  101. format(string,sizeof(string),"(( Giftbox: %s a castigat $%s din giftbox! Felicitari! ))",sendername,FormatNumber(randmoney));
  102. }
  103. }
  104. if(randgift >= 111 && randgift <= 119)
  105. {
  106. new randmoney = 1000000 + random(1000000);
  107. GivePlayerCash(playerid, randmoney);
  108. Update(playerid, pCashx);
  109. format(string,sizeof(string),"Ai primit $%s.",FormatNumber(randmoney));
  110. ShowPlayerDialog(playerid, DIALOG_GIFTBOX, DIALOG_STYLE_MSGBOX, "Premiu Giftbox", string, "OK", "");
  111. format(string,sizeof(string),"(( Giftbox: %s a castigat $%s din giftbox! Felicitari! ))",sendername,FormatNumber(randmoney));
  112. }
  113. if(randgift >= 120 && randgift <= 129)
  114. {
  115. if(PlayerInfo[playerid][pWarns] == 0)
  116. {
  117. new randmoney = 1000000 + random(1000000);
  118. GivePlayerCash(playerid, randmoney);
  119. Update(playerid, pCashx);
  120. format(string,sizeof(string),"Ai primit $%s.",FormatNumber(randmoney));
  121. ShowPlayerDialog(playerid, DIALOG_GIFTBOX, DIALOG_STYLE_MSGBOX, "Premiu Giftbox", string, "OK", "");
  122. format(string,sizeof(string),"(( Giftbox: %s a castigat $%s din giftbox! Felicitari! ))",sendername,FormatNumber(randmoney));
  123. }
  124. else
  125. {
  126. PlayerInfo[playerid][pWarns] = 0;
  127. Update(playerid, pWarnsx);
  128. ShowPlayerDialog(playerid, DIALOG_GIFTBOX, DIALOG_STYLE_MSGBOX, "Premiu Giftbox", "Ai primit Clear warns.", "OK", "");
  129. format(string,sizeof(string),"(( Giftbox: %s a castigat Clear warns din giftbox! Felicitari! ))",sendername);
  130. }
  131. }
  132. if(randgift >= 130 && randgift <= 139)
  133. {
  134. if(PlayerInfo[playerid][pFpunish] == 0)
  135. {
  136. new randmoney = 1000000 + random(1000000);
  137. GivePlayerCash(playerid, randmoney);
  138. Update(playerid, pCashx);
  139. format(string,sizeof(string),"Ai primit $%s.",FormatNumber(randmoney));
  140. ShowPlayerDialog(playerid, DIALOG_GIFTBOX, DIALOG_STYLE_MSGBOX, "Premiu Giftbox", string, "OK", "");
  141. format(string,sizeof(string),"(( Giftbox: %s a castigat $%s din giftbox! Felicitari! ))",sendername,FormatNumber(randmoney));
  142. }
  143. else
  144. {
  145. PlayerInfo[playerid][pFpunish] = 0;
  146. Update(playerid,pFpunishx);
  147. ShowPlayerDialog(playerid, DIALOG_GIFTBOX, DIALOG_STYLE_MSGBOX, "Premiu Giftbox", "Ai primit Clear FP.", "OK", "");
  148. format(string,sizeof(string),"(( Giftbox: %s a castigat Clear FP din giftbox! Felicitari! ))",sendername);
  149. }
  150. }
  151. if(randgift >= 141)
  152. {
  153. PlayerInfo[playerid][pHiddenColor] += 1;
  154. Update(playerid, pHiddenColorx);
  155. ShowPlayerDialog(playerid, DIALOG_GIFTBOX, DIALOG_STYLE_MSGBOX, "Premiu Giftbox", "Ai primit o culoare hidden.", "OK", "");
  156. format(string,sizeof(string),"(( Giftbox: %s a castigat o culoare hidden din giftbox! Felicitari! ))",sendername);
  157. }
  158. if(randgift == 30 || randgift == 60 || randgift == 90 || randgift == 110 || randgift == 140)
  159. {
  160. if(PremiumMaxim > 0)
  161. {
  162. new randpoints = 15 + random(25);
  163. PlayerInfo[playerid][pPremiumPoints] += randpoints;
  164. Update(playerid, pPremiumPointsx);
  165. PremiumMaxim -= 1;
  166. format(string,sizeof(string),"Ai primit %d puncte premium.",randpoints);
  167. ShowPlayerDialog(playerid, DIALOG_GIFTBOX, DIALOG_STYLE_MSGBOX, "Premiu Giftbox", string, "OK", "");
  168. format(string,sizeof(string),"(( Giftbox: %s a castigat %d puncte premium din giftbox! Felicitari! ))",sendername, randpoints);
  169. }
  170. else
  171. {
  172. new randmoney = 4000000 + random(1000000);
  173. GivePlayerCash(playerid, randmoney);
  174. Update(playerid, pCashx);
  175. format(string,sizeof(string),"Ai primit $%s.",FormatNumber(randmoney));
  176. ShowPlayerDialog(playerid, DIALOG_GIFTBOX, DIALOG_STYLE_MSGBOX, "Premiu Giftbox", string, "OK", "");
  177. format(string,sizeof(string),"(( Giftbox: %s a castigat $%s din giftbox! Felicitari! ))",sendername,FormatNumber(randmoney));
  178. }
  179. }
  180. new y,m,d,h,mi,s;
  181. getdate(y,m,d);
  182. gettime(h,mi,s);
  183. PlayerInfo[playerid][pGiftTime] += 2;
  184. SendClientMessageToAll(COLOR_GENANNOUNCE,string);
  185. Update(playerid, pGiftTimex);
  186. mysql_format(SQL, string, sizeof(string), "INSERT INTO giftbox_logs (`text`,`PlayerID`,`time`) VALUES ('%s','%d','%02d/%02d/%d %02d:%02d:%02d')", string, PlayerInfo[playerid][pSQLID],d,m,y,h,mi,s);
  187. mysql_tquery(SQL,string,"","");
  188. }
  189. else
  190. {
  191. SendClientMessage(playerid, COLOR_WHITE, "Nu esti langa giftbox.");
  192. return 1;
  193. }
  194. }
  195. else return SendClientMessage(playerid, COLOR_WHITE, "The giftbox is not active.");
  196. }
  197. return 1;
  198. }
Advertisement
Add Comment
Please, Sign In to add comment