Advertisement
Guest User

VIP ANTIGO

a guest
Dec 21st, 2014
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.72 KB | None | 0 0
  1. //na enum
  2.  
  3. VipExpira,
  4. pVip,
  5.  
  6. CMD:vips(playerid, params[]) //comandos vip
  7. {
  8. SendClientMessage(playerid, COR_BARRAS, "» Todos os VIP's online:");
  9. new count=0;
  10. for(new i=0; i<MAX_PLAYERS; i++)
  11. {
  12. if(Player[i][pLogged] == true)
  13. {
  14. if(Player[i][pVip] == 1)
  15. {
  16. if(IsPlayerConnected(i))
  17. {
  18. new str[256];
  19. new pname[24];
  20. GetPlayerName(i, pname, 24);
  21. format(str, 256, "» Vip: %s | [Tempo restante %s]", pname, Convert(Player[i][VipExpira]-gettime()));
  22. SendClientMessage(playerid, 0xE3E3E3FF, str);
  23. count++;
  24. }
  25. }
  26. }
  27. }
  28. if(count == 0)
  29. {
  30. SendClientMessage(playerid, 0xD8D8D8FF, "Não tem nenhum vip on-line agora!");
  31. }
  32. return 1;
  33. }
  34.  
  35. //==============================================================================//
  36. stock setVipUser(dias, id, extra[])
  37. {
  38. new String[128];
  39. format(String, sizeof(String), CONTAS, getPName(id));
  40. Player[id][VipExpira] = gettime()+(ONE_DAY*dias);
  41. Player[id][pVip] = 1;
  42. format(String, sizeof(String), CONTAS, getPName(id));
  43. DOF2_SetInt(String,"Vip",Player[id][pVip]);
  44. DOF2_SetInt(String,"VipExpira",Player[id][VipExpira]);
  45. DOF2_SaveFile();
  46.  
  47. DOF2_CreateFile(VIP_FILE(getPName(id)));
  48. DOF2_SetInt(VIP_FILE(getPName(id)), "Dias", dias);
  49. DOF2_SetInt(VIP_FILE(getPName(id)), "VipExpira",Player[id][VipExpira]);
  50. DOF2_SetString(VIP_FILE(getPName(id)), "Extra", extra);
  51. DOF2_SaveFile();
  52.  
  53. format(String,128, "setVipUser(%d, %s, %s)", dias, getPName(id), extra);
  54. WriteLog("setVipUser", String);
  55. return 1;
  56. }
  57. //==============================================================================//
  58. stock setVipAccount(dias, acc[], extra[])
  59. {
  60. new String[128];
  61. format(String, sizeof(String), CONTAS, acc);
  62. new exp = gettime()+(ONE_DAY*dias);
  63. format(String, sizeof(String), CONTAS, acc);
  64. DOF2_SetInt(String,"Vip", 1);
  65. DOF2_SaveFile();
  66.  
  67. DOF2_CreateFile(VIP_FILE(acc));
  68. DOF2_SetInt(VIP_FILE(acc), "Dias", dias);
  69. DOF2_SetInt(VIP_FILE(acc), "VipExpira", exp);
  70. DOF2_SetString(VIP_FILE(acc), "Extra", extra);
  71. DOF2_SaveFile();
  72. return 1;
  73. }
  74. //==============================================================================//
  75.  
  76. Convert(number)
  77. {
  78. new hours = 0, mins = 0, secs = 0, string[128];
  79. hours = floatround(number / 3600);
  80. mins = floatround((number / 60) - (hours * 60));
  81. secs = floatround(number - ((hours * 3600) + (mins * 60)));
  82. new days = 0;
  83.  
  84. if(hours >= 24)
  85. {
  86. days = floatround((hours/24), floatround_floor);
  87. hours = hours % 24;
  88. }
  89.  
  90. if(days > 0)
  91. {
  92. format(string, 100, "%ddias, %dh %dm e %ds", days, hours, mins, secs);
  93. }
  94. else if(hours > 0)
  95. {
  96. format(string, 100, "%dh %dm e %ds", hours, mins, secs);
  97. }
  98. else
  99. {
  100. format(string, 100, "%dm e %ds", mins, secs);
  101. }
  102. return string;
  103. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement