Guest User

Untitled

a guest
Sep 23rd, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. enum PlayerStatistics
  2. {
  3. VipTime, // This is used for a Pvar
  4. };
  5.  
  6. public OnPlayerConnect(playerid)
  7. {
  8. new file[256];
  9. format(file, sizeof(file), "Accounts/%s.ini", GetName(playerid));
  10. if(dini_Exists(file))
  11. {
  12. Player[playerid][VipTime] = dini_Int(file, "VipTime");
  13. SetPVarInt(playerid, "VipTime", Player[playerid][VipTime]);
  14. }
  15. return 1;
  16. }
  17.  
  18. command(buddyinvite, playerid, params[])
  19. {
  20. new id, string[256];
  21. if(sscanf(params, "u", id))
  22. {
  23. SendClientMessage(playerid, WHITE, "SYNTAX: /buddyinvite [playerid]");
  24. SendClientMessage(playerid, WHITE, "This feature is only available to gold vip or above!");
  25. }
  26. else
  27. {
  28. if(Player[playerid][VipRank] >= 4)
  29. {
  30. if(IsPlayerConnectedEx(id))
  31. {
  32. if(Player[playerid][VipRank] < 1)
  33. {
  34. format(string, sizeof(string), "** %s has buddy-invited you! You are now a bronze vip for one hour.", GetName(playerid));
  35. SendClientMessage(id, NICESKY, string);
  36. format(string, sizeof(string), "** You have buddy-invited %s!", GetName(id));
  37. SendClientMessage(playerid, NICESKY, string);
  38. SetPVarInt(playerid, "VipTime", 3600);
  39. Player[id][VipRank] = 1;
  40. }
  41. else SendClientMessage(playerid, GREy, "You cannot buddy-invite a vip!");
  42. }
  43. else SendClientMessage(playerid, GREy, "That user is not connected!"); }
  44. }
  45. return 1;
  46. }
  47.  
  48. public OneSecondPublic()
  49. {
  50. for(new i = 0; i < MAX_PLAYERS; i++)
  51. {
  52. if(gettime() > GetPVarInt(i, "VipTime"))
  53. {
  54. SendClientMessage(i, YELLOW, "Your buddy-invite has expired.");
  55. Player[i][VipRank] = 0;
  56. }
  57. }
  58. return 1;
  59. }
Add Comment
Please, Sign In to add comment