Advertisement
Danch0

DRP

Jul 8th, 2013
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.15 KB | None | 0 0
  1. /*
  2.  
  3. =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
  4. .::Usefull Role-Play commands FILTERSCRIPT!::.
  5. .::Mask, 24/7 store, advertisements, weapon selling system, PD commands::.
  6.  
  7. .::Made by Dizzle, all rights reserved 2012(c)::.
  8. =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
  9.  
  10. */
  11.  
  12. //=============================================START OF DEFINES/SCRIPT=========================================================================
  13. // This is a comment
  14. // uncomment the line below if you want to write a filterscript
  15. #define FILTERSCRIPT
  16. #include <a_samp>
  17. #include <zcmd>
  18. #include <easydialog>
  19. #include <foreach>
  20. #include <sscanf2>
  21. #define COLOR_ERROR 0xFF0000AA
  22. #define COLOR_PM 0xFF0000AA
  23. #define green 0x33FF33AA
  24. #define yellow 0xFFFF00AA
  25. #define COLOR_FADE1 0xC2A2DAAA
  26. #define COLOR_FADE2 0xFFFFFFAA
  27. #define COLOR_FADE3 0xAAAAAAAA
  28. #define COLOR_FADE4 0x8C8C8C8C
  29. #define COLOR_FADE5 0x6E6E6E6E
  30. #define color_GREEN 0x9FFF00FF
  31. #define LIGHTGREEN 0x38FF06FF
  32. #define LIGHTBLUE2 0xF6BB0AA
  33. #define LIGHTBLUE 0x0BBF6AA
  34. #define COLOR_PINK 0xFF66FFAA
  35. #define COLOR_BLUE 0x0000BBAA
  36. #define COLOR_PURPLE 0x800080AA
  37. #define COLOR_GOVERNMENT 0x8A2BE2AA
  38. #define COLOR_WHITE 0xFFFFFFFF
  39. #define COLOR_GREY 0xAFAFAFFF
  40. #define COLOR_RED 0xFF0000AA
  41. #define COLOR_YELLOW 0xFFFF00FF
  42. #define COLOR_PDBLUE 0x2641FEAA
  43. #define COLOR_ORANGE 0xFF9900AA
  44. new HasBoughtMask[MAX_PLAYERS];
  45. new HasBoughtCigar[MAX_PLAYERS];
  46. new HasBoughtBeer[MAX_PLAYERS];
  47. new HasDrivingLic[MAX_PLAYERS];
  48. new HasGunLic[MAX_PLAYERS];
  49. new HasFlyingLic[MAX_PLAYERS];
  50. new bool:maskonface[MAX_PLAYERS] = false;
  51. new TogPM[MAX_PLAYERS];
  52. new AdvTimer1;
  53.  
  54. #pragma tabsize 0
  55. #if defined FILTERSCRIPT
  56.  
  57. //========================END OF DEFINES=========START OF COMMANDS==================================================================
  58.  
  59. CMD:cigar(playerid, params[])
  60. {
  61. if(HasBoughtCigar[playerid] == 1)
  62. SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
  63. else if(HasBoughtCigar[playerid] == 0)
  64. SendClientMessage(playerid, COLOR_RED, "You dont have any cigars, head to the 24/7 to buy some !");
  65. return 1;
  66. }
  67.  
  68. CMD:beer(playerid, params[])
  69. {
  70. if(HasBoughtBeer[playerid] == 1)
  71. SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DRINK_BEER );
  72. else if(HasBoughtBeer[playerid] == 0)
  73. SendClientMessage(playerid, COLOR_RED, "You dont have beer, head to the 24/7 to buy one !");
  74. return 1;
  75. }
  76.  
  77. CMD:maskon(playerid, params[])
  78. {
  79. if(maskonface[playerid] == true) return SendClientMessage(playerid,COLOR_RED,"You are already masked!");
  80. if(IsPlayerConnected(playerid))
  81. if(HasBoughtMask[playerid] == 1)
  82. {
  83. SendClientMessage(playerid, COLOR_FADE2,"You have put a mask on your face!");
  84. for(new i = 0; i < MAX_PLAYERS; i++)
  85. {
  86. maskonface[playerid] = true;
  87. ApplyAnimation(playerid, "SHOP", "ROB_Shifty", 4.0, 0, 0, 0, 0, 0);
  88. ShowPlayerNameTagForPlayer(i, playerid, false);
  89. }
  90. }
  91. else if(HasBoughtMask[playerid] == 0)
  92. SendClientMessage(playerid, COLOR_RED, "You dont have a mask, head to the 24/7 to buy one !");
  93. return 1;
  94. }
  95.  
  96. CMD:maskoff(playerid, params[])
  97. {
  98. if(maskonface[playerid] == false) return SendClientMessage(playerid,COLOR_RED,"You are not masked!");
  99. if(IsPlayerConnected(playerid))
  100. {
  101. for(new i = 0; i < MAX_PLAYERS; i++)
  102. {
  103. if(IsPlayerConnected(i))
  104. {
  105. maskonface[playerid] = false;
  106. ApplyAnimation(playerid, "MISC", "plyr_shkhead", 4.0, 0, 0, 0, 0, 0);
  107. ShowPlayerNameTagForPlayer(i, playerid, true);
  108. }
  109. }
  110. SendClientMessage(playerid, COLOR_FADE2, "You took the mask off your face!");
  111. }
  112. return 1;
  113. }
  114. CMD:buy(playerid, params[])
  115. {
  116. if(!IsPlayerInRangeOfPoint(playerid, 7.0, 2246.4563,53.0431,26.6671)) return SendClientMessage(playerid,-1,"You need to be in a 24/7 store."); // change the co-ords to the ones you want
  117. ShowDialog(playerid, Show:Test ,DIALOG_STYLE_LIST,"24/7 Store","Spraycan [$100]\nBat [$50]\nGolf Club [$70]\nShovel [$70]\nKatana [$100]\nCamera [$60]\nMask [$350]\nRuffles [$10]\nCoca-Cola [$10]\nCheeseburger [$15]\nCigarettes [$40]\nBeer [$20]","Purchase","Exit");
  118. return 1;
  119. }
  120.  
  121. forward AdvTimer();
  122.  
  123. CMD:adv(playerid, params[])
  124. {
  125. if (AdvTimer1 != 0) return SendClientMessage(playerid, 0xFF0000FF, "Âèå òðÿáâà äà èç÷àêàòå 3 ìèíóòè, ïðåäè äà íàïðàâèòå äðóãà îáÿâà.");
  126. if (isnull(params))
  127. {
  128. SendClientMessage(playerid, 0xFF0000FF, "Ïîëçâàé: /adv [Ðåêëàìà]");
  129. return 1;
  130. }
  131. new string[152], playername[24];
  132. GetPlayerName(playerid, playername, sizeof(playername));
  133. if(AntiAdv(playerid, params)) return 1;
  134. format(string, sizeof(string), "||*** Ðåêëàìà îò %s: %s ***||", playername, params);
  135. SendClientMessageToAll(0xFFFF00FF, string);
  136. AdvTimer1 = 1;
  137. SetTimer("AdvTimer", 180000, false);
  138. GivePlayerMoney(playerid, -500);
  139. SendClientMessage(playerid, -1, "Ðåêëàìàòà òè ñòðóâàøå 500$!");
  140. return 1;
  141. }
  142. CMD:buydrivinglic(playerid, params[])
  143. {
  144. if(!IsPlayerInRangeOfPoint(playerid, 5.0, 1490.9004,1305.6974,1093.2964)) return SendClientMessage(playerid,-1,"Âèå òðÿáâà äà ñòå äî ìÿñòîòî çà êóïóâàíå íà êíèæêà.");
  145. if(HasDrivingLic[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "Âèå âå÷å èìàòå øîôüîðñêà êíèæêà.");
  146. if(HasDrivingLic[playerid] == 0)
  147. (HasDrivingLic[playerid] = 1);
  148. GivePlayerMoney(playerid, -3000);
  149. SendClientMessage(playerid, -1, "Âèå êóïèõòå øîôüîðñêà êíèæêà çà $3000, àêî ñïàçâàòå ïðàâèëàòà, íÿìà äà èìàòå ïðîáëåìè ñ ïîëèöèÿòà.");
  150. return 1;
  151. }
  152.  
  153. CMD:buygunlic(playerid, params[])
  154. {
  155. if(!IsPlayerInRangeOfPoint(playerid, 5.0, 324.7650,305.0193,999.1484)) return SendClientMessage(playerid,-1,"Âèå òðÿáâà äà ñòå äî ìÿñòîòî çà êóïóâàíå íà ðàçðåøèòåëíî çà îðúæèå.");
  156. if(HasGunLic[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "Âèå âå÷å èìàòå ðàçðåøèòåëíî çà îðúæèå.");
  157. if(HasGunLic[playerid] == 0)
  158. (HasGunLic[playerid] = 1);
  159. GivePlayerMoney(playerid, -10000);
  160. SendClientMessage(playerid, -1, "Âèå êóïèõòå ðàçðåøèòåëíî çà îðúæèå çà $10000, àêî ñïàçâàòå ïðàâèëàòà, íÿìà äà èìàòå ïðîáëåìè ñ ïîëèöèÿòà.");
  161. return 1;
  162. }
  163.  
  164. CMD:buyflyinglic(playerid, params[])
  165. {
  166. if(!IsPlayerInRangeOfPoint(playerid, 5.0, 1491.4259,1307.3412,1093.2891)) return SendClientMessage(playerid,-1,"Âèå òðÿáâà äà ñòå äî ìÿñòîòî çà êóïóâàíå íà êíèæêà.");
  167. if(HasFlyingLic[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "Âèå âå÷å èìàòå ïèëîòñêà êíèæêà.");
  168. if(HasFlyingLic[playerid] == 0)
  169. (HasFlyingLic[playerid] = 1);
  170. GivePlayerMoney(playerid, -15000);
  171. SendClientMessage(playerid, -1, "Âèå êóïèõòå ïèëîòñêà êíèæêà çà $15 000, ñåãà âå÷å ìîæåòå ñïîêîéíî äà ëåòèòå ñúñ ñàìîëåò èëè õåëèêîïòåð.");
  172. return 1;
  173. }
  174.  
  175.  
  176. CMD:mylic(playerid, params[])
  177. {
  178. new lic[128], drivinglic[12], gunlic[12],flyinglic[12];
  179. if(HasDrivingLic[playerid] == 0) drivinglic = "Not Passed";
  180. else drivinglic = "Passed";
  181. if(HasGunLic[playerid] == 0) gunlic = "Not Passed";
  182. else gunlic = "Passed";
  183. if(HasFlyingLic[playerid] == 0) flyinglic = "Not Passed";
  184. else flyinglic = "Passed";
  185. format(lic, sizeof(lic), "** Your Licenses - [Driving]: %s || [Gun]: %s || [Flying]: %s", drivinglic,gunlic,flyinglic);
  186. SendClientMessage(playerid, -1, lic);
  187. return 1;
  188. }
  189. CMD:showlic(playerid, params[])
  190. {
  191. new lic2[128], drivinglic[12], gunlic[12],flyinglic[12];
  192. new playerb;
  193. if(sscanf(params,"u",playerb)) return SendClientMessage(playerid,-1,"Usage: /showlic [id]");
  194. if(!IsPlayerNearPlayer(playerid, playerb, 5.0)) return SendClientMessage(playerid, COLOR_RED, "You are too far away from that player.");
  195. if(HasDrivingLic[playerid] == 0) drivinglic = "Not Passed";
  196. else drivinglic = "Passed";
  197. if(HasGunLic[playerid] == 0) gunlic = "Not Passed";
  198. else gunlic = "Passed";
  199. if(HasFlyingLic[playerid] == 0) flyinglic = "Not Passed";
  200. else flyinglic = "Passed";
  201. format(lic2, sizeof(lic2), "** %s's Licenses - [Driving]: %s || [Gun]: %s || [Flying]: %s",NAMEGET(playerid),drivinglic,gunlic,flyinglic);
  202. SendClientMessage(playerb, -1, lic2);
  203. format(lic2, sizeof(lic2), "*** %s takes out his/her licenses and shows them to %s.", NAMEGET(playerid), NAMEGET(playerb));
  204. if(playerb == playerid)
  205. format(lic2, sizeof(lic2), "*** %s takes out his/her licenses and takes a look at them.", NAMEGET(playerid));
  206. NearMessageSender(playerid, 5.0, lic2, COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1);
  207. return 1;
  208. }
  209.  
  210. CMD:sdrivinglic(playerid, params[])
  211. {
  212. new lic3[128];
  213. new playerb;
  214. new pSkin;
  215. pSkin = GetPlayerSkin(playerid);
  216. if(pSkin == 265||pSkin == 266||pSkin == 267||pSkin == 280||pSkin == 282||pSkin == 288||pSkin == 165||pSkin == 166||pSkin == 284||pSkin == 285||pSkin == 286||pSkin == 287||pSkin == 283)
  217. if(sscanf(params,"u",playerb)) return SendClientMessage(playerid,-1,"Usage: /sdrivinglic [id]");
  218. if(!IsPlayerNearPlayer(playerid, playerb, 5.0)) return SendClientMessage(playerid, COLOR_RED, "You are too far away from that player.");
  219. if(HasDrivingLic[playerb] == 0) return SendClientMessage(playerid, COLOR_RED, "This person doesnt have driving license to suspend.");
  220. if(HasDrivingLic[playerb] == 1)
  221. (HasDrivingLic[playerb] = 0);
  222. format(lic3, sizeof(lic3), "** Law Enforcer %s has suspended your driving license, beware cause the police may ticket you.", NAMEGET(playerid));
  223. SendClientMessage(playerb, COLOR_RED, lic3);
  224. format(lic3, sizeof(lic3), "** You have suspended %s's driving license.", NAMEGET(playerb));
  225. SendClientMessage(playerid, COLOR_RED, lic3);
  226. return 1;
  227. }
  228.  
  229. CMD:sgunlic(playerid, params[])
  230. {
  231. new lic4[128];
  232. new playerb;
  233. new pSkin;
  234. pSkin = GetPlayerSkin(playerid);
  235. if(pSkin == 265||pSkin == 266||pSkin == 267||pSkin == 280||pSkin == 282||pSkin == 288||pSkin == 165||pSkin == 166||pSkin == 284||pSkin == 285||pSkin == 286||pSkin == 287||pSkin == 283)
  236. if(sscanf(params,"u",playerb)) return SendClientMessage(playerid,-1,"Usage: /sgunlic [id]");
  237. if(!IsPlayerNearPlayer(playerid, playerb, 5.0)) return SendClientMessage(playerid, COLOR_RED, "You are too far away from that player.");
  238. if(HasGunLic[playerb] == 0) return SendClientMessage(playerid, COLOR_RED, "This person doesnt have gun license to suspend.");
  239. if(HasGunLic[playerb] == 1)
  240. (HasGunLic[playerb] = 0);
  241. format(lic4, sizeof(lic4), "** Law Enforcer %s has suspended your gun license, you cannot use any legal weaponry now.", NAMEGET(playerid));
  242. SendClientMessage(playerb, COLOR_RED, lic4);
  243. format(lic4, sizeof(lic4), "** You have suspended %s's gun license.", NAMEGET(playerb));
  244. SendClientMessage(playerid, COLOR_RED, lic4);
  245. return 1;
  246. }
  247.  
  248. CMD:sflyinglic(playerid, params[])
  249. {
  250. new lic5[128];
  251. new playerb;
  252. new pSkin;
  253. pSkin = GetPlayerSkin(playerid);
  254. if(pSkin == 265||pSkin == 266||pSkin == 267||pSkin == 280||pSkin == 282||pSkin == 288||pSkin == 165||pSkin == 166||pSkin == 284||pSkin == 285||pSkin == 286||pSkin == 287||pSkin == 283)
  255. if(sscanf(params,"u",playerb)) return SendClientMessage(playerid,-1,"Usage: /sflyinglic [id]");
  256. if(!IsPlayerNearPlayer(playerid, playerb, 5.0)) return SendClientMessage(playerid, COLOR_RED, "You are too far away from that player.");
  257. if(HasFlyingLic[playerb] == 0) return SendClientMessage(playerid, COLOR_RED, "This person doesnt have flying license to suspend.");
  258. if(HasFlyingLic[playerb] == 1)
  259. (HasFlyingLic[playerb] = 0);
  260. format(lic5, sizeof(lic5), "** Law Enforcer %s has suspended your flying license, you may not fly with any helicopter/plane.", NAMEGET(playerid));
  261. SendClientMessage(playerb, COLOR_RED, lic5);
  262. format(lic5, sizeof(lic5), "** You have suspended %s's flying license.", NAMEGET(playerb));
  263. SendClientMessage(playerid, COLOR_RED, lic5);
  264. return 1;
  265. }
  266.  
  267.  
  268. //====================================START OF PUBLICS==============================================================================================================
  269.  
  270. public AdvTimer()
  271. {
  272. AdvTimer1 = 0;
  273. }
  274.  
  275. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  276. {
  277. if(newkeys & KEY_JUMP && !(oldkeys & KEY_JUMP) && GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_CUFFED) ApplyAnimation(playerid, "GYMNASIUM", "gym_jog_falloff",4.1,0,1,1,0,0);
  278. if(newkeys & KEY_SPRINT && !(oldkeys & KEY_SPRINT) && GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_CUFFED) ApplyAnimation(playerid, "GYMNASIUM", "gym_jog_falloff",4.1,0,1,1,0,0);
  279. return 1;
  280. }
  281.  
  282. public OnPlayerText(playerid, text[])
  283. {
  284. new textv2[128];
  285. if(maskonface[playerid] == true)
  286. {
  287. format(textv2, sizeof (textv2), "Stranger says: %s",text);
  288. NearMessageSender(playerid, 8, textv2, COLOR_FADE2,COLOR_FADE2,COLOR_FADE2,COLOR_FADE2,COLOR_FADE2);
  289. return 0;
  290. }
  291. else
  292. if(maskonface[playerid] == false)
  293. {
  294. return 1;
  295. }
  296. return 1;
  297. }
  298.  
  299. public OnPlayerDeath(playerid, killerid, reason)
  300. {
  301. (HasBoughtMask[playerid] = 0);
  302. (HasBoughtBeer[playerid] = 0);
  303. (HasBoughtCigar[playerid] = 0);
  304.  
  305. if(maskonface[playerid] == true)
  306. {
  307. maskonface[playerid] = false;
  308. for(new i = 0; i < MAX_PLAYERS; i++) ShowPlayerNameTagForPlayer(i, playerid, true);
  309. }
  310. return 1;
  311. }
  312.  
  313. public OnPlayerStreamIn(playerid, forplayerid)
  314. {
  315.  
  316. if(maskonface[playerid] == true)
  317. {
  318. ShowPlayerNameTagForPlayer(forplayerid, playerid, false);
  319. }
  320. return 1;
  321. }
  322.  
  323. Dialog:Test(playerid, response, listitem, inputtext[])
  324. {
  325. if(response)
  326. {
  327. switch(listitem)
  328. {
  329. case 0:
  330. {
  331. if(GetPlayerMoney(playerid) <100) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
  332. SendClientMessage(playerid,-1,"You purchased a Spraycan for $100!");
  333. GivePlayerWeapon(playerid, 41, 100);
  334. GivePlayerMoney(playerid, -100);
  335. }
  336. case 1:
  337. {
  338. if(GetPlayerMoney(playerid) <50) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
  339. SendClientMessage(playerid, -1, "You purchased a Baseball Bat for $50!");
  340. GivePlayerWeapon(playerid, 5, 1);
  341. GivePlayerMoney(playerid, -50);
  342. }
  343. case 2:
  344. {
  345. if(GetPlayerMoney(playerid) <70) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
  346. SendClientMessage(playerid, -1, "You purchased a Golf Club for $70!");
  347. GivePlayerWeapon(playerid, 2, 1);
  348. GivePlayerMoney(playerid, -70);
  349. }
  350. case 3:
  351. {
  352. if(GetPlayerMoney(playerid) <70) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
  353. SendClientMessage(playerid, -1, "You purchased a Shovel for $70!");
  354. GivePlayerWeapon(playerid, 6, 1);
  355. GivePlayerMoney(playerid, -70);
  356. }
  357. case 4:
  358. {
  359. if(GetPlayerMoney(playerid) <100) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
  360. SendClientMessage(playerid, -1, "You purchased a Katana for $100!");
  361. GivePlayerWeapon(playerid, 8, 1);
  362. GivePlayerMoney(playerid, -100);
  363. }
  364. case 5:
  365. {
  366. if(GetPlayerMoney(playerid) <60) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
  367. SendClientMessage(playerid, -1, "You purchased a Camera for $60!");
  368. GivePlayerMoney(playerid, -60);
  369. GivePlayerWeapon(playerid, 43, 100);
  370. }
  371. case 6:
  372. {
  373. if(GetPlayerMoney(playerid) <350) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
  374. SendClientMessage(playerid, -1, "You purchased a Mask for $350! ((/maskon & /maskoff))");
  375. GivePlayerMoney(playerid, -350);
  376. (HasBoughtMask[playerid] = 1);
  377. }
  378. case 7:
  379. {
  380. if(GetPlayerMoney(playerid) <10) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
  381. new Float:pHealth;
  382. GetPlayerHealth(playerid, Float:pHealth);
  383. SendClientMessage(playerid, -1, "You purchased a pack of Ruffles for $10! ((+20 HP))");
  384. ApplyAnimation(playerid,"VENDING", "vend_eat1_P",4.1,0,1,1,1,1,1);
  385. GivePlayerMoney(playerid, -10);
  386. SetPlayerHealth(playerid, pHealth+20);
  387. }
  388. case 8:
  389. {
  390. if(GetPlayerMoney(playerid) <10) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
  391. new Float:pHealth;
  392. GetPlayerHealth(playerid, Float:pHealth);
  393. SendClientMessage(playerid, -1, "You purchased a bottle of Coca-Cola for $10! ((+10 HP))");
  394. GivePlayerMoney(playerid, -10);
  395. SetPlayerHealth(playerid, pHealth+10);
  396. }
  397. case 9:
  398. {
  399. if(GetPlayerMoney(playerid) <15) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
  400. new Float:pHealth;
  401. GetPlayerHealth(playerid, Float:pHealth);
  402. SendClientMessage(playerid, -1, "You purchased a Cheese Burger for $15! ((+30 HP))");
  403. ApplyAnimation(playerid,"VENDING", "vend_eat1_P",4.1,0,1,1,1,1,1);
  404. GivePlayerMoney(playerid, -15);
  405. SetPlayerHealth(playerid, pHealth+30);
  406. }
  407. case 10:
  408. {
  409. if(GetPlayerMoney(playerid) <40) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
  410. SendClientMessage(playerid, -1, "You purchased a box of cigars for $40! ((/cigar))");
  411. GivePlayerMoney(playerid, -40);
  412. (HasBoughtCigar[playerid] = 1);
  413. }
  414. case 11:
  415. {
  416. if(GetPlayerMoney(playerid) <20) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
  417. SendClientMessage(playerid, -1, "You purchased a bottle of beer for $20!");
  418. GivePlayerMoney(playerid, -20);
  419. HasBoughtBeer[playerid] = 1;
  420. }
  421. }
  422. }
  423. return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
  424. }
  425.  
  426.  
  427. public OnPlayerConnect(playerid)
  428. {
  429. (HasBoughtMask[playerid] = 0);
  430. (HasBoughtBeer[playerid] = 0);
  431. (HasBoughtCigar[playerid] = 0);
  432. TogPM{playerid} = 1;
  433. return true;
  434. }
  435.  
  436. public OnPlayerDisconnect(playerid, reason)
  437. {
  438. (HasBoughtMask[playerid] = 0);
  439. (HasBoughtBeer[playerid] = 0);
  440. (HasBoughtCigar[playerid] = 0);
  441. return true;
  442. }
  443.  
  444. //===============END OF PUBLICS=====================START OF STOCKS=======================================================================================//
  445.  
  446. stock NearMessageSender(playerid, Float:radius, string[], col1, col2, col3, col4, col5)
  447. {
  448. new Float:x, Float:y, Float:z;
  449. GetPlayerPos(playerid, x, y, z);
  450. new Float:ix, Float:iy, Float:iz;
  451. new Float:cx, Float:cy, Float:cz;
  452. foreach(Player, i)
  453. {
  454. if(GetPlayerInterior(playerid) == GetPlayerInterior(i) && GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
  455. {
  456. GetPlayerPos(i, ix, iy, iz);
  457. cx = (x - ix);
  458. cy = (y - iy);
  459. cz = (z - iz);
  460. if(((cx < radius/16) && (cx > -radius/16)) && ((cy < radius/16) && (cy > -radius/16)) && ((cz < radius/16) && (cz > -radius/16)))
  461. {
  462. SendClientMessage(i, col1, string);
  463. }
  464. else if(((cx < radius/8) && (cx > -radius/8)) && ((cy < radius/8) && (cy > -radius/8)) && ((cz < radius/8) && (cz > -radius/8)))
  465. {
  466. SendClientMessage(i, col2, string);
  467. }
  468. else if(((cx < radius/4) && (cx > -radius/4)) && ((cy < radius/4) && (cy > -radius/4)) && ((cz < radius/4) && (cz > -radius/4)))
  469. {
  470. SendClientMessage(i, col3, string);
  471. }
  472. else if(((cx < radius/2) && (cx > -radius/2)) && ((cy < radius/2) && (cy > -radius/2)) && ((cz < radius/2) && (cz > -radius/2)))
  473. {
  474. SendClientMessage(i, col4, string);
  475. }
  476. else if(((cx < radius) && (cx > -radius)) && ((cy < radius) && (cy > -radius)) && ((cz < radius) && (cz > -radius)))
  477. {
  478. SendClientMessage(i, col5, string);
  479. }
  480. }
  481. }
  482. return 1;
  483. }
  484.  
  485. stock NAMEGET(playerid)
  486. {
  487. new name[MAX_PLAYER_NAME];
  488. GetPlayerName(playerid,name,sizeof(name));
  489. for(new i = 0; i < MAX_PLAYER_NAME; i++)
  490. {
  491. if(name[i] == '_') name[i] = ' ';
  492. }
  493. return name;
  494. }
  495. stock AntiAdv(playerid, text[])
  496. {
  497. new strR[255], is1=0, r=0;
  498. while(strlen(text[is1]))
  499. {
  500. if('0'<=text[is1]<='9')
  501. {
  502. new is2=is1+1, p=0;
  503. while(p==0)
  504. {
  505. if('0'<=text[is2]<='9'&&strlen(text[is2]))
  506. {
  507. is2++;
  508. }
  509. else
  510. {
  511. strmid(strR[r],text,is1,is2,255);
  512. if(strval(strR[r])<255) r++;
  513. is1=is2;
  514. p=1;
  515. }
  516. }
  517. }
  518. is1++;
  519. }
  520. if(r>=4)
  521. {
  522. new strMy[255];
  523. format(strMy, sizeof(strMy), " \"Your server name here\": %s is attempting to Server Advertise", NAMEGET(playerid));
  524. SendClientMessage(COLOR_GOVERNMENT, 1, strMy);
  525. new pr2;
  526. for(new z=0;z<r;z++)
  527. {
  528.  
  529. while((pr2=strfind(text,strR[z],true))!=-1)
  530. {
  531. for(new i=pr2,j=pr2+strlen(strR[z]);i<j;i++)
  532. {
  533. text[i]='*';
  534. }
  535. }
  536. }
  537. return 1;
  538. }
  539. return 0;
  540. }
  541.  
  542. stock IsPlayerNearPlayer(playerid, targetid, Float:radius)
  543. {
  544. new Float:x, Float:y, Float:z;
  545. GetPlayerPos(targetid, x, y, z);
  546. if(IsPlayerInRangeOfPoint(playerid, radius ,x, y, z))
  547. {
  548. return 1;
  549. }
  550. return 0;
  551. }
  552. #endif
  553. //=========================================================END OF STOCKS=====================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement