Guest User

Rated R Vip System V1.1 by Glad2BeHere

a guest
Feb 17th, 2013
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 27.77 KB | None | 0 0
  1. /*
  2. ////////////////////////////////////////////////////////
  3. / Glad 2 Be Here VIP SYSTEM /////
  4. / Dynamic Script //////
  5. / //////
  6. / //////
  7. / KEEP ALL CREDITS!!!!!!!!!!!!!!!!!!! //////
  8. ////////////////////////////////////////////////////////
  9. */
  10. #define FILTERSCRIPT
  11. #if defined FILTERSCRIPT
  12.  
  13. #include <a_samp>
  14. #include <YSI\y_ini>
  15. #include <sscanf2>
  16. #include <streamer>
  17. #include <foreach>
  18. #include <zcmd>
  19. #include <mSelection>
  20.  
  21. #define COLOR_GREEN 0x33AA33FF
  22. #define COLOR_WHITE 0xFFFFFFFF
  23. #define COLOR_RED 0xFF0606FF
  24. #define COLOR_LIGHTBLUE 0x33CCFFFF
  25. #define COLOR_YELLOW 0xFFFF00FF
  26.  
  27. #define DIALOG_REGISTER 1231
  28. #define DIALOG_LOGIN 1232
  29. #define DIALOG_SHOP 1233
  30. #define DIALOG_WEAPONINPUT 1234
  31. #define DIALOG_AMMOINPUT 1235
  32. #define DIALOG_RADIO 1236
  33.  
  34. #define MAX_HQS 5
  35. #define MAX_SHOPS 10
  36. #define MAX_VCARS 100
  37.  
  38. new LoggedIn[MAX_PLAYERS];
  39. new VCSTATUS[MAX_PLAYERS];
  40. new pGun[MAX_PLAYERS];
  41. new pAmmo[MAX_PLAYERS];
  42. new vskins = mS_INVALID_LISTID;
  43. new PlayerText3D:vlabel;
  44.  
  45. enum VInfo
  46. {
  47. Vpass,
  48. VipLevel,
  49. VNickName[32],
  50. VGold
  51. }
  52. new VipAccount[MAX_PLAYERS][VInfo];
  53.  
  54. enum VShopInfo
  55. {
  56. Float:VSPos[3],
  57. VScreated,
  58. Vpickup,
  59. Text3D:VshopText
  60.  
  61. }
  62. new VipShop[MAX_SHOPS][VShopInfo];
  63.  
  64. enum VHqInfo
  65. {
  66. Float:VHQEnPos[3],
  67. Float:VHQExPos[3],
  68. HqInterior,
  69. VHQcreated,
  70. HQpickup[2],
  71. Text3D:VHQText[2]
  72. }
  73. new VHq[MAX_HQS][VHqInfo];
  74.  
  75. enum VCarInfo
  76. {
  77. Model,
  78. Float:CPos[4],
  79. Col[2],
  80. VCreated,
  81. VType,
  82. Car
  83. }
  84. new VCar[MAX_VCARS][VCarInfo];
  85.  
  86. stock VipHQPath(id)
  87. {
  88. new string[128];
  89. format(string,sizeof(string),"GVIP/HQ/%d.ini",id);
  90. return string;
  91. }
  92.  
  93. stock VipStorePath(id)
  94. {
  95. new string[128];
  96. format(string,sizeof(string),"GVIP/STORE/%d.ini",id);
  97. return string;
  98. }
  99.  
  100. stock VipPath(playerid)
  101. {
  102. new string[128],playername[MAX_PLAYER_NAME];
  103. GetPlayerName(playerid,playername,sizeof(playername));
  104. format(string,sizeof(string),"GVIP/VIP/%s.ini",playername);
  105. return string;
  106. }
  107.  
  108. stock VipMessage(color, string[])
  109. {
  110. foreach(Player, i)
  111. {
  112. if(LoggedIn[i] && VipAccount[i][VipLevel] && VCSTATUS[i])
  113. {
  114. SendClientMessage(i, color, string);
  115. }
  116. }
  117. return 1;
  118. }
  119.  
  120. stock GetPlayerGold(playerid)
  121. {
  122. return VipAccount[playerid][VGold];
  123. }
  124.  
  125. stock Name(playerid)
  126. {
  127. new vipname[MAX_PLAYER_NAME];
  128. GetPlayerName(playerid, vipname, sizeof(vipname));
  129. return vipname;
  130. }
  131.  
  132. stock VipName(Level)
  133. {
  134. new name[32];
  135. if(Level == 0) format(name, sizeof(name), "None");
  136. else if(Level == 1) format(name, sizeof(name), "Bronze");
  137. else if(Level == 2) format(name, sizeof(name), "Silver");
  138. else if(Level == 3) format(name, sizeof(name), "Gold");
  139. else if(Level == 4) format(name, sizeof(name), "Platinum");
  140. return name;
  141. }
  142.  
  143. stock udb_hash(buf[])
  144. {
  145. new length=strlen(buf);
  146. new s1 = 1;
  147. new s2 = 0;
  148. new n;
  149. for (n=0; n<length; n++)
  150. {
  151. s1 = (s1 + buf[n]) % 65521;
  152. s2 = (s2 + s1) % 65521;
  153. }
  154. return (s2 << 16) + s1;
  155. }
  156.  
  157. forward LoadCar_data(cid, name[],value[]);
  158. public LoadCar_data(cid, name[],value[])
  159. {
  160. INI_Int("Model", VCar[cid][Model]);
  161. INI_Float("X", VCar[cid][CPos][0]);
  162. INI_Float("Y", VCar[cid][CPos][1]);
  163. INI_Float("Z", VCar[cid][CPos][2]);
  164. INI_Float("A", VCar[cid][CPos][3]);
  165. INI_Int("C1", VCar[cid][Col][0]);
  166. INI_Int("C2", VCar[cid][Col][1]);
  167. INI_Int("Created", VCar[cid][VCreated]);
  168. INI_Int("Type", VCar[cid][VType]);
  169. return 1;
  170. }
  171.  
  172. forward LoadVCars();
  173. public LoadVCars()
  174. {
  175. for(new c=0; c < MAX_VCARS; c++)
  176. {
  177. if(fexist(VipCarPath(c)))
  178. {
  179. INI_ParseFile(VipCarPath(c), "LoadCar_%s", .bExtra = true, .extra = c);
  180. if(VCar[c][VCreated])
  181. {
  182. VCar[c][Car] = CreateVehicle(VCar[c][Model], VCar[c][CPos][0], VCar[c][CPos][1], VCar[c][CPos][2], VCar[c][CPos][3], VCar[c][Col][0], VCar[c][Col][1], -1);
  183. }
  184. }
  185. else
  186. {
  187. new INI:File = INI_Open(VipCarPath(c));
  188. INI_WriteInt(File, "Model", 0);
  189. INI_WriteFloat(File, "X", 0);
  190. INI_WriteFloat(File, "Y", 0);
  191. INI_WriteFloat(File, "Z", 0);
  192. INI_WriteFloat(File, "A", 0);
  193. INI_WriteInt(File, "C1", 0);
  194. INI_WriteInt(File, "C2", 0);
  195. INI_WriteInt(File, "Created", 0);
  196. INI_WriteInt(File, "Type", 0);
  197. INI_Close(File);
  198. }
  199. }
  200. print("Car's Loaded");
  201. return 1;
  202. }
  203.  
  204. forward SaveVCars();
  205. public SaveVCars()
  206. {
  207. for(new cid=0; cid < MAX_VCARS; cid++)
  208. {
  209. new INI:File = INI_Open(VipCarPath(cid));
  210. INI_WriteInt(File, "Model", VCar[cid][Model]);
  211. INI_WriteFloat(File, "X", VCar[cid][CPos][0]);
  212. INI_WriteFloat(File, "Y", VCar[cid][CPos][1]);
  213. INI_WriteFloat(File, "Z", VCar[cid][CPos][2]);
  214. INI_WriteFloat(File, "A", VCar[cid][CPos][3]);
  215. INI_WriteInt(File, "C1", VCar[cid][Col][0]);
  216. INI_WriteInt(File, "C2", VCar[cid][Col][1]);
  217. INI_WriteInt(File, "Created", VCar[cid][VCreated]);
  218. INI_WriteInt(File, "Type", VCar[cid][VType]);
  219. INI_Close(File);
  220. }
  221. print("Car's Saved");
  222. return 1;
  223. }
  224.  
  225. stock VipCarPath(id)
  226. {
  227. new string[128];
  228. format(string,sizeof(string),"GVIP/CARS/%d.ini",id);
  229. return string;
  230. }
  231.  
  232. forward LoadVIP_data(playerid,name[],value[]);
  233. public LoadVIP_data(playerid,name[],value[])
  234. {
  235. INI_Int("Level",VipAccount[playerid][VipLevel]);
  236. INI_String("NickName",VipAccount[playerid][VNickName], 32);
  237. INI_Int("Gold",VipAccount[playerid][VGold]);
  238. return 1;
  239. }
  240.  
  241. forward LoadVIPPass_data(playerid,name[],value[]);
  242. public LoadVIPPass_data(playerid,name[],value[])
  243. {
  244. INI_Int("Password",VipAccount[playerid][Vpass]);
  245. return 1;
  246. }
  247.  
  248. forward LoadVIPSTORE_data(vsid,name[],value[]);
  249. public LoadVIPSTORE_data(vsid,name[],value[])
  250. {
  251. INI_Float("X",VipShop[vsid][VSPos][0]);
  252. INI_Float("Y",VipShop[vsid][VSPos][1]);
  253. INI_Float("Z",VipShop[vsid][VSPos][2]);
  254. INI_Int("Created",VipShop[vsid][VScreated]);
  255. return 1;
  256. }
  257.  
  258. forward LoadVShops();
  259. public LoadVShops()
  260. {
  261. for(new vs=0; vs < MAX_SHOPS; vs++)
  262. {
  263. if(fexist(VipStorePath(vs)))
  264. {
  265. INI_ParseFile(VipStorePath(vs), "LoadVIPSTORE_%s", .bExtra = true, .extra = vs);
  266. if(VipShop[vs][VScreated])
  267. {
  268. VipShop[vs][Vpickup] = CreateDynamicPickup(1239, 1, VipShop[vs][VSPos][0],VipShop[vs][VSPos][1], VipShop[vs][VSPos][2], -1);
  269. VipShop[vs][VshopText] = CreateDynamic3DTextLabel("Vip Store",COLOR_LIGHTBLUE,VipShop[vs][VSPos][0],VipShop[vs][VSPos][1], VipShop[vs][VSPos][2]+0.3, 10);
  270. }
  271. }
  272. else
  273. {
  274. new INI:File = INI_Open(VipStorePath(vs));
  275. INI_WriteFloat(File, "X",0);
  276. INI_WriteFloat(File, "Y",0);
  277. INI_WriteFloat(File, "Z",0);
  278. INI_WriteInt(File, "Created",0);
  279. INI_Close(File);
  280. }
  281. }
  282. print("Stores's Loaded");
  283. return 1;
  284. }
  285.  
  286. forward SaveVShops();
  287. public SaveVShops()
  288. {
  289. for(new vs=0;vs < MAX_SHOPS; vs++)
  290. {
  291. new INI:File = INI_Open(VipStorePath(vs));
  292. INI_WriteFloat(File, "X",VipShop[vs][VSPos][0]);
  293. INI_WriteFloat(File, "Y",VipShop[vs][VSPos][1]);
  294. INI_WriteFloat(File, "Z",VipShop[vs][VSPos][2]);
  295. INI_WriteInt(File, "Created",VipShop[vs][VScreated]);
  296. INI_Close(File);
  297. }
  298. print("Stores's Saved");
  299. return 1;
  300. }
  301.  
  302. forward LoadVIPHQS_data(hqid,name[],value[]);
  303. public LoadVIPHQS_data(hqid,name[],value[])
  304. {
  305. INI_Float("EN_X", VHq[hqid][VHQEnPos][0]);
  306. INI_Float("EN_Y", VHq[hqid][VHQEnPos][1]);
  307. INI_Float("EN_Z", VHq[hqid][VHQEnPos][2]);
  308. INI_Float("Ex_X", VHq[hqid][VHQExPos][0]);
  309. INI_Float("Ex_Y", VHq[hqid][VHQExPos][1]);
  310. INI_Float("Ex_Z", VHq[hqid][VHQExPos][2]);
  311. INI_Int("Interior", VHq[hqid][HqInterior]);
  312. INI_Int("Created", VHq[hqid][VHQcreated]);
  313. return 1;
  314. }
  315.  
  316. forward LoadVipHq();
  317. public LoadVipHq()
  318. {
  319. for(new hq=0; hq < MAX_HQS; hq++)
  320. {
  321. if(fexist(VipHQPath(hq)))
  322. {
  323. INI_ParseFile(VipStorePath(hq), "LoadVIPHQS_%s", .bExtra = true, .extra = hq);
  324. if(VHq[hq][VHQcreated])
  325. {
  326. VHq[hq][HQpickup][0] = CreateDynamicPickup(1239, 1, VHq[hq][VHQEnPos][0],VHq[hq][VHQEnPos][1],VHq[hq][VHQEnPos][2],-1);
  327. VHq[hq][VHQText][0] = CreateDynamic3DTextLabel("Vip Hq Entrance",COLOR_LIGHTBLUE,VHq[hq][VHQEnPos][0],VHq[hq][VHQEnPos][1],VHq[hq][VHQEnPos][2]+0.3, 10);
  328. VHq[hq][HQpickup][1] = CreateDynamicPickup(1239, 1, VHq[hq][VHQExPos][0],VHq[hq][VHQExPos][1],VHq[hq][VHQExPos][2],-1, VHq[hq][HqInterior]);
  329. VHq[hq][VHQText][1] = CreateDynamic3DTextLabel("Vip Hq Exit",COLOR_LIGHTBLUE,VHq[hq][VHQExPos][0],VHq[hq][VHQExPos][1],VHq[hq][VHQExPos][2]+0.3, 10);
  330. }
  331. }
  332. else
  333. {
  334. new INI:File = INI_Open(VipHQPath(hq));
  335. INI_WriteFloat(File, "EN_X", 0);
  336. INI_WriteFloat(File, "EN_Y", 0);
  337. INI_WriteFloat(File, "EN_Z", 0);
  338. INI_WriteFloat(File, "Ex_X", 0);
  339. INI_WriteFloat(File, "Ex_Y", 0);
  340. INI_WriteFloat(File, "Ex_Z", 0);
  341. INI_WriteInt(File, "Interior", 0);
  342. INI_WriteInt(File, "Created", 0);
  343. INI_Close(File);
  344. }
  345. }
  346. print("HQ's Loaded");
  347. return 1;
  348. }
  349.  
  350. forward SaveVipHq();
  351. public SaveVipHq()
  352. {
  353. for(new hq=0; hq < MAX_HQS; hq++)
  354. {
  355. new INI:File = INI_Open(VipHQPath(hq));
  356. INI_WriteFloat(File, "EN_X", VHq[hq][VHQEnPos][0]);
  357. INI_WriteFloat(File, "EN_Y", VHq[hq][VHQEnPos][1]);
  358. INI_WriteFloat(File, "EN_Z", VHq[hq][VHQEnPos][2]);
  359. INI_WriteFloat(File, "Ex_X", VHq[hq][VHQExPos][0]);
  360. INI_WriteFloat(File, "Ex_Y", VHq[hq][VHQExPos][1]);
  361. INI_WriteFloat(File, "Ex_Z", VHq[hq][VHQExPos][2]);
  362. INI_WriteInt(File, "Interior", VHq[hq][HqInterior]);
  363. INI_WriteInt(File, "Created", VHq[hq][VHQcreated]);
  364. INI_Close(File);
  365. }
  366. print("HQ's saved");
  367. return 1;
  368. }
  369.  
  370. CMD:gvah(playerid, params[])
  371. {
  372. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREEN, "RCON ADMINS ONLY");
  373. SendClientMessage(playerid, COLOR_GREEN, "/makevip, /givegold, /createvipshop, /vhqedit");
  374. SendClientMessage(playerid, COLOR_GREEN, "/createvcar, /destroyvcar");
  375. return 1;
  376. }
  377.  
  378. CMD:makevip(playerid, params[])
  379. {
  380. new string[256], playerb, level;
  381. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREEN, "RCON ADMINS ONLY");
  382. if(sscanf(params, "ui", playerb, level)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /makevip [playerid] [level]");
  383. if(!IsPlayerConnected(playerb)) return SendClientMessage(playerid, COLOR_RED, "That Player is Not Connect");
  384. foreach(Player, i)
  385. {
  386. if(IsPlayerAdmin(i))
  387. {
  388. format(string, 256, "%s Has Made %s Vip Level: %s (%d)", Name(playerid), Name(playerb), VipName(level), level);
  389. SendClientMessage(i, COLOR_RED, string);
  390. }
  391. }
  392. VipAccount[playerb][VipLevel] = level;
  393. return 1;
  394. }
  395.  
  396. CMD:givegold(playerid, params[])
  397. {
  398. new string[256], playerb, gold;
  399. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREEN, "RCON ADMINS ONLY");
  400. if(sscanf(params, "ui", playerb, gold)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givegold [playerid] [amount]");
  401. if(!IsPlayerConnected(playerb)) return SendClientMessage(playerid, COLOR_RED, "That Player is Not Connect");
  402. foreach(Player, i)
  403. {
  404. if(IsPlayerAdmin(i))
  405. {
  406. format(string, 256, "%s Has Made %s $%d Gold", Name(playerid), Name(playerb), gold);
  407. SendClientMessage(i, COLOR_RED, string);
  408. }
  409. }
  410. VipAccount[playerb][VGold] = gold;
  411. SendClientMessage(playerb, COLOR_GREEN, "The Gold is Not Tradable");
  412. return 1;
  413. }
  414.  
  415. CMD:createvipshop(playerid, params[])
  416. {
  417. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREEN, "RCON ADMINS ONLY");
  418. for(new vs=0; vs < MAX_SHOPS; vs++)
  419. {
  420. if(!VipShop[vs][VScreated])
  421. {
  422. new Float:X, Float:Y, Float:Z;
  423. GetPlayerPos(playerid, X, Y, Z);
  424. VipShop[vs][VSPos][0] = X;
  425. VipShop[vs][VSPos][1] = Y;
  426. VipShop[vs][VSPos][2] = Z;
  427. VipShop[vs][VScreated] = 1;
  428. VipShop[vs][Vpickup] = CreateDynamicPickup(1239, 1, VipShop[vs][VSPos][0],VipShop[vs][VSPos][1], VipShop[vs][VSPos][2], -1);
  429. VipShop[vs][VshopText] = CreateDynamic3DTextLabel("Vip Store",COLOR_LIGHTBLUE,VipShop[vs][VSPos][0],VipShop[vs][VSPos][1], VipShop[vs][VSPos][2]+0.3, 10);
  430. }
  431. }
  432. return 1;
  433. }
  434.  
  435. CMD:vhqedit(playerid, params[])
  436. {
  437. new Float: X, Float: Y, Float: Z, id;
  438. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREEN, "RCON ADMINS ONLY");
  439. if(sscanf(params, "s[32]", params))
  440. {
  441. SendClientMessage(playerid, COLOR_RED, "USAGE: /vhqedit [option] [id]");
  442. SendClientMessage(playerid, COLOR_LIGHTBLUE, "OPTIONS: entrance | exit");
  443. return 1;
  444. }
  445. if(!strcmp(params, "entrance", true, 8))
  446. {
  447. if(sscanf(params, "s[32]i", params, id)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /vhqedit entrance [id]");
  448. GetPlayerPos(playerid, X, Y, Z);
  449. if(!VHq[id][VHQcreated]) return VHq[id][VHQcreated] = 1;
  450. VHq[id][VHQEnPos][0] = X;
  451. VHq[id][VHQEnPos][1] = Y;
  452. VHq[id][VHQEnPos][2] = Z;
  453. if(VHq[id][HQpickup][0]) DestroyDynamicPickup(VHq[id][HQpickup][0]);
  454. if(VHq[id][VHQText][0]) DestroyDynamic3DTextLabel(VHq[id][VHQText][0]);
  455. VHq[id][HQpickup][0] = CreateDynamicPickup(1239, 1, VHq[id][VHQEnPos][0],VHq[id][VHQEnPos][1],VHq[id][VHQEnPos][2],-1);
  456. VHq[id][VHQText][0] = CreateDynamic3DTextLabel("Vip Hq Entrance",COLOR_LIGHTBLUE,VHq[id][VHQEnPos][0],VHq[id][VHQEnPos][1],VHq[id][VHQEnPos][2]+0.3, 10);
  457. SendClientMessage(playerid, COLOR_RED, "Entrance Is Now at Your Location");
  458. }
  459. else if(!strcmp(params, "exit", true, 4))
  460. {
  461. if(sscanf(params, "s[32]i", params, id)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /vhqedit exit [id]");
  462. GetPlayerPos(playerid, X, Y, Z);
  463. if(!VHq[id][VHQcreated]) VHq[id][VHQcreated] = 1;
  464. VHq[id][VHQExPos][0] = X;
  465. VHq[id][VHQExPos][1] = Y;
  466. VHq[id][VHQExPos][2] = Z;
  467. new i = GetPlayerInterior(playerid);
  468. VHq[id][HqInterior] = i;
  469. if(VHq[id][HQpickup][1]) DestroyDynamicPickup(VHq[id][HQpickup][1]);
  470. if(VHq[id][VHQText][1]) DestroyDynamic3DTextLabel(VHq[id][VHQText][1]);
  471. VHq[id][HQpickup][1] = CreateDynamicPickup(1239, 1, VHq[id][VHQExPos][0],VHq[id][VHQExPos][1],VHq[id][VHQExPos][2],-1, VHq[id][HqInterior]);
  472. VHq[id][VHQText][1] = CreateDynamic3DTextLabel("Vip Hq Exit",COLOR_LIGHTBLUE,VHq[id][VHQExPos][0],VHq[id][VHQExPos][1],VHq[id][VHQExPos][2]+0.3, 10);
  473. SendClientMessage(playerid, COLOR_RED, "Exit Is Now at Your Location");
  474. }
  475. return 1;
  476. }
  477.  
  478. CMD:createvcar(playerid, params[])
  479. {
  480. new id, col[2], type;
  481. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREEN, "RCON ADMINS ONLY");
  482. if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "GTFO ON THE CAR N GET ON YOUR FEET -__-");
  483. if(sscanf(params, "iiii", id, col[0], col[1], type)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /createvcar [model] [color1] [color2] [level]");
  484. if(id < 400 || id > 611) return SendClientMessage(playerid, COLOR_RED, "Vehicles are between 400 and 611.");
  485. for(new cid=0; cid < MAX_VCARS; cid++)
  486. {
  487. if(!VCar[cid][VCreated])
  488. {
  489. new Float: X, Float: Y, Float: Z, Float: A;
  490. GetPlayerPos(playerid, X, Y, Z);
  491. GetPlayerFacingAngle(playerid, A);
  492. VCar[cid][Model] = id;
  493. VCar[cid][CPos][0] = X;
  494. VCar[cid][CPos][1] = Y;
  495. VCar[cid][CPos][2] = Z;
  496. VCar[cid][CPos][3] = A;
  497. VCar[cid][Col][0] = col[0];
  498. VCar[cid][Col][1] = col[1];
  499. VCar[cid][VType] = type;
  500. VCar[cid][VCreated] = 1;
  501. VCar[cid][Car] = CreateVehicle(VCar[cid][Model], VCar[cid][CPos][0], VCar[cid][CPos][1], VCar[cid][CPos][2], VCar[cid][CPos][3], VCar[cid][Col][0], VCar[cid][Col][1], -1);
  502. cid = MAX_VCARS;
  503. }
  504. }
  505. return 1;
  506. }
  507.  
  508. CMD:destroyvcar(playerid, params[])
  509. {
  510. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREEN, "RCON ADMINS ONLY");
  511. if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "Get into the vehicle of choice");
  512. for(new cid=0; cid < MAX_VCARS; cid++)
  513. {
  514. if(VCar[cid][VCreated])
  515. {
  516. if(GetPlayerVehicleID(playerid) == VCar[cid][Car])
  517. {
  518. VCar[cid][Model] = 0;
  519. VCar[cid][CPos][0] = 0;
  520. VCar[cid][CPos][1] = 0;
  521. VCar[cid][CPos][2] = 0;
  522. VCar[cid][CPos][3] = 0;
  523. VCar[cid][Col][0] = 0;
  524. VCar[cid][Col][1] = 0;
  525. VCar[cid][VType] = 0;
  526. VCar[cid][VCreated] = 0;
  527. DestroyVehicle(VCar[cid][Car]);
  528. cid = MAX_VCARS;
  529. }
  530. }
  531. }
  532. return 1;
  533. }
  534.  
  535. CMD:gvshelp(playerid, params[])
  536. {
  537. if(!VipAccount[playerid][VipLevel] && !LoggedIn[playerid]) return SendClientMessage(playerid, COLOR_RED, "You Vip Is Not Activated");
  538. {
  539. SendClientMessage(playerid, COLOR_LIGHTBLUE, "/vaccount, /v, /tvchat, /vshop, /vradio,/vsradio, /vnick, /hq");
  540. }
  541. return 1;
  542. }
  543. CMD:vaccount(playerid, params[])
  544. {
  545. if(LoggedIn[playerid]) return SendClientMessage(playerid, COLOR_GREEN, "You Are already Logged On");
  546. if(fexist(VipPath(playerid)))
  547. {
  548. INI_ParseFile(VipPath(playerid), "LoadVIPPass_%s", .bExtra = true, .extra = playerid);
  549. TogglePlayerControllable(playerid, 0 );
  550. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Load Up Your Vip Account","Type your password below to login.","Login","Quit");
  551. }
  552. else
  553. {
  554. ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"Create Vip Account","Enter a Vip password for You Vip Account","Register","Quit");
  555. TogglePlayerControllable(playerid, 0 );
  556. }
  557. return 1;
  558. }
  559.  
  560. CMD:v(playerid, params[])
  561. {
  562. new string[128];
  563. if(!VipAccount[playerid][VipLevel] && !LoggedIn[playerid]) return SendClientMessage(playerid, COLOR_GREEN, "You Are Not A Vip");
  564. if(!VCSTATUS[playerid]) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "You Chat Is Off");
  565. if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /v [text]");
  566. format(string, 128, "VIP:[%s] says:%s ",VipAccount[playerid][VNickName],params);
  567. VipMessage(COLOR_YELLOW, string);
  568. return 1;
  569. }
  570.  
  571. CMD:tvchat(playerid, params[])
  572. {
  573. if(!VipAccount[playerid][VipLevel] && !LoggedIn[playerid]) return SendClientMessage(playerid, COLOR_GREEN, "You Are Not A Vip");
  574. if(VCSTATUS[playerid])
  575. {
  576. VCSTATUS[playerid] = 0;
  577. SendClientMessage(playerid, COLOR_GREEN, "You Turn OFF The Vip Chat");
  578. }
  579. else if(!VCSTATUS[playerid])
  580. {
  581. VCSTATUS[playerid] = 1;
  582. SendClientMessage(playerid, COLOR_GREEN, "You Turn ON The Vip Chat");
  583. }
  584. return 1;
  585. }
  586.  
  587. CMD:vshop(playerid, params[])
  588. {
  589. if(!VipAccount[playerid][VipLevel] && !LoggedIn[playerid]) return SendClientMessage(playerid, COLOR_GREEN, "You Are Not A Vip");
  590. for(new vs=0; vs < MAX_SHOPS; vs++)
  591. {
  592. if(IsPlayerInRangeOfPoint(playerid, 5, VipShop[vs][VSPos][0], VipShop[vs][VSPos][1], VipShop[vs][VSPos][2]))
  593. {
  594. ShowPlayerDialog(playerid, DIALOG_SHOP, DIALOG_STYLE_LIST, "{0099FF}VIP SHOP", "{3333CC}Guns\n{6699FF}Skins", "Shop", "Leave");
  595. }
  596. }
  597. return 1;
  598. }
  599.  
  600. CMD:vradio(playerid, params[])
  601. {
  602. if(!VipAccount[playerid][VipLevel] && !LoggedIn[playerid]) return SendClientMessage(playerid, COLOR_GREEN, "You Need To Be A Vip");
  603. if(GetPlayerGold(playerid) < 1) return SendClientMessage(playerid, COLOR_YELLOW, "$1 Gold Per Use");
  604. ShowPlayerDialog(playerid, DIALOG_RADIO, DIALOG_STYLE_INPUT, "Enter Music", "Use .MP3 Format or working links", "Listen", "Cancel");
  605. return 1;
  606. }
  607.  
  608. CMD:vsradio(playerid, params[])
  609. {
  610. StopAudioStreamForPlayer(playerid);
  611. return 1;
  612. }
  613.  
  614. CMD:vnick(playerid, params[])
  615. {
  616. if(!VipAccount[playerid][VipLevel] && !LoggedIn[playerid]) return SendClientMessage(playerid, COLOR_GREEN, "You Need To Be A Vip");
  617. if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /vnick [name]");
  618. format(VipAccount[playerid][VNickName], 32 , "%s", params);
  619. SendClientMessage(playerid, COLOR_WHITE, VipAccount[playerid][VNickName]);
  620. return 1;
  621. }
  622.  
  623. CMD:hq(playerid, params[])
  624. {
  625. for(new hq=0; hq < MAX_HQS; hq++)
  626. {
  627. if(IsPlayerInRangeOfPoint(playerid, 5, VHq[hq][VHQEnPos][0], VHq[hq][VHQEnPos][1], VHq[hq][VHQEnPos][2]))
  628. {
  629. SetPlayerPos(playerid, VHq[hq][VHQExPos][0], VHq[hq][VHQExPos][1], VHq[hq][VHQExPos][2]);
  630. SetPlayerInterior(playerid, VHq[hq][HqInterior]);
  631. SetPlayerVirtualWorld(playerid, 250+hq);
  632. }
  633. if(IsPlayerInRangeOfPoint(playerid, 5, VHq[hq][VHQExPos][0], VHq[hq][VHQExPos][1], VHq[hq][VHQExPos][2]))
  634. {
  635. SetPlayerPos(playerid, VHq[hq][VHQEnPos][0], VHq[hq][VHQEnPos][1], VHq[hq][VHQEnPos][2]);
  636. SetPlayerInterior(playerid, 0);
  637. SetPlayerVirtualWorld(playerid, 0);
  638. }
  639. }
  640. return 1;
  641. }
  642.  
  643. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  644. {
  645. new string[256];
  646. switch( dialogid )
  647. {
  648. case DIALOG_REGISTER:
  649. {
  650. if (!response) return TogglePlayerControllable(playerid, 1 );
  651. if(response)
  652. {
  653. if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Registering...","You have entered an invalid password.\nType your password below to register a new account.","Register","Quit");
  654. new INI:File = INI_Open(VipPath(playerid));
  655. INI_SetTag(File,"data");
  656. INI_WriteInt(File,"Password",udb_hash(inputtext));
  657. INI_WriteInt(File, "Level",0);
  658. INI_WriteString(File, "NickName","");
  659. INI_WriteInt(File, "Gold",0);
  660. INI_Close(File);
  661. TogglePlayerControllable(playerid, 1 );
  662. LoggedIn[playerid] = 1;
  663. SendClientMessage(playerid, COLOR_RED, "You Are Now Registered");
  664. if(IsPlayerAdmin(playerid))
  665. {
  666. SendClientMessage(playerid, COLOR_LIGHTBLUE, "gvah");
  667. }
  668. if(VipAccount[playerid][VipLevel])
  669. {
  670. SendClientMessage(playerid, COLOR_LIGHTBLUE, "gvshelp");
  671. }
  672. }
  673. }
  674. case DIALOG_LOGIN:
  675. {
  676. if ( !response ) return TogglePlayerControllable(playerid, 1 );
  677. if( response )
  678. {
  679. if(udb_hash(inputtext) == VipAccount[playerid][Vpass])
  680. {
  681. INI_ParseFile(VipPath(playerid), "LoadVIP_%s", .bExtra = true, .extra = playerid);
  682. LoggedIn[playerid] = 1;
  683. SendClientMessage(playerid, COLOR_RED, "You Are Now Log In");
  684. TogglePlayerControllable(playerid, 1 );
  685. if(IsPlayerAdmin(playerid))
  686. {
  687. SendClientMessage(playerid, COLOR_GREEN, "CMD:[ADMIN]gvah");
  688. }
  689. if(VipAccount[playerid][VipLevel])
  690. {
  691. SendClientMessage(playerid, COLOR_RED, "CMD:[PLAYER]gvshelp");
  692. }
  693. format(string, 256, "Gold Balance: %d",VipAccount[playerid][VGold]);
  694. SendClientMessage(playerid, COLOR_WHITE, string);
  695. }
  696. else
  697. {
  698. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","You have entered an incorrect password.\nType your password below to login.","Login","Quit");
  699. }
  700. return 1;
  701. }
  702. }
  703. case DIALOG_SHOP:
  704. {
  705. if(response)
  706. {
  707. if(listitem == 0)
  708. {
  709. if(GetPlayerGold(playerid) < 5) return SendClientMessage(playerid, COLOR_RED, "Woomp Woomp Woomp You Can even afford Brass Knuckles");
  710. ShowPlayerDialog(playerid, DIALOG_WEAPONINPUT, DIALOG_STYLE_INPUT, "Weapons", "{9900FF}Choose You Weapon", "LoadUp", "Close");
  711. }
  712. if(listitem == 1)
  713. {
  714. ShowModelSelectionMenu(playerid, vskins, "Choose a Skin");
  715. }
  716. }
  717. return 1;
  718. }
  719. case DIALOG_WEAPONINPUT:
  720. {
  721. if(response)
  722. {
  723. pGun[playerid] = strval(inputtext);
  724. ShowPlayerDialog(playerid,DIALOG_AMMOINPUT, DIALOG_STYLE_INPUT, "Weapons", "How Much Ammo", "Rounds", "Cancel");
  725.  
  726. }
  727. return 1;
  728. }
  729. case DIALOG_AMMOINPUT:
  730. {
  731. if(response)
  732. {
  733. pAmmo[playerid] = strval(inputtext);
  734. new g = 5*pGun[playerid]*10*pAmmo[playerid];
  735. if(GetPlayerGold(playerid) < g) return SendClientMessage(playerid, COLOR_GREEN, "You cannot afford the ammount");
  736. VipAccount[playerid][VGold] -= g;
  737. format(string, 256, "Gold Balance: %d",VipAccount[playerid][VGold]);
  738. SendClientMessage(playerid, COLOR_WHITE, string);
  739. GivePlayerWeapon(playerid,pGun[playerid] ,pAmmo[playerid]);
  740. pGun[playerid] = 0;
  741. pAmmo[playerid] = 0;
  742. }
  743. return 1;
  744. }
  745. case DIALOG_RADIO:
  746. {
  747. if(response)
  748. {
  749. format(string, 256, "%s", inputtext);
  750. PlayAudioStreamForPlayer(playerid, string);
  751. }
  752. return 1;
  753. }
  754. }
  755. return 1;
  756. }
  757.  
  758. public OnPlayerModelSelection(playerid, response, listid, modelid)
  759. {
  760. if(listid == vskins)
  761. {
  762. if(response)
  763. {
  764. SendClientMessage(playerid, COLOR_YELLOW, "Skin Changed");
  765. SetPlayerSkin(playerid, modelid);
  766. VipAccount[playerid][VGold] -= 50;
  767. new string[256];
  768. format(string, 256, "Gold Balance: %d",VipAccount[playerid][VGold]);
  769. SendClientMessage(playerid, COLOR_WHITE, string);
  770. }
  771. else SendClientMessage(playerid, COLOR_GREEN, "Canceled skin selection");
  772. return 1;
  773. }
  774. return 1;
  775. }
  776.  
  777. public OnFilterScriptInit()
  778. {
  779. print("\n--------------------------------------");
  780. print(" Glad 2 Be Here VIP SYSTEM");
  781. print("--------------------------------------\n");
  782. LoadVShops();
  783. LoadVipHq();
  784. LoadVCars();
  785. vskins = LoadModelSelectionMenu("GVIP/vskin.txt");
  786. return 1;
  787. }
  788.  
  789. public OnFilterScriptExit()
  790. {
  791. SaveVShops();
  792. SaveVipHq();
  793. SaveVCars();
  794. return 1;
  795. }
  796.  
  797. public OnPlayerConnect(playerid)
  798. {
  799. VCSTATUS[playerid] = 1;
  800. LoggedIn[playerid] = 0;
  801. pGun[playerid] = 0;
  802. pAmmo[playerid] = 0;
  803. return 1;
  804. }
  805.  
  806. public OnPlayerDisconnect(playerid, reason)
  807. {
  808. if(VipAccount[playerid][VipLevel] && LoggedIn[playerid])
  809. {
  810. new INI:File = INI_Open(VipPath(playerid));
  811. INI_SetTag(File,"data");
  812. INI_WriteInt(File, "Password",VipAccount[playerid][Vpass]);
  813. INI_WriteInt(File, "Level",VipAccount[playerid][VipLevel]);
  814. INI_WriteString(File, "NickName",VipAccount[playerid][VNickName]);
  815. INI_WriteInt(File, "Gold",VipAccount[playerid][VGold]);
  816. INI_Close(File);
  817. }
  818. DeletePlayer3DTextLabel(playerid, vlabel);
  819. return 1;
  820. }
  821.  
  822. public OnPlayerStateChange(playerid, newstate, oldstate)
  823. {
  824. for(new c=0; c < MAX_VCARS; c++)
  825. {
  826. if(newstate == 2)
  827. {
  828. new CheckVipCar = GetPlayerVehicleID(playerid);
  829. if(CheckVipCar == VCar[c][Car])
  830. {
  831. if(VCar[c][VType] && !VipAccount[playerid][VipLevel])
  832. {
  833. RemovePlayerFromVehicle(playerid);
  834. SendClientMessage(playerid, COLOR_GREEN, "This Car Is For Vip's");
  835. }
  836. else if(VCar[c][VType] == 2 && VipAccount[playerid][VipLevel] < 2)
  837. {
  838. RemovePlayerFromVehicle(playerid);
  839. SendClientMessage(playerid, COLOR_GREEN, "This Car Is For Silver Vip's");
  840. }
  841. else if(VCar[c][VType] == 3 && VipAccount[playerid][VipLevel] < 3)
  842. {
  843. RemovePlayerFromVehicle(playerid);
  844. SendClientMessage(playerid, COLOR_GREEN, "This Car Is For Gold Vip's");
  845. }
  846. else if(VCar[c][VType] == 4 && VipAccount[playerid][VipLevel] < 4)
  847. {
  848. RemovePlayerFromVehicle(playerid);
  849. SendClientMessage(playerid, COLOR_GREEN, "This Car Is For Platinum Vip's");
  850. }
  851. }
  852. }
  853. }
  854. return 1;
  855. }
  856. #endif
Advertisement
Add Comment
Please, Sign In to add comment