Advertisement
Guest User

illuminati SQLite V.I.P System.

a guest
Feb 16th, 2016
484
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.64 KB | None | 0 0
  1. //==============================================================================
  2. // 1LLuMiNaTi2's V.I.P Script 2/14/2016 //====================
  3. //==============================================================================
  4. #include <a_samp>
  5. #include <foreach>
  6. #include <sscanf>
  7. #include <zcmd>
  8.  
  9. #define DIALOG_NONE 2000
  10. #define DIALOG_COLOR 2001
  11. #define DIALOG_WEAPS 2000
  12.  
  13. #define INF_HEALTH (Float:0x7F800000)
  14.  
  15. enum VIP_Enum
  16. {
  17. Level,
  18. Float:X,
  19. Float:Y,
  20. Float:Z,
  21. Interior,
  22. GodMode
  23. }
  24.  
  25. new VIP[MAX_PLAYERS][VIP_Enum];
  26. new DB:Database;
  27. new year, month, day;
  28.  
  29. public OnFilterScriptInit()
  30. {
  31. print("\n===========================================");
  32. print(" 1LLuMiNaTi2's V.I.P Script 2/14/2016 ");
  33. print("===========================================\n");
  34.  
  35. Database = db_open("VIPBase.db");
  36. db_query(Database, "CREATE TABLE IF NOT EXISTS USRDB(NAME, LEVEL, X, Y, Z, INTERIOR)");
  37.  
  38. getdate(year, month, day);
  39. return 1;
  40. }
  41.  
  42. public OnFilterScriptExit()
  43. {
  44. foreach(Player, i)
  45. {
  46. OnPlayerDisconnect(i, 1);
  47. }
  48. db_close(Database);
  49. return 1;
  50. }
  51.  
  52. public OnPlayerConnect(playerid)
  53. {
  54. new
  55. dbQuery[120], DBResult:dbResult, name[MAX_PLAYER_NAME], str[128];
  56. GetPlayerName(playerid, name, sizeof(name));
  57. format(dbQuery, sizeof(dbQuery), "SELECT * FROM USRDB WHERE `NAME` = '%s' COLLATE NOCASE", DB_Escape(name));
  58. dbResult = db_query(Database, dbQuery);
  59. if(db_num_rows(dbResult))
  60. {
  61. new Value[15];
  62. db_get_field_assoc(dbResult, "LEVEL", Value, 35);
  63. VIP[playerid][Level] = strval(Value);
  64.  
  65. db_get_field_assoc(dbResult, "X", Value, 35);
  66. VIP[playerid][X] = strval(Value);
  67.  
  68. db_get_field_assoc(dbResult, "Y", Value, 35);
  69. VIP[playerid][Y] = strval(Value);
  70.  
  71. db_get_field_assoc(dbResult, "Z", Value, 35);
  72. VIP[playerid][Z] = strval(Value);
  73.  
  74. db_get_field_assoc(dbResult, "INTERIOR", Value, 35);
  75. VIP[playerid][Interior] = strval(Value);
  76. }
  77. else
  78. {
  79. format(dbQuery, sizeof(dbQuery), "INSERT INTO USRDB(NAME, LEVEL, X, Y, Z, INTERIOR) VALUES('%s', '0', '0.0', '0.0', '0.0', '0')", DB_Escape(name));
  80. db_query(Database, dbQuery);
  81. }
  82. db_free_result(dbResult);
  83.  
  84. //==========================================================================
  85. if(VIP[playerid][Level] >= 1)
  86. {
  87. format(str, sizeof(str), "{FF00FF}V.I.P {%06x}%s {FFFFFF}has connected to the server!", name);
  88. SendClientMessageToAll(-1, str);
  89. }
  90. return 1;
  91. }
  92.  
  93. public OnPlayerDisconnect(playerid, reason)
  94. {
  95. new
  96. dbQuery[120], name[MAX_PLAYER_NAME], DBResult:dbResult;
  97. GetPlayerName(playerid, name, sizeof(name));
  98. format(dbQuery, sizeof(dbQuery), "SELECT * FROM USRDB WHERE NAME = '%s'", DB_Escape(name));
  99.  
  100. dbResult = db_query(Database, dbQuery);
  101. if(db_num_rows(dbResult))
  102. {
  103. format(dbQuery,sizeof(dbQuery),"UPDATE USRDB SET LEVEL = '%d' WHERE `NAME` = '%s' COLLATE NOCASE", VIP[playerid][Level] , DB_Escape(name));
  104. db_query(Database, dbQuery);
  105. }
  106. db_free_result(dbResult);
  107. return 1;
  108. }
  109.  
  110. public OnPlayerDeath(playerid, killerid, reason)
  111. {
  112. if(VIP[killerid][Level] >= 1)
  113. {
  114. SetPlayerScore(killerid, GetPlayerScore(killerid) + 10);
  115. SendClientMessage(killerid, -1, "{FF00FF}VIP Bonus:- {FFFFFF}You've got additional 10 scores for killing!");
  116. }
  117. return 1;
  118. }
  119.  
  120. public OnVehicleDamageStatusUpdate(vehicleid, playerid)
  121. {
  122. if(VIP[playerid][GodMode] == 1)
  123. {
  124. new panels, doors, lights, tires;
  125. GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
  126.  
  127. panels = 0;
  128. doors = 0;
  129. lights = 0;
  130. tires = 0;
  131.  
  132. UpdateVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
  133.  
  134. SetVehicleHealth(vehicleid, 99999);
  135. }
  136. return 1;
  137. }
  138.  
  139. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  140. {
  141. if(dialogid == DIALOG_COLOR)
  142. {
  143. if(response)
  144. {
  145. switch(listitem)
  146. {
  147. case 0: SetPlayerColor(playerid, 0xFF0000FF) , GameTextForPlayer(playerid, "~h~~r~Color Changed", 3000, 3);
  148. case 1: SetPlayerColor(playerid, 0x00FF00FF) , GameTextForPlayer(playerid, "~h~~r~Color Changed", 3000, 3);
  149. case 2: SetPlayerColor(playerid, 0x0000FFFF) , GameTextForPlayer(playerid, "~h~~r~Color Changed", 3000, 3);
  150. case 3: SetPlayerColor(playerid, 0xFFFF00FF) , GameTextForPlayer(playerid, "~h~~r~Color Changed", 3000, 3);
  151. case 4: SetPlayerColor(playerid, 0xFFFFFFFF) , GameTextForPlayer(playerid, "~h~~r~Color Changed", 3000, 3);
  152. case 5: SetPlayerColor(playerid, 0x000000FF) , GameTextForPlayer(playerid, "~h~~r~Color Changed", 3000, 3);
  153. case 6: SetPlayerColor(playerid, 0x808080FF) , GameTextForPlayer(playerid, "~h~~r~Color Changed", 3000, 3);
  154. case 7: SetPlayerColor(playerid, 0xFF00CCFF) , GameTextForPlayer(playerid, "~h~~r~Color Changed", 3000, 3);
  155. case 8: SetPlayerColor(playerid, 0x00FFFFFF) , GameTextForPlayer(playerid, "~h~~r~Color Changed", 3000, 3);
  156. case 9: SetPlayerColor(playerid, 0x330000FF) , GameTextForPlayer(playerid, "~h~~r~Color Changed", 3000, 3);
  157. }
  158. }
  159. return 1;
  160. }
  161. if(dialogid == DIALOG_COLOR)
  162. {
  163. if(response)
  164. {
  165. switch(listitem)
  166. {
  167. case 0: GivePlayerWeapon(playerid, 35, 99999);
  168. case 1: GivePlayerWeapon(playerid, 38, 99999);
  169. case 2: GivePlayerWeapon(playerid, 36, 99999);
  170. case 3: GivePlayerWeapon(playerid, 37, 99999);
  171. case 4: GivePlayerWeapon(playerid, 24, 99999);
  172. case 5: GivePlayerWeapon(playerid, 26, 99999);
  173. case 6: GivePlayerWeapon(playerid, 31, 99999);
  174. case 7: GivePlayerWeapon(playerid, 28, 99999);
  175. case 8: GivePlayerWeapon(playerid, 9, 1);
  176. case 9: GivePlayerWeapon(playerid, 16, 99999);
  177. }
  178. }
  179. return 1;
  180. }
  181. return 0;
  182. }
  183.  
  184. CMD:setvip(playerid, params[])
  185. {
  186. if(IsPlayerAdmin(playerid))
  187. {
  188. new str[170], targetid, level;
  189. if(sscanf(params, "ii", targetid, level)) return SendClientMessage(playerid, -1, "{FF0000}Correct Usage: /setvip (Playerid) (Level)");
  190. if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "{FF0000}ERROR: Player is not connected.");
  191. if(level > 3 || level < 0) return SendClientMessage(playerid, -1, "{FF0000}ERROR: Invalid Level.");
  192. format(str, sizeof(str), "{FF0000}Administrator {FFFFFF}%s has set %s's {00FF00}V.I.P Level {FFFFFF}to {00FF00}%d {FFFFFF}%d/%d/%d", Name(playerid), Name(targetid), level, month, day, year);
  193. SendClientMessageToAll(-1, str);
  194. VIP[targetid][Level] = level;
  195. }
  196. return 1;
  197. }
  198.  
  199. CMD:savepos(playerid)
  200. {
  201. if(VIP[playerid][Level] >= 1)
  202. {
  203. new Query[120], Float:x, Float:y, Float:z, Int;
  204. GetPlayerPos(playerid, x,y,z);
  205. Int = GetPlayerInterior(playerid);
  206. GameTextForPlayer(playerid, "~r~Position Saved!", 3000, 3);
  207. format(Query,sizeof(Query),"UPDATE USRDB SET X = '%0.2f', Y = '%0.2f', Z = '%0.2f', INTERIOR = '%d' WHERE `NAME` = '%s' COLLATE NOCASE", x, y, z, Int, DB_Escape(Name(playerid)));
  208. VIP[playerid][X] = x;
  209. VIP[playerid][Y] = y;
  210. VIP[playerid][Z] = z;
  211. VIP[playerid][Interior] = Int;
  212. db_query(Database, Query);
  213. }
  214. else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
  215. return 1;
  216. }
  217.  
  218. CMD:loadpos(playerid)
  219. {
  220. if(VIP[playerid][Level] >= 1)
  221. {
  222. GameTextForPlayer(playerid, "~g~Position Loaded!", 3000, 3);
  223. SetPlayerPos(playerid, VIP[playerid][X], VIP[playerid][Y], VIP[playerid][Z]);
  224. SetPlayerInterior(playerid, VIP[playerid][Interior]);
  225. }
  226. else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
  227. return 1;
  228. }
  229.  
  230. CMD:vheal(playerid)
  231. {
  232. if(VIP[playerid][Level] >= 1)
  233. {
  234. SetPlayerHealth(playerid, 100);
  235. GameTextForPlayer(playerid, "~r~Health Refilled!", 3000, 3);
  236. }
  237. else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
  238. return 1;
  239. }
  240.  
  241. CMD:varmour(playerid)
  242. {
  243. if(VIP[playerid][Level] >= 1)
  244. {
  245. SetPlayerArmour(playerid, 100);
  246. GameTextForPlayer(playerid, "~g~Armour Refilled!", 3000, 3);
  247. }
  248. else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
  249. return 1;
  250. }
  251.  
  252.  
  253. CMD:vgod(playerid)
  254. {
  255. if(VIP[playerid][Level] >= 1)
  256. {
  257. new Veh = GetPlayerVehicleID(playerid);
  258. if(VIP[playerid][GodMode] == 1)
  259. {
  260. VIP[playerid][GodMode] = 0;
  261. SetPlayerHealth(playerid, 100);
  262. SetVehicleHealth(Veh, 99999);
  263. GameTextForPlayer(playerid, "~r~GOD MODE OFF!", 3000, 3);
  264. }
  265. else if(VIP[playerid][GodMode] == 0)
  266. {
  267. VIP[playerid][GodMode] = 1;
  268. SetPlayerHealth(playerid, INF_HEALTH);
  269. SetVehicleHealth(Veh, 99999);
  270. GameTextForPlayer(playerid, "~r~GOD MODE ON!", 3000, 3);
  271. }
  272. }
  273. else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
  274. return 1;
  275. }
  276.  
  277. CMD:vcolor(playerid)
  278. {
  279. if(VIP[playerid][Level] >= 1)
  280. {
  281. GameTextForPlayer(playerid, "~r~COLORS", 3000, 3);
  282. ShowPlayerDialog(playerid, DIALOG_COLOR, DIALOG_STYLE_LIST, "VIP {00FF00}Colors", "{FF0000}Red\n{00FF00}Green\n\
  283. {0000FF}Blue\n{FFFF00}Yellow\n{FFFFFF}White\n{000000}Black\n{808080}Gray\n\
  284. {FF00CC}Purple\n{00FFFF}Aqua\n{330000}Brown", "Choose", "Exit");
  285. }
  286. else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
  287. return 1;
  288. }
  289.  
  290. CMD:vsay(playerid, params[])
  291. {
  292. if(VIP[playerid][Level] >= 1)
  293. {
  294. new text[128], str[128];
  295. if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, -1, "{FF0000}Correct Usage: /vsay [Text]");
  296. format(str, sizeof(str), "{FF00CC}** V.I.P {%06x}%s[%d]{FFFFFF}: %s {FF00CC}**", GetPlayerColor(playerid) >>> 8, Name(playerid), playerid, text);
  297. SendClientMessageToAll(-1, str);
  298. }
  299. else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
  300. return 1;
  301. }
  302.  
  303. CMD:vnos(playerid)
  304. {
  305. if(VIP[playerid][Level] >= 1)
  306. {
  307. if(IsPlayerInAnyVehicle(playerid))
  308. {
  309. AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
  310. } else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not in a vehicle!");
  311. }
  312. else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
  313. return 1;
  314. }
  315.  
  316. CMD:vskin(playerid, params[])
  317. {
  318. if(VIP[playerid][Level] >= 1)
  319. {
  320. new skin;
  321. if(sscanf(params, "i", skin)) return SendClientMessage(playerid, -1, "{FF0000}Correct Usage: /vskin [ID]");
  322. if(skin > 311 || skin < 0) return SendClientMessage(playerid, -1, "{FF0000}ERROR: Invalid Skin ID.");
  323. GameTextForPlayer(playerid, "~g~Skin Changed!", 3000, 3);
  324. SetPlayerSkin(playerid, skin);
  325. } else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
  326. return 1;
  327. }
  328.  
  329. CMD:vweap(playerid, params[])
  330. {
  331. if(VIP[playerid][Level] >= 1)
  332. {
  333. new weap;
  334. if(sscanf(params, "i", weap)) return SendClientMessage(playerid, -1, "{FF0000}Correct Usage: /vweap [ID]");
  335. if(weap > 46 || weap < 0) return SendClientMessage(playerid, -1, "{FF0000}ERROR: Invalid Weapon ID.");
  336. GameTextForPlayer(playerid, "~g~Weapon Given!", 3000, 3);
  337. GivePlayerWeapon(playerid, weap, 99999);
  338. } else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
  339. return 1;
  340. }
  341.  
  342. CMD:vcar(playerid, params[])
  343. {
  344. if(VIP[playerid][Level] >= 2)
  345. {
  346. new car, Float:x, Float:y, Float:z, Float:a;
  347. if(sscanf(params, "i", car)) return SendClientMessage(playerid, -1, "{FF0000}Correct Usage: /vcar [ID]");
  348. if(car > 609 || car < 400) return SendClientMessage(playerid, -1, "{FF0000}ERROR: Invalid Vehicle ID.");
  349. GameTextForPlayer(playerid, "~g~Vehicle Spawned!", 3000, 3);
  350. GetPlayerPos(playerid, x, y, z);
  351. GetPlayerFacingAngle(playerid, a);
  352. CreateVehicle(car, x, y, z, a, 0, 0, -1);
  353. } else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
  354. return 1;
  355. }
  356.  
  357. CMD:vweaps(playerid)
  358. {
  359. if(VIP[playerid][Level] >= 2)
  360. {
  361. ShowPlayerDialog(playerid, DIALOG_WEAPS, DIALOG_STYLE_LIST, "{0000FF}VIP Special Weapons", "{FF00FF}RPG\nMinigun\nHeat Seeker\nFlame Thrower\nDesert Eagle\nSawn OFF\nSniper\nM4\nUZI\nChainsaw\nGrenade", "Choose", "Close");
  362. GameTextForPlayer(playerid, "~r~Select Weapon", 3000, 3);
  363. } else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
  364. return 1;
  365. }
  366.  
  367. CMD:vhouse(playerid)
  368. {
  369. if(VIP[playerid][Level] >= 2)
  370. {
  371. GameTextForPlayer(playerid, "~r~V.I.P House", 3000, 3);
  372. SetPlayerPos(playerid, 1267.663208,-781.323242,1091.906250);
  373. SetPlayerInterior(playerid, 5);
  374. } else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
  375. return 1;
  376. }
  377.  
  378. CMD:vweather(playerid, params[])
  379. {
  380. if(VIP[playerid][Level] >= 2)
  381. {
  382. new weath;
  383. if(sscanf(params, "i", weath)) return SendClientMessage(playerid, -1, "{FF0000}Correct Usage: /vwather [ID]");
  384. GameTextForPlayer(playerid, "~g~Weather Changed!", 3000, 3);
  385. SetPlayerWeather(playerid, weath);
  386. } else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
  387. return 1;
  388. }
  389.  
  390. CMD:vtime(playerid, params[])
  391. {
  392. if(VIP[playerid][Level] >= 2)
  393. {
  394. new time;
  395. if(sscanf(params, "i", time)) return SendClientMessage(playerid, -1, "{FF0000}Correct Usage: /vtime [ID]");
  396. GameTextForPlayer(playerid, "~g~Time Changed!", 3000, 3);
  397. SetPlayerTime(playerid, time, 0);
  398. } else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
  399. return 1;
  400. }
  401.  
  402. CMD:v(playerid, params[])
  403. {
  404. if(VIP[playerid][Level] >= 1)
  405. {
  406. new text[128], str[128];
  407. if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, -1, "{FF0000}Correct Usage: /v [Text]");
  408. format(str, sizeof(str), "{FF00CC}V.I.P Chat {%06x}%s[%d]{FFFFFF}: %s", GetPlayerColor(playerid) >>> 8, Name(playerid), playerid, text);
  409. foreach(Player, i)
  410. {
  411. SendClientMessage(i, -1, str);
  412. }
  413. }
  414. else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
  415. return 1;
  416. }
  417.  
  418. CMD:vjetpack(playerid, params[])
  419. {
  420. if(VIP[playerid][Level] >= 2)
  421. {
  422. SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USEJETPACK);
  423. } else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
  424. return 1;
  425. }
  426.  
  427. CMD:vammo(playerid, params[])
  428. {
  429. if(VIP[playerid][Level] >= 3)
  430. {
  431. SetPlayerAmmo(playerid, GetPlayerWeapon(playerid), 99999);
  432. SendClientMessage(playerid, -1, "Current Weapon's Ammo Set To Max Value!");
  433. } else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
  434. return 1;
  435. }
  436.  
  437. CMD:vminigun(playerid, params[])
  438. {
  439. if(VIP[playerid][Level] >= 3)
  440. {
  441. GivePlayerWeapon(playerid, 38, 99999);
  442. } else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
  443. return 1;
  444. }
  445.  
  446. CMD:vfix(playerid)
  447. {
  448. if(VIP[playerid][Level] >= 3)
  449. {
  450. if(IsPlayerInAnyVehicle(playerid))
  451. {
  452. new panels, doors, lights, tires, vehicleid;
  453. vehicleid = GetPlayerVehicleID(playerid);
  454. GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
  455.  
  456. panels = 0;
  457. doors = 0;
  458. lights = 0;
  459. tires = 0;
  460.  
  461. UpdateVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
  462.  
  463. SetVehicleHealth(vehicleid, 1000);
  464.  
  465. } else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not in a vehicle.");
  466. } else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
  467. return 1;
  468. }
  469.  
  470. CMD:vmws(playerid)
  471. {
  472. if(VIP[playerid][Level] >= 3)
  473. {
  474. SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL, 999);
  475. SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL_SILENCED, 999);
  476. SetPlayerSkillLevel(playerid, WEAPONSKILL_DESERT_EAGLE, 999);
  477. SetPlayerSkillLevel(playerid, WEAPONSKILL_SHOTGUN, 999);
  478. SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 999);
  479. SetPlayerSkillLevel(playerid, WEAPONSKILL_SPAS12_SHOTGUN, 999);
  480. SetPlayerSkillLevel(playerid, WEAPONSKILL_MICRO_UZI, 999);
  481. SetPlayerSkillLevel(playerid, WEAPONSKILL_MP5, 999);
  482. SetPlayerSkillLevel(playerid, WEAPONSKILL_AK47, 999);
  483. SetPlayerSkillLevel(playerid, WEAPONSKILL_M4, 999);
  484. SetPlayerSkillLevel(playerid, WEAPONSKILL_SNIPERRIFLE, 999);
  485. SendClientMessage(playerid, -1, "Weapons Skills has been set to the maximum value!");
  486. } else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
  487. return 1;
  488. }
  489.  
  490. CMD:vcmds(playerid)
  491. {
  492. ShowPlayerDialog(playerid, DIALOG_NONE, DIALOG_STYLE_MSGBOX, "{FF0000}Very {FFFFFF}Important {0000FF}Person", "Level 1 (Bronze): \
  493. /savepos, /loadpos, /vheal, /varmour, /vgod, /vcolor, /vnos, /vskin, /vweap, /v (MSG)\n\
  494. Level 2 (Silver): /vweaps, /vhouse, /vweather, /vtime, /vjetpack, /vcar, /vsay\
  495. Level 3 (Gold): /vammo, /vminigun, /vfix, /vmws (Max Weapons Skills)", "Close", "");
  496. return 1;
  497. }
  498.  
  499. CMD:vips(playerid)
  500. {
  501. new str[128];
  502. for(new i = 0; i < GetMaxPlayers(); i++)
  503. {
  504. if(VIP[playerid][Level] >= 1)
  505. {
  506. format(str, sizeof(str), "%s {FF00FF}(%s V.I.P)\n", Name(i), VIPRankName(i));
  507. ShowPlayerDialog(playerid, DIALOG_NONE, DIALOG_STYLE_MSGBOX, "Online {0000FF}Very {FFFFFF}Important {FF0000}Persons", str, "Close", "");
  508. }
  509. else
  510. {
  511. ShowPlayerDialog(playerid, DIALOG_NONE, DIALOG_STYLE_MSGBOX, "Online {0000FF}Very {FFFFFF}Important {FF0000}Persons", "No Online Very Important Persons", "Close", "");
  512. }
  513. }
  514. return 1;
  515. }
  516. //==============================================================================
  517.  
  518. stock Name(playerid)
  519. {
  520. new name[MAX_PLAYER_NAME];
  521. GetPlayerName(playerid, name, sizeof(name));
  522. return name;
  523. }
  524.  
  525. stock VIPRankName(playerid)
  526. {
  527. new str[128];
  528. switch(VIP[playerid][Level])
  529. {
  530. case 0: str = "Bronze";
  531. case 1: str = "Silver";
  532. case 2: str = "Gold";
  533. }
  534. return str;
  535. }
  536.  
  537. //==============================================================================
  538.  
  539. stock DB_Escape(text[])
  540. {
  541. new
  542. ret[80 * 2],
  543. ch,
  544. i,
  545. j;
  546. while ((ch = text[i++]) && j < sizeof (ret))
  547. {
  548. if (ch == '\'')
  549. {
  550. if (j < sizeof (ret) - 2)
  551. {
  552. ret[j++] = '\'';
  553. ret[j++] = '\'';
  554. }
  555. }
  556. else if (j < sizeof (ret))
  557. {
  558. ret[j++] = ch;
  559. }
  560. else
  561. {
  562. j++;
  563. }
  564. }
  565. ret[sizeof (ret) - 1] = '\0';
  566. return ret;
  567. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement