Guest User

V1.1.5

a guest
Feb 18th, 2013
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 27.89 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] == 1)
  546. {
  547. LoggedIn[playerid] = 0;
  548. SendClientMessage(playerid, COLOR_GREEN, "You Are already Logged On");
  549. }
  550. if(fexist(VipPath(playerid)))
  551. {
  552. INI_ParseFile(VipPath(playerid), "LoadVIPPass_%s", .bExtra = true, .extra = playerid);
  553. TogglePlayerControllable(playerid, 0 );
  554. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Load Up Your Vip Account","Type your password below to login.","Login","Quit");
  555. }
  556. else
  557. {
  558. ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"Create Vip Account","Enter a Vip password for You Vip Account","Register","Quit");
  559. TogglePlayerControllable(playerid, 0 );
  560. }
  561. return 1;
  562. }
  563.  
  564. CMD:v(playerid, params[])
  565. {
  566. new string[128];
  567. if(!VipAccount[playerid][VipLevel] && !LoggedIn[playerid]) return SendClientMessage(playerid, COLOR_GREEN, "You Are Not A Vip");
  568. if(!VCSTATUS[playerid]) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "You Chat Is Off");
  569. if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /v [text]");
  570. format(string, 128, "VIP:[%s] says:%s ",VipAccount[playerid][VNickName],params);
  571. VipMessage(COLOR_YELLOW, string);
  572. return 1;
  573. }
  574.  
  575. CMD:tvchat(playerid, params[])
  576. {
  577. if(!VipAccount[playerid][VipLevel] && !LoggedIn[playerid]) return SendClientMessage(playerid, COLOR_GREEN, "You Are Not A Vip");
  578. if(VCSTATUS[playerid])
  579. {
  580. VCSTATUS[playerid] = 0;
  581. SendClientMessage(playerid, COLOR_GREEN, "You Turn OFF The Vip Chat");
  582. }
  583. else if(!VCSTATUS[playerid])
  584. {
  585. VCSTATUS[playerid] = 1;
  586. SendClientMessage(playerid, COLOR_GREEN, "You Turn ON The Vip Chat");
  587. }
  588. return 1;
  589. }
  590.  
  591. CMD:vshop(playerid, params[])
  592. {
  593. if(!VipAccount[playerid][VipLevel] && !LoggedIn[playerid]) return SendClientMessage(playerid, COLOR_GREEN, "You Are Not A Vip");
  594. for(new vs=0; vs < MAX_SHOPS; vs++)
  595. {
  596. if(IsPlayerInRangeOfPoint(playerid, 5, VipShop[vs][VSPos][0], VipShop[vs][VSPos][1], VipShop[vs][VSPos][2]))
  597. {
  598. ShowPlayerDialog(playerid, DIALOG_SHOP, DIALOG_STYLE_LIST, "{0099FF}VIP SHOP", "{3333CC}Guns\n{6699FF}Skins", "Shop", "Leave");
  599. }
  600. }
  601. return 1;
  602. }
  603.  
  604. CMD:vradio(playerid, params[])
  605. {
  606. if(!VipAccount[playerid][VipLevel] && !LoggedIn[playerid]) return SendClientMessage(playerid, COLOR_GREEN, "You Need To Be A Vip");
  607. if(GetPlayerGold(playerid) < 1) return SendClientMessage(playerid, COLOR_YELLOW, "$1 Gold Per Use");
  608. ShowPlayerDialog(playerid, DIALOG_RADIO, DIALOG_STYLE_INPUT, "Enter Music", "Use .MP3 Format or working links", "Listen", "Cancel");
  609. return 1;
  610. }
  611.  
  612. CMD:vsradio(playerid, params[])
  613. {
  614. StopAudioStreamForPlayer(playerid);
  615. return 1;
  616. }
  617.  
  618. CMD:vnick(playerid, params[])
  619. {
  620. if(!VipAccount[playerid][VipLevel] && !LoggedIn[playerid]) return SendClientMessage(playerid, COLOR_GREEN, "You Need To Be A Vip");
  621. if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /vnick [name]");
  622. format(VipAccount[playerid][VNickName], 32 , "%s", params);
  623. SendClientMessage(playerid, COLOR_WHITE, VipAccount[playerid][VNickName]);
  624. return 1;
  625. }
  626.  
  627. CMD:hq(playerid, params[])
  628. {
  629. for(new hq=0; hq < MAX_HQS; hq++)
  630. {
  631. if(IsPlayerInRangeOfPoint(playerid, 5, VHq[hq][VHQEnPos][0], VHq[hq][VHQEnPos][1], VHq[hq][VHQEnPos][2]))
  632. {
  633. SetPlayerPos(playerid, VHq[hq][VHQExPos][0], VHq[hq][VHQExPos][1], VHq[hq][VHQExPos][2]);
  634. SetPlayerInterior(playerid, VHq[hq][HqInterior]);
  635. SetPlayerVirtualWorld(playerid, 250+hq);
  636. }
  637. if(IsPlayerInRangeOfPoint(playerid, 5, VHq[hq][VHQExPos][0], VHq[hq][VHQExPos][1], VHq[hq][VHQExPos][2]))
  638. {
  639. SetPlayerPos(playerid, VHq[hq][VHQEnPos][0], VHq[hq][VHQEnPos][1], VHq[hq][VHQEnPos][2]);
  640. SetPlayerInterior(playerid, 0);
  641. SetPlayerVirtualWorld(playerid, 0);
  642. }
  643. }
  644. return 1;
  645. }
  646.  
  647. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  648. {
  649. new string[256];
  650. switch( dialogid )
  651. {
  652. case DIALOG_REGISTER:
  653. {
  654. if (!response) return TogglePlayerControllable(playerid, 1 );
  655. if(response)
  656. {
  657. 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");
  658. new INI:File = INI_Open(VipPath(playerid));
  659. INI_SetTag(File,"data");
  660. INI_WriteInt(File,"Password",udb_hash(inputtext));
  661. INI_WriteInt(File, "Level",0);
  662. INI_WriteString(File, "NickName","");
  663. INI_WriteInt(File, "Gold",0);
  664. INI_Close(File);
  665. TogglePlayerControllable(playerid, 1 );
  666. LoggedIn[playerid] = 1;
  667. SendClientMessage(playerid, COLOR_RED, "You Are Now Registered");
  668. if(IsPlayerAdmin(playerid))
  669. {
  670. SendClientMessage(playerid, COLOR_LIGHTBLUE, "gvah");
  671. }
  672. if(VipAccount[playerid][VipLevel])
  673. {
  674. SendClientMessage(playerid, COLOR_LIGHTBLUE, "gvshelp");
  675. }
  676. }
  677. }
  678. case DIALOG_LOGIN:
  679. {
  680. if ( !response ) return TogglePlayerControllable(playerid, 1 );
  681. if( response )
  682. {
  683. if(udb_hash(inputtext) == VipAccount[playerid][Vpass])
  684. {
  685. INI_ParseFile(VipPath(playerid), "LoadVIP_%s", .bExtra = true, .extra = playerid);
  686. LoggedIn[playerid] = 1;
  687. SendClientMessage(playerid, COLOR_RED, "You Are Now Log In");
  688. TogglePlayerControllable(playerid, 1 );
  689. if(IsPlayerAdmin(playerid))
  690. {
  691. SendClientMessage(playerid, COLOR_GREEN, "CMD:[ADMIN]gvah");
  692. }
  693. if(VipAccount[playerid][VipLevel])
  694. {
  695. SendClientMessage(playerid, COLOR_RED, "CMD:[PLAYER]gvshelp");
  696. }
  697. format(string, 256, "Gold Balance: %d",VipAccount[playerid][VGold]);
  698. SendClientMessage(playerid, COLOR_WHITE, string);
  699. }
  700. else
  701. {
  702. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","You have entered an incorrect password.\nType your password below to login.","Login","Quit");
  703. }
  704. return 1;
  705. }
  706. }
  707. case DIALOG_SHOP:
  708. {
  709. if(response)
  710. {
  711. if(listitem == 0)
  712. {
  713. if(GetPlayerGold(playerid) < 5) return SendClientMessage(playerid, COLOR_RED, "Woomp Woomp Woomp You Can even afford Brass Knuckles");
  714. ShowPlayerDialog(playerid, DIALOG_WEAPONINPUT, DIALOG_STYLE_INPUT, "Weapons", "{9900FF}Choose You Weapon", "LoadUp", "Close");
  715. }
  716. if(listitem == 1)
  717. {
  718. ShowModelSelectionMenu(playerid, vskins, "Choose a Skin");
  719. }
  720. }
  721. return 1;
  722. }
  723. case DIALOG_WEAPONINPUT:
  724. {
  725. if(response)
  726. {
  727. pGun[playerid] = strval(inputtext);
  728. ShowPlayerDialog(playerid,DIALOG_AMMOINPUT, DIALOG_STYLE_INPUT, "Weapons", "How Much Ammo", "Rounds", "Cancel");
  729.  
  730. }
  731. return 1;
  732. }
  733. case DIALOG_AMMOINPUT:
  734. {
  735. if(response)
  736. {
  737. pAmmo[playerid] = strval(inputtext);
  738. new g = 5*pGun[playerid]*10*pAmmo[playerid];
  739. if(GetPlayerGold(playerid) < g) return SendClientMessage(playerid, COLOR_GREEN, "You cannot afford the ammount");
  740. VipAccount[playerid][VGold] -= g;
  741. format(string, 256, "Gold Balance: %d",VipAccount[playerid][VGold]);
  742. SendClientMessage(playerid, COLOR_WHITE, string);
  743. GivePlayerWeapon(playerid,pGun[playerid] ,pAmmo[playerid]);
  744. pGun[playerid] = 0;
  745. pAmmo[playerid] = 0;
  746. }
  747. return 1;
  748. }
  749. case DIALOG_RADIO:
  750. {
  751. if(response)
  752. {
  753. format(string, 256, "%s", inputtext);
  754. PlayAudioStreamForPlayer(playerid, string);
  755. }
  756. return 1;
  757. }
  758. }
  759. return 1;
  760. }
  761.  
  762. public OnPlayerModelSelection(playerid, response, listid, modelid)
  763. {
  764. if(listid == vskins)
  765. {
  766. if(response)
  767. {
  768. SendClientMessage(playerid, COLOR_YELLOW, "Skin Changed");
  769. SetPlayerSkin(playerid, modelid);
  770. VipAccount[playerid][VGold] -= 50;
  771. new string[256];
  772. format(string, 256, "Gold Balance: %d",VipAccount[playerid][VGold]);
  773. SendClientMessage(playerid, COLOR_WHITE, string);
  774. }
  775. else SendClientMessage(playerid, COLOR_GREEN, "Canceled skin selection");
  776. return 1;
  777. }
  778. return 1;
  779. }
  780.  
  781. public OnFilterScriptInit()
  782. {
  783. print("\n--------------------------------------");
  784. print(" Glad 2 Be Here VIP SYSTEM");
  785. print("--------------------------------------\n");
  786. LoadVShops();
  787. LoadVipHq();
  788. LoadVCars();
  789. vskins = LoadModelSelectionMenu("GVIP/vskin.txt");
  790. return 1;
  791. }
  792.  
  793. public OnFilterScriptExit()
  794. {
  795. SaveVShops();
  796. SaveVipHq();
  797. SaveVCars();
  798. foreach(Player, i)
  799. if(LoggedIn[i] == 1)
  800. {
  801. LoggedIn[i] = 0;
  802. }
  803. return 1;
  804. }
  805.  
  806. public OnPlayerConnect(playerid)
  807. {
  808. VCSTATUS[playerid] = 1;
  809. LoggedIn[playerid] = 0;
  810. pGun[playerid] = 0;
  811. pAmmo[playerid] = 0;
  812. return 1;
  813. }
  814.  
  815. public OnPlayerDisconnect(playerid, reason)
  816. {
  817. if(VipAccount[playerid][VipLevel] && LoggedIn[playerid])
  818. {
  819. new INI:File = INI_Open(VipPath(playerid));
  820. INI_SetTag(File,"data");
  821. INI_WriteInt(File, "Password",VipAccount[playerid][Vpass]);
  822. INI_WriteInt(File, "Level",VipAccount[playerid][VipLevel]);
  823. INI_WriteString(File, "NickName",VipAccount[playerid][VNickName]);
  824. INI_WriteInt(File, "Gold",VipAccount[playerid][VGold]);
  825. INI_Close(File);
  826. }
  827. DeletePlayer3DTextLabel(playerid, vlabel);
  828. return 1;
  829. }
  830.  
  831. public OnPlayerStateChange(playerid, newstate, oldstate)
  832. {
  833. for(new c=0; c < MAX_VCARS; c++)
  834. {
  835. if(newstate == 2)
  836. {
  837. new CheckVipCar = GetPlayerVehicleID(playerid);
  838. if(CheckVipCar == VCar[c][Car])
  839. {
  840. if(VCar[c][VType] && !VipAccount[playerid][VipLevel])
  841. {
  842. RemovePlayerFromVehicle(playerid);
  843. SendClientMessage(playerid, COLOR_GREEN, "This Car Is For Vip's");
  844. }
  845. else if(VCar[c][VType] == 2 && VipAccount[playerid][VipLevel] < 2)
  846. {
  847. RemovePlayerFromVehicle(playerid);
  848. SendClientMessage(playerid, COLOR_GREEN, "This Car Is For Silver Vip's");
  849. }
  850. else if(VCar[c][VType] == 3 && VipAccount[playerid][VipLevel] < 3)
  851. {
  852. RemovePlayerFromVehicle(playerid);
  853. SendClientMessage(playerid, COLOR_GREEN, "This Car Is For Gold Vip's");
  854. }
  855. else if(VCar[c][VType] == 4 && VipAccount[playerid][VipLevel] < 4)
  856. {
  857. RemovePlayerFromVehicle(playerid);
  858. SendClientMessage(playerid, COLOR_GREEN, "This Car Is For Platinum Vip's");
  859. }
  860. }
  861. }
  862. }
  863. return 1;
  864. }
  865. #endif
Advertisement
Add Comment
Please, Sign In to add comment