IceBilizard

Simple VIP system on months with (ZCMD + sscanf + Dini)

Jul 29th, 2014
1,903
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.88 KB | None | 0 0
  1. // This is a comment
  2. // uncomment the line below if you want to write a filterscript
  3. //#define FILTERSCRIPT
  4.  
  5. #include <a_samp>
  6. #include <dini>
  7. #include <zcmd>
  8. #include <sscanf>
  9. #if defined FILTERSCRIPT
  10.  
  11.  
  12.  
  13.  
  14.  
  15. public OnFilterScriptInit()
  16. {
  17. print("\n--------------------------------------");
  18. print(" VIP System");
  19. print("--------------------------------------\n");
  20. return 1;
  21. }
  22.  
  23. public OnFilterScriptExit()
  24. {
  25. return 1;
  26. }
  27.  
  28. #else
  29.  
  30. main()
  31. {
  32. }
  33.  
  34. #endif
  35.  
  36.  
  37. //COLOUR DEFINES
  38. #define COLOR_GREY 0xFFFFFFAA
  39. #define COLOR_RED 0xFF0000AA
  40. #define COLOR_INFO2 0x99FFCCFF
  41. #define COLOR_SILVER 0xB5C9ECFF
  42. #define COLOR_INFO 0x649ED8FF
  43. #define COLOR_ADMIN 0x008FD6FF
  44. #define COLOR_GREEN 0xADFF2FAA
  45. #define COLOR_GOLDEN 0xFFFFCCFF
  46. #define COLOR_IGNORE 0xFF9966AA
  47. #define COLOR_YELLOW 0xFFFF00AA
  48. #define COLOR_WHITE 0xFFFFFFAA
  49. #define COLOR_BLUE 0x0000BBAA
  50. #define COLOR_SPAWN 0xFF6633AA
  51. #define COLOR_MOTOR 0x8E4848AA
  52. #define COLOR_MOTOR1 0xC28547AA
  53. #define COLOR_LIGHTBLUE 0x33CCFFAA
  54. #define COLOR_DARKGOLD 0x808000AA
  55. #define COLOR_ORANGE 0xFF9900AA
  56. #define COLOR_DARKGREEN 0x12900BBF
  57. #define COLOR_BROWN1 0xFFFFFFAA
  58. #define COLOR_LIME 0x10F441AA
  59. #define COLOR_MAGENTA 0xFF00FFFF
  60. #define COLOR_NAVY 0x000080AA
  61. #define COLOR_AQUA 0xF0F8FFAA
  62. #define COLOR_CRIMSON 0xDC143CAA
  63. #define COLOR_FLBLUE 0x6495EDAA
  64. #define COLOR_BISQUE 0xFFE4C4AA
  65. #define COLOR_BLACK 0x000000AA
  66. #define COLOR_CHART 0x7FFF00AA
  67. #define COLOR_BROWN 0xFFFFFFAA
  68. #define COLOR_CORAL 0xFF643DAA
  69. #define COLOR_GOLD 0xB8860BAA
  70. #define COLOR_GYELLOW 0xADFF2FAA
  71. #define COLOR_INDIGO 0x4B00B0AA
  72. #define COLOR_IVORY 0xFFFF82AA
  73. #define COLOR_LAWNGREEN 0x7CFC00AA
  74. #define COLOR_SEAGREEN 0x15D5EAC8
  75. #define COLOR_LIMEGREEN 0x32CD32AA
  76. #define COLOR_MTBLUE 0x191970AA
  77. #define COLOR_MAROON 0x800000AA
  78. #define COLOR_OLIVE 0x808000AA
  79. #define COLOR_ORANGERED 0xFF4500AA
  80. #define COLOR_PINK 0xFFC0CBAA
  81. #define COLOR_FADE1 0xE6E6E6E6
  82. #define COLOR_FADE2 0xC8C8C8C8
  83. #define COLOR_FADE3 0xAAAAAAAA
  84. #define COLOR_FADE4 0x8C8C8C8C
  85. #define COLOR_YELLOW3 0xFFFF00FF
  86. #define COLOR_FADE5 0x6E6E6E6E
  87. #define COLOR_YELLOW 0xFFFF00AA
  88. #define COLOR_CYAN 0x40FFFFFF
  89. #define COLOR_YELLOW2 0xF5DEB3AA
  90. #define COLOR_PURPLE 0x800080FF
  91. //#define COLOR_SYSTEM 0xA9C4E4FF
  92. #define COLOR_SYSTEM 0xFFFF33AA
  93. #define LIGHTGREEN 0xFFFFE0FF
  94. #define red 0xFF0000FF
  95. #define green 0x00F20096
  96. #define COLOR_SAMP 0xA9C4E4FF
  97. #define COLOR_SYSTEM_PM 0x66CC00AA // LIGHT GREEN
  98. #define COLOR_SYSTEM_PW 0xFFFF33AA // YELLOW
  99. #define MAX_VIP_VEHS 100
  100.  
  101.  
  102.  
  103.  
  104.  
  105. //news
  106. new VehicleNames[212][] = {
  107. {"Landstalker"},{"Bravura"},{"Buffalo"},{"Linerunner"},{"Perrenial"},{"Sentinel"},{"Dumper"},
  108. {"Firetruck"},{"Trashmaster"},{"Stretch"},{"Manana"},{"Infernus"},{"Voodoo"},{"Pony"},{"Mule"},
  109. {"Cheetah"},{"Ambulance"},{"Leviathan"},{"Moonbeam"},{"Esperanto"},{"Taxi"},{"Washington"},
  110. {"Bobcat"},{"Mr Whoopee"},{"BF Injection"},{"Hunter"},{"Premier"},{"Enforcer"},{"Securicar"},
  111. {"Banshee"},{"Predator"},{"Bus"},{"Rhino"},{"Barracks"},{"Hotknife"},{"Trailer 1"},{"Previon"},
  112. {"Coach"},{"Cabbie"},{"Stallion"},{"Rumpo"},{"RC Bandit"},{"Romero"},{"Packer"},{"Monster"},
  113. {"Admiral"},{"Squalo"},{"Seasparrow"},{"Pizzaboy"},{"Tram"},{"Trailer 2"},{"Turismo"},
  114. {"Speeder"},{"Reefer"},{"Tropic"},{"Flatbed"},{"Yankee"},{"Caddy"},{"Solair"},{"Berkley's RC Van"},
  115. {"Skimmer"},{"PCJ-600"},{"Faggio"},{"Freeway"},{"RC Baron"},{"RC Raider"},{"Glendale"},{"Oceanic"},
  116. {"Sanchez"},{"Sparrow"},{"Patriot"},{"Quad"},{"Coastguard"},{"Dinghy"},{"Hermes"},{"Sabre"},
  117. {"Rustler"},{"ZR-350"},{"Walton"},{"Regina"},{"Comet"},{"BMX"},{"Burrito"},{"Camper"},{"Marquis"},
  118. {"Baggage"},{"Dozer"},{"Maverick"},{"News Chopper"},{"Rancher"},{"FBI Rancher"},{"Virgo"},{"Greenwood"},
  119. {"Jetmax"},{"Hotring"},{"Sandking"},{"Blista Compact"},{"Police Maverick"},{"Boxville"},{"Benson"},
  120. {"Mesa"},{"RC Goblin"},{"Hotring Racer A"},{"Hotring Racer B"},{"Bloodring Banger"},{"Rancher"},
  121. {"Super GT"},{"Elegant"},{"Journey"},{"Bike"},{"Mountain Bike"},{"Beagle"},{"Cropdust"},{"Stunt"},
  122. {"Tanker"}, {"Roadtrain"},{"Nebula"},{"Majestic"},{"Buccaneer"},{"Shamal"},{"Hydra"},{"FCR-900"},
  123. {"NRG-500"},{"HPV1000"},{"Cement Truck"},{"Tow Truck"},{"Fortune"},{"Cadrona"},{"FBI Truck"},
  124. {"Willard"},{"Forklift"},{"Tractor"},{"Combine"},{"Feltzer"},{"Remington"},{"Slamvan"},
  125. {"Blade"},{"Freight"},{"Streak"},{"Vortex"},{"Vincent"},{"Bullet"},{"Clover"},{"Sadler"},
  126. {"Firetruck LA"},{"Hustler"},{"Intruder"},{"Primo"},{"Cargobob"},{"Tampa"},{"Sunrise"},{"Merit"},
  127. {"Utility"},{"Nevada"},{"Yosemite"},{"Windsor"},{"Monster A"},{"Monster B"},{"Uranus"},{"Jester"},
  128. {"Sultan"},{"Stratum"},{"Elegy"},{"Raindance"},{"RC Tiger"},{"Flash"},{"Tahoma"},{"Savanna"},
  129. {"Bandito"},{"Freight Flat"},{"Streak Carriage"},{"Kart"},{"Mower"},{"Duneride"},{"Sweeper"},
  130. {"Broadway"},{"Tornado"},{"AT-400"},{"DFT-30"},{"Huntley"},{"Stafford"},{"BF-400"},{"Newsvan"},
  131. {"Tug"},{"Trailer 3"},{"Emperor"},{"Wayfarer"},{"Euros"},{"Hotdog"},{"Club"},{"Freight Carriage"},
  132. {"Trailer 3"},{"Andromada"},{"Dodo"},{"RC Cam"},{"Launch"},{"Police Car (LSPD)"},{"Police Car (SFPD)"},
  133. {"Police Car (LVPD)"},{"Police Ranger"},{"Picador"},{"S.W.A.T. Van"},{"Alpha"},{"Phoenix"},{"Glendale"},
  134. {"Sadler"},{"Luggage Trailer A"},{"Luggage Trailer B"},{"Stair Trailer"},{"Boxville"},{"Farm Plow"},
  135. {"Utility Trailer"}
  136. };
  137.  
  138.  
  139. new VipVeh[MAX_VIP_VEHS];
  140.  
  141.  
  142. public OnPlayerRequestClass(playerid, classid)
  143. {
  144. return 1;
  145. }
  146.  
  147. public OnPlayerConnect(playerid)
  148. {
  149. SetTimerEx("VIPCLOCK", 500, 1, "i", playerid);
  150. return 1;
  151. }
  152.  
  153. public OnPlayerDisconnect(playerid, reason)
  154. {
  155. return 1;
  156. }
  157.  
  158. public OnPlayerSpawn(playerid)
  159. {
  160. return 1;
  161. }
  162.  
  163. public OnPlayerDeath(playerid, killerid, reason)
  164. {
  165. return 1;
  166. }
  167.  
  168. public OnVehicleSpawn(vehicleid)
  169. {
  170. return 1;
  171. }
  172.  
  173. public OnVehicleDeath(vehicleid, killerid)
  174. {
  175. return 1;
  176. }
  177.  
  178. public OnPlayerText(playerid, text[])
  179. {
  180. return 1;
  181. }
  182.  
  183. public OnPlayerCommandText(playerid, cmdtext[])
  184. {
  185.  
  186. return 0;
  187. }
  188.  
  189. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  190. {
  191. return 1;
  192. }
  193.  
  194. public OnPlayerExitVehicle(playerid, vehicleid)
  195. {
  196. return 1;
  197. }
  198.  
  199. public OnPlayerStateChange(playerid, newstate, oldstate)
  200. {
  201. return 1;
  202. }
  203.  
  204. public OnPlayerEnterCheckpoint(playerid)
  205. {
  206. return 1;
  207. }
  208.  
  209. public OnPlayerLeaveCheckpoint(playerid)
  210. {
  211. return 1;
  212. }
  213.  
  214. public OnPlayerEnterRaceCheckpoint(playerid)
  215. {
  216. return 1;
  217. }
  218.  
  219. public OnPlayerLeaveRaceCheckpoint(playerid)
  220. {
  221. return 1;
  222. }
  223.  
  224. public OnRconCommand(cmd[])
  225. {
  226. return 1;
  227. }
  228.  
  229. public OnPlayerRequestSpawn(playerid)
  230. {
  231. return 1;
  232. }
  233.  
  234. public OnObjectMoved(objectid)
  235. {
  236. return 1;
  237. }
  238.  
  239. public OnPlayerObjectMoved(playerid, objectid)
  240. {
  241. return 1;
  242. }
  243.  
  244. public OnPlayerPickUpPickup(playerid, pickupid)
  245. {
  246. return 1;
  247. }
  248.  
  249. public OnVehicleMod(playerid, vehicleid, componentid)
  250. {
  251. return 1;
  252. }
  253.  
  254. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  255. {
  256. return 1;
  257. }
  258.  
  259. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  260. {
  261. return 1;
  262. }
  263.  
  264. public OnPlayerSelectedMenuRow(playerid, row)
  265. {
  266. return 1;
  267. }
  268.  
  269. public OnPlayerExitedMenu(playerid)
  270. {
  271. return 1;
  272. }
  273.  
  274. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  275. {
  276. return 1;
  277. }
  278.  
  279. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  280. {
  281. return 1;
  282. }
  283.  
  284. public OnRconLoginAttempt(ip[], password[], success)
  285. {
  286. return 1;
  287. }
  288.  
  289. public OnPlayerUpdate(playerid)
  290. {
  291. return 1;
  292. }
  293.  
  294. public OnPlayerStreamIn(playerid, forplayerid)
  295. {
  296. return 1;
  297. }
  298.  
  299. public OnPlayerStreamOut(playerid, forplayerid)
  300. {
  301. return 1;
  302. }
  303.  
  304. public OnVehicleStreamIn(vehicleid, forplayerid)
  305. {
  306. return 1;
  307. }
  308.  
  309. public OnVehicleStreamOut(vehicleid, forplayerid)
  310. {
  311. return 1;
  312. }
  313.  
  314. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  315. {
  316. return 1;
  317. }
  318.  
  319. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  320. {
  321. return 1;
  322. }
  323.  
  324. //Set Vip Command:
  325. CMD:setvip(playerid, params[])
  326. {
  327. new months,Nam[MAX_PLAYER_NAME],pname[MAX_PLAYER_NAME],str[128],ID;
  328. if(IsPlayerAdmin(playerid))//Is player is rcon administrator
  329. {
  330. if(sscanf(params,"ui",ID,months)) return SendClientMessage(playerid,0xFFFFFFAA, "Usage: /setvip [id] [months 0-12]");
  331. if(months > 12) return SendClientMessage(playerid,0xFF0000AA,"Error: Maximum months - 12");
  332. if(months < 0) return SendClientMessage(playerid,0xFF0000AA,"Error: Invalid Month!");
  333. if(!IsPlayerConnected(ID))return SendClientMessage(playerid,0xFF0000AA,"Error: Invalid player id!");
  334. new string[128];
  335. format(string,sizeof(string),"Error: That person already posses VIP Level 1.");
  336. if(dini_Int(pFile(ID),"VIP") == 1) return SendClientMessage(playerid,0xFF0000AA,string);
  337. GetPlayerName(playerid,Nam, MAX_PLAYER_NAME);
  338. GetPlayerName(ID,pname,MAX_PLAYER_NAME);
  339.  
  340. if(months == 1)
  341. {
  342. SendClientMessage(ID,0xFFFF00AA,"You have recieved VIP Package (1 Month) Subscribtion.");
  343. GameTextForPlayer(ID, "Enjoy ~g~1 Month VIP!", 3000, 5);
  344. SendClientMessage(ID,0xFFFFFFAA,"Type /vcmds for the list of VIP commands.");
  345. format(str, sizeof(str),"You've given %s a VIP Package (1 Month) subscription",pname);
  346. SendClientMessage(playerid,0xFFFFFFAA,str);
  347. dini_IntSet(pFile(ID),"VIP",1);
  348. dini_IntSet(pFile(ID),"VIPTIME",gettime()+60*60*24*30);
  349. }
  350. if(months == 2)
  351. {
  352. SendClientMessage(ID,0xFFFF00AA,"You have recieved VIP Package (2 Months) Subscribtion.");
  353. GameTextForPlayer(ID, "Enjoy ~g~2 Months VIP!", 3000, 5);
  354. SendClientMessage(ID,0xFFFFFFAA,"Type /vcmds for the list of VIP commands.");
  355. format(str, sizeof(str),"You've given %s a VIP Package (2 Months) subscription",pname);
  356. SendClientMessage(playerid,0xFFFFFFAA,str);
  357. dini_IntSet(pFile(ID),"VIP",1);
  358. dini_IntSet(pFile(ID),"VIPTIME",gettime()+60*60*24*60);
  359. }
  360. if(months == 3)
  361. {
  362. SendClientMessage(ID,0xFFFF00AA,"You have recieved VIP Package (3 Months) Subscribtion.");
  363. GameTextForPlayer(ID, "Enjoy ~g~3 Months VIP!", 3000, 5);
  364. SendClientMessage(ID,0xFFFFFFAA,"Type /vcmds for the list of VIP commands.");
  365. format(str, sizeof(str),"You've given %s a VIP Package (3 Months) subscription",pname);
  366. SendClientMessage(playerid,0xFFFFFFAA,str);
  367. dini_IntSet(pFile(ID),"VIP",1);
  368. dini_IntSet(pFile(ID),"VIPTIME",gettime()+60*60*24*90);
  369. }
  370. if(months == 4)
  371. {
  372. SendClientMessage(ID,0xFFFF00AA,"You have recieved VIP Package (4 Months) Subscribtion.");
  373. GameTextForPlayer(ID, "Enjoy ~g~4 Months VIP!", 3000, 5);
  374. SendClientMessage(ID,0xFFFFFFAA,"Type /vcmds for the list of VIP commands.");
  375. format(str, sizeof(str),"You've given %s a VIP Package (4 Months) subscription",pname);
  376. SendClientMessage(playerid,0xFFFFFFAA,str);
  377. dini_IntSet(pFile(ID),"VIP",1);
  378. dini_IntSet(pFile(ID),"VIPTIME",gettime()+60*60*24*120);
  379. }
  380. if(months == 5)
  381. {
  382. SendClientMessage(ID,0xFFFF00AA,"You have recieved VIP Package (5 Months) Subscribtion.");
  383. GameTextForPlayer(ID, "Enjoy ~g~5 Months VIP!", 3000, 5);
  384. SendClientMessage(ID,0xFFFFFFAA,"Type /vcmds for the list of VIP commands.");
  385. format(str, sizeof(str),"You've given %s a VIP Package (5 Months) subscription",pname);
  386. SendClientMessage(playerid,0xFFFFFFAA,str);
  387. dini_IntSet(pFile(ID),"VIP",1);
  388. dini_IntSet(pFile(ID),"VIPTIME",gettime()+60*60*24*150);
  389. }
  390. if(months == 6)
  391. {
  392. SendClientMessage(ID,0xFFFF00AA,"You have recieved VIP Package (6 Months) Subscribtion.");
  393. GameTextForPlayer(ID, "Enjoy ~g~6 Months VIP!", 3000, 5);
  394. SendClientMessage(ID,0xFFFFFFAA,"Type /vcmds for the list of VIP commands.");
  395. format(str, sizeof(str),"You've given %s a VIP Package (6 Months) subscription",pname);
  396. SendClientMessage(playerid,0xFFFFFFAA,str);
  397. dini_IntSet(pFile(ID),"VIP",1);
  398. dini_IntSet(pFile(ID),"VIPTIME",gettime()+60*60*24*180);
  399. }
  400. if(months == 7)
  401. {
  402. SendClientMessage(ID,0xFFFF00AA,"You have recieved VIP Package (7 Months) Subscribtion.");
  403. GameTextForPlayer(ID, "Enjoy ~g~7 Months VIP!", 3000, 5);
  404. SendClientMessage(ID,0xFFFFFFAA,"Type /vcmds for the list of VIP commands.");
  405. format(str, sizeof(str),"You've given %s a VIP Package (7 Months) subscription",pname);
  406. SendClientMessage(playerid,0xFFFFFFAA,str);
  407. dini_IntSet(pFile(ID),"VIP",1);
  408. dini_IntSet(pFile(ID),"VIPTIME",gettime()+60*60*24*210);
  409. }
  410. if(months == 8)
  411. {
  412. SendClientMessage(ID,0xFFFF00AA,"You have recieved VIP Package (8 Months) Subscribtion.");
  413. GameTextForPlayer(ID, "Enjoy ~g~8 Months VIP!", 3000, 5);
  414. SendClientMessage(ID,0xFFFFFFAA,"Type /vcmds for the list of VIP commands.");
  415. format(str, sizeof(str),"You've given %s a VIP Package (8 Months) subscription",pname);
  416. SendClientMessage(playerid,0xFFFFFFAA,str);
  417. dini_IntSet(pFile(ID),"VIP",1);
  418. dini_IntSet(pFile(ID),"VIPTIME",gettime()+60*60*24*240);
  419. }
  420. if(months == 9)
  421. {
  422. SendClientMessage(ID,0xFFFF00AA,"You have recieved VIP Package (9 Months) Subscribtion.");
  423. GameTextForPlayer(ID, "Enjoy ~g~9 Months VIP!", 3000, 5);
  424. SendClientMessage(ID,0xFFFFFFAA,"Type /vcmds for the list of VIP commands.");
  425. format(str, sizeof(str),"You've given %s a VIP Package (9 Months) subscription",pname);
  426. SendClientMessage(playerid,0xFFFFFFAA,str);
  427. dini_IntSet(pFile(ID),"VIP",1);
  428. dini_IntSet(pFile(ID),"VIPTIME",gettime()+60*60*24*270);
  429. }
  430. if(months == 10)
  431. {
  432. SendClientMessage(ID,0xFFFF00AA,"You have recieved VIP Package (10 Months) Subscribtion.");
  433. GameTextForPlayer(ID, "Enjoy ~g~10 Months VIP!", 3000, 5);
  434. SendClientMessage(ID,0xFFFFFFAA,"Type /vcmds for the list of VIP commands.");
  435. format(str, sizeof(str),"You've given %s a VIP Package (10 Months) subscription",pname);
  436. SendClientMessage(playerid,0xFFFFFFAA,str);
  437. dini_IntSet(pFile(ID),"VIP",1);
  438. dini_IntSet(pFile(ID),"VIPTIME",gettime()+60*60*24*300);
  439. }
  440. if(months == 11)
  441. {
  442. SendClientMessage(ID,0xFFFF00AA,"You have recieved VIP Package (11 Months) Subscribtion.");
  443. GameTextForPlayer(ID, "Enjoy ~g~11 Months VIP!", 3000, 5);
  444. SendClientMessage(ID,0xFFFFFFAA,"Type /vcmds for the list of VIP commands.");
  445. format(str, sizeof(str),"You've given %s a VIP Package (11 Months) subscription",pname);
  446. SendClientMessage(playerid,0xFFFFFFAA,str);
  447. dini_IntSet(pFile(ID),"VIP",1);
  448. dini_IntSet(pFile(ID),"VIPTIME",gettime()+60*60*24*330);
  449. }
  450. if(months == 12)
  451. {
  452. SendClientMessage(ID,0xFFFF00AA,"You have recieved VIP Package (1 Year) Subscribtion.");
  453. GameTextForPlayer(ID, "Enjoy ~g~1 Year VIP!", 3000, 5);
  454. SendClientMessage(ID,0xFFFFFFAA,"Type /vcmds for the list of VIP commands.");
  455. format(str, sizeof(str),"You've given %s a VIP Package (1 Year) subscription",pname);
  456. SendClientMessage(playerid,0xFFFFFFAA,str);
  457. dini_IntSet(pFile(ID),"VIP",1);
  458. dini_IntSet(pFile(ID),"VIPTIME",gettime()+60*60*24*360);
  459. }
  460. if(months == 0)
  461. {
  462. SendClientMessage(ID,0xFFFF00AA,"You have recieved VIP Package 1 (Life Time) Subscribtion.");
  463. GameTextForPlayer(ID, "Enjoy ~g~Unlimited VIP!", 3000, 5);
  464. SendClientMessage(ID,0xFFFFFFAA,"Type /vcmds for the list of VIP commands.");
  465. format(str, sizeof(str),"You've given %s a VIP Package 1 (Life Time) subscription",pname);
  466. SendClientMessage(playerid,0xFFFFFFAA,str);
  467. dini_IntSet(pFile(ID),"VIP",1);
  468. dini_IntSet(pFile(ID),"VIPTIME",gettime()+60*60*24*1000);
  469. }
  470. }
  471. else return 0;
  472. return 1;
  473.  
  474.  
  475. }
  476. // Vip Commands
  477. CMD:vcmds(playerid, params[])
  478. {
  479. return cmd_vipcommands(playerid, params);
  480. }
  481. CMD:vipcommands(playerid, params[])
  482. {
  483. if(IsPlayerConnected(playerid))
  484. {
  485. new str[200];
  486. if (dini_Int(pFile(playerid),"VIP") >= 1)
  487. {
  488. format(str,sizeof(str),"{FFFF00}VCMDS: {FFFFFF}/carcolor /changeskin /weather /veh /dvc /nos /vc /vpm /vrepair /vflip");
  489. SendClientMessage(playerid, 0xFFFFFFAA, str);
  490. }
  491. else return 0;
  492. }
  493. return 1;
  494. }
  495. CMD:carcolor(playerid,params[])
  496. {
  497. new color;
  498. new color2;
  499. new string[100];
  500. if(dini_Int(pFile(playerid),"VIP") >= 1)
  501. {
  502. if(GetPlayerState(playerid)==PLAYER_STATE_DRIVER)
  503. {
  504. if(sscanf(params,"ii",color,color2)) return SendClientMessage(playerid, -1, "Usage: /carcolor [color] [color2]");
  505. ChangeVehicleColor(GetPlayerVehicleID(playerid), color,color2);
  506. format(string, sizeof(string), "You have successfully changed your car color with %d and %d color ids",color,color2);
  507. SendClientMessage(playerid,0xFFFFFFAA, string);
  508.  
  509. }else return SendClientMessage(playerid,-1,"ERROR: You must be in a vehicle.");
  510. }else return SendClientMessage(playerid, 0xFF0000AA, "You are not VIP member.");
  511. return 1;
  512. }
  513. CMD:changeskin(playerid, params[])
  514. {
  515. new skin;
  516. if(dini_Int(pFile(playerid),"VIP") >= 1)
  517. {
  518. if(sscanf(params,"i",skin)) return SendClientMessage(playerid,0xFFFFFFAA,"USAGE: /changeskin [SkinID]");
  519. SendClientMessage(playerid, -1, "You have successfully changed your skin.");
  520. SetPlayerSkin(playerid,skin);
  521. }
  522. else return SendClientMessage(playerid, 0xFF0000AA, "You are not VIP member.");
  523. return 1;
  524.  
  525. }
  526. CMD:weather(playerid,params[])
  527. {
  528. if(dini_Int(pFile(playerid),"VIP") >= 1)
  529. {
  530. new id;
  531. if(sscanf(params,"d",id)) return
  532. SendClientMessage(playerid, 0xFFFFFFAA, "Usage: /weather [WeatherID]");
  533. SetPlayerWeather(playerid, id);
  534. PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
  535. SendClientMessage(playerid,-1,"Weather Successfully changed");
  536.  
  537. }
  538. else return SendClientMessage(playerid, 0xFF0000AA, "You are not VIP member.");
  539. return 1;
  540. }
  541. CMD:veh(playerid, params[])
  542. {
  543. if(dini_Int(pFile(playerid),"VIP") >= 1)
  544. {
  545. if(dini_Int(pFile(playerid),"Activated")==1)
  546. {
  547. new veh[64], col1, col2, id, done;
  548. if(sscanf(params, "s", veh))
  549. {
  550. SendClientMessage(playerid, -1, "Usage: /veh [ModelID/Name]");
  551. return 1;
  552. }
  553. new string[128];
  554. if(!IsNumeric(veh))
  555. id = GetVehicleModelIDFromName(veh);
  556. else id = strval(veh);
  557. if(id < 400 || id > 611) return SendClientMessage(playerid, red, "ERROR: Invalid Vehicle Model ID!");
  558. if(id == 425||id==520||id==432||id==447) return SendClientMessage(playerid, 0xFF0000AA, "These vehicles are restricted for spawn");
  559. col1 = random(126);
  560. col2 = random(126);
  561. new Float:X,Float:Y,Float:Z;
  562. new Float:Angle,int1;
  563. GetPlayerPos(playerid, X,Y,Z);
  564. GetPlayerFacingAngle(playerid,Angle);
  565. for(new i=0; i<MAX_VIP_VEHS; i++)
  566. {
  567. if(!VipVeh[i])
  568. {
  569. VipVeh[i] = CreateVehicle(id, X+3,Y,Z, Angle, col1, col2, -1);
  570. LinkVehicleToInterior(VipVeh[i],int1);
  571. format(string, sizeof(string), "You have Spawned a %s (Model: %d) with Colours: %d,%d dont forget to destroy this vehicle with /dvc", VehicleNames[id-400], id, col1, col2);
  572. PutPlayerInVehicle(playerid, VipVeh[i], 0);
  573. done = 1;
  574. i = MAX_VIP_VEHS;
  575. }
  576. }
  577. if(!done) format(string, sizeof(string), "There are no vehicle slots left.");
  578. return SendClientMessage(playerid,COLOR_SYSTEM, string);
  579. }
  580. else
  581. {
  582. SendClientMessage(playerid,COLOR_RED,"Error: You'r VIP is package not activated please use /account to activate your subscription");
  583. }
  584. }
  585. else
  586. {
  587. SendClientMessage(playerid, COLOR_RED, "You are not VIP member");
  588. }
  589. return 1;
  590. }
  591. CMD:dvc(playerid,params[])
  592. {
  593. new vehicleid = GetPlayerVehicleID(playerid), done;
  594. if(dini_Int(pFile(playerid),"VIP") >= 1)
  595. {
  596. if(IsPlayerInAnyVehicle(playerid))
  597. {
  598. for(new i; i<MAX_VIP_VEHS; i++)
  599. {
  600. if(vehicleid == VipVeh[i])
  601. {
  602. DestroyVehicle(VipVeh[i]);
  603. VipVeh[i] = 0;
  604. i = MAX_VIP_VEHS;
  605. SendClientMessage(playerid,-1,"You've successfully Destroyed This car");
  606. done = 1;
  607. }
  608. }
  609. if(!done) SendClientMessage(playerid,-1,"You can't destroy this car.");
  610. }
  611. else
  612. {
  613. SendClientMessage(playerid,red,"Error: You must sit in the Car before using this command!");
  614. }
  615. }
  616. else
  617. {
  618. SendClientMessage(playerid, COLOR_RED, "You are not VIP member");
  619. }
  620. return 1;
  621. }
  622. CMD:nos(playerid,params[])
  623. {
  624. if(dini_Int(pFile(playerid),"VIP") >= 1)
  625. {
  626. if(GetPlayerState(playerid)==PLAYER_STATE_DRIVER)
  627. {
  628. switch(GetVehicleModel(GetPlayerVehicleID(playerid)))
  629. {
  630. case 448,461,462,463,468,471,509,510,521,522,523,581,586,449:
  631. return SendClientMessage(playerid,-1,"ERROR: You can not tune this vehicle!");
  632. }
  633. AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
  634. PlayerPlaySound(playerid,1133,0.0,0.0,0.0);
  635. }else return SendClientMessage(playerid,-1,"ERROR: You must be in a vehicle.");
  636. }
  637. else return SendClientMessage(playerid, 0xFF0000AA, "You are not VIP member.");
  638. return 1;
  639. }
  640. forward SendVIPMessage(color, string[]);
  641. public SendVIPMessage(color, string[])
  642. {
  643. for(new i = 0; i < MAX_PLAYERS; i++)
  644. {
  645. if(IsPlayerConnected(i))
  646. {
  647. if(dini_Int(pFile(i),"VIP") >= 1)
  648. {
  649. SendClientMessage(i, color, string);
  650. }
  651. }
  652. }
  653. }
  654. CMD:vc(playerid, params[])
  655. {
  656. if(dini_Int(pFile(playerid),"VIP") >= 1)
  657. {
  658. new Nam[MAX_PLAYERS],message[128],str[256];
  659. if(sscanf(params,"s",message)) return SendClientMessage(playerid,COLOR_GREY,"USAGE: /vc(vip Chat) [Text]");
  660. GetPlayerName(playerid,Nam,sizeof(Nam));
  661. format(str,sizeof(str),"{9900CC}VIP Chat %s: {FFFFFF}%s",Nam,message);
  662. if (dini_Int(pFile(playerid),"VIP") == 1)
  663. {
  664. SendVIPMessage(COLOR_PURPLE, str);
  665. return 1;
  666. }
  667. }
  668. else return SendClientMessage(playerid, 0xFF0000AA, "You are not VIP member.");
  669. return 1;
  670. }
  671. CMD:vpm(playerid, params[])
  672. {
  673. if(dini_Int(pFile(playerid),"VIP") >= 1)
  674. {
  675. new str[256], str2[256], id, Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
  676. if(sscanf(params, "us", id, str2))
  677. {
  678. SendClientMessage(playerid, 0xFF0000FF, "Usage: /vpm <id> <message>");
  679. return 1;
  680. }
  681. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: Player not connected");
  682. if(playerid == id) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You cannot pm yourself!");
  683. GetPlayerName(playerid, Name1, sizeof(Name1));
  684. GetPlayerName(id, Name2, sizeof(Name2));
  685. format(str, sizeof(str), "[V-I-P] PM To %s(ID %d): %s", Name2, id, str2);
  686. SendClientMessage(playerid, 0xFF0000FF, str);
  687. format(str, sizeof(str), "[V-I-P] PM From %s(ID %d): %s", Name1, playerid, str2);
  688. SendClientMessage(id, COLOR_YELLOW, str);
  689. }
  690. else return SendClientMessage(playerid, 0xFFFF00AA, "This Command is For VIP Package 1 Donate $3 to get this Command.");
  691. return 1;
  692. }
  693. CMD:vips(playerid,params[])
  694. {
  695. new count = 0;
  696. new string[128],name[50];
  697. new name1[MAX_PLAYER_NAME];
  698. for(new i = 0; i < MAX_PLAYERS; i++)
  699. {
  700. if (IsPlayerConnected(i))
  701. {
  702. GetPlayerName(i,name1,MAX_PLAYER_NAME);
  703. if(dini_Int(pFile(playerid),"VIP") >= 0)
  704. {
  705. if(dini_Int(pFile(i),"VIP") == 1)
  706. {name = "Server VIP";}
  707. format(string, 128, "\"%s\" {%s}", name1,name);
  708. SendClientMessage(playerid, COLOR_WHITE, string);
  709. count++;
  710. }
  711. }
  712. }
  713. if (count == 0)
  714. SendClientMessage(playerid,COLOR_GREY,"There are no VIPS Online at the moment");
  715. return 1;
  716. }
  717. //Timer for check VIP time of a player
  718. forward VIPCLOCK();
  719. public VIPCLOCK()
  720. {
  721. for(new i=0; i<MAX_PLAYERS; i++)
  722. {
  723. if(dini_Int(pFile(i),"VIP") > 0)
  724. {
  725. if(IsPlayerConnected(i))
  726. {
  727. if(gettime() > dini_Int(pFile(i),"VIPTIME"))
  728. {
  729. dini_IntSet(pFile(i),"VIP", 0);
  730. dini_IntSet(pFile(i),"VIPTIME",0);
  731. SendClientMessage(i,0xFF9900AA,"Your VIP Subscribtion has been ended.");
  732. GameTextForPlayer(i, "Thanks for donating!", 3000, 5);
  733. SendClientMessage(i,0xFFFFFFAA,"We're hoping you enjoyed being V.I.P"); }
  734. }
  735. }
  736. }
  737. return 1;
  738. }
  739. CMD:vrepair(playerid,params[])
  740. {
  741. if(dini_Int(pFile(playerid),"VIP") >= 1)
  742. {
  743. if((GetPlayerState(playerid) == PLAYER_STATE_DRIVER))
  744. {
  745. new VehicleID = GetPlayerVehicleID(playerid);
  746. RepairVehicle(VehicleID);
  747. GameTextForPlayer(playerid,"~w~~n~~n~~n~~n~~n~~n~Vehicle ~g~Repaired!",3000,3);
  748. SetVehicleHealth(VehicleID, 1000);
  749. }
  750. else return SendClientMessage(playerid,COLOR_RED,"Error: You are not driver!");
  751.  
  752. }
  753. else return SendClientMessage(playerid, 0xFF0000AA, "You are not VIP member.");
  754. return 1;
  755.  
  756. }
  757. CMD:vflip(playerid,params[])
  758. {
  759. if(dini_Int(pFile(playerid),"VIP") >= 1)
  760. {
  761. if(IsPlayerInAnyVehicle(playerid))
  762. {
  763. new VehicleID, Float:X, Float:Y, Float:Z, Float:Angle;
  764. GetPlayerPos(playerid, X, Y, Z);
  765. VehicleID = GetPlayerVehicleID(playerid);
  766. GetVehicleZAngle(VehicleID, Angle);
  767. SetVehiclePos(VehicleID, X, Y, Z);
  768. SetVehicleZAngle(VehicleID, Angle);
  769. SetVehicleHealth(VehicleID,1000.0);
  770. SendClientMessage(playerid, COLOR_GREEN,"Vehicle Flipped!");
  771. }
  772. else return SendClientMessage(playerid,red,"ERROR: You are not in a Vehicle!");
  773. }
  774. else return 0;
  775. return 1;
  776. }
  777. CMD:removevip(playerid, params[])
  778. {
  779. new levels,pname[MAX_PLAYER_NAME],str[128],ID;
  780. if(IsPlayerAdmin(playerid))//Is player rcon administrator
  781. {
  782. if(sscanf(params,"u",ID)) return SendClientMessage(playerid,0xFF9900AA, "USAGE: /removevip [playerid]");
  783. if(!IsPlayerConnected(ID))return SendClientMessage(playerid,red,"That user is not connected.");
  784. if(dini_Int(pFile(ID),"VIP") == 0) return SendClientMessage(playerid,COLOR_RED,"Error: That player is not a VIP!");
  785. GetPlayerName(ID,pname,MAX_PLAYER_NAME);
  786. format(str, sizeof(str),"An Admin has removed your VIP Package.");
  787. SendClientMessage(ID,COLOR_ORANGE,str);
  788. format(str, sizeof(str),"You have removed %s's VIP Package!",pname,levels);
  789. SendClientMessage(playerid,COLOR_YELLOW,str);
  790. dini_IntSet(pFile(ID),"VIP", 0);
  791. dini_IntSet(pFile(ID),"VIPTIME",0);
  792. }else return 0;
  793. return 1;
  794. }
  795. stock GetVehicleName(vehicleid)//GetVehicleName
  796. {
  797. new String[100];
  798. format(String,sizeof(String),"%s",VehicleNames[GetVehicleModel(vehicleid) - 400]);
  799. return String;
  800. }
  801. stock GetVehicleModelIDFromName(vname[]) // GetVehicleNameById
  802. {
  803. for(new i = 0; i < 211; i++)
  804. {
  805. if ( strfind(VehicleNames[i], vname, true) != -1 )
  806. return i + 400;
  807. }
  808. return -1;
  809. }
  810. stock IsNumeric(const str[])//stock for check numeric values
  811. {
  812. for(new i, len = strlen(str); i < len; i++)
  813. {
  814. if(!('0' <= str[i] <= '9')) return false;
  815. }
  816. return true;
  817. }
  818. stock RPN(playerid)//Getplayername stock
  819. {
  820. new name[MAX_PLAYER_NAME];
  821. GetPlayerName(playerid, name, sizeof(name));
  822. return name;
  823. }
  824. stock pFile(playerid)//UserFile path
  825. {
  826. new file[64];
  827. format(file, sizeof(file), "Accounts/%s.ini",RPN(playerid)); // You can change it to what is your users's path
  828. return file;
  829. }
Advertisement
Add Comment
Please, Sign In to add comment