MuhammadZeeshan

asfasfas fasf

Dec 5th, 2016
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. function VIP( player, duration )
  2.  
  3. {
  4.  
  5. local g_time, duration_type;
  6.  
  7.  
  8.  
  9. switch( duration.len() )
  10.  
  11. {
  12.  
  13. case 2: //this is for slicing the type of 1d
  14.  
  15. g_time = duration.slice(0,1);
  16.  
  17. duration_type = duration.slice(1,2);
  18.  
  19. break;
  20.  
  21.  
  22.  
  23. case 3: //this is for slicing the type of 10d,10h,10m
  24.  
  25. g_time = duration.slice(0,2);
  26.  
  27. duration_type = duration.slice(2,3);
  28.  
  29. break;
  30.  
  31. default:
  32.  
  33. ErrorMessage( "Invalid Duration", player );
  34. }
  35.  
  36. local g_time_, g_duration_type_;
  37.  
  38. switch( duration_type )
  39.  
  40. {
  41.  
  42. case "d":
  43.  
  44. g_time_ = g_time.tointeger() * 86400;
  45.  
  46. g_duration_type_ = "day(s)";
  47.  
  48. break;
  49.  
  50.  
  51.  
  52. default:
  53.  
  54. SendMessage( "Invalid format, the format you typed is wrong", player );
  55.  
  56. }
  57.  
  58. if ( g_time.tointeger() > 0 )
  59.  
  60. {
  61.  
  62. local cost = g_time.tointeger() * 30000;
  63.  
  64. if ( player.Cash >= cost )
  65.  
  66. {
  67.  
  68. local dur = g_time + " " + g_duration_type_;
  69.  
  70. SendMessage( "[VIP] - You have purchased the vip pack $" + cost + " for " + dur + ".", player );
  71.  
  72.  
  73.  
  74. QuerySQL(db, "INSERT INTO VIP ( Name, Time, TimeExp ) VALUES ( '"+player.Name+"', '"+time()+"', '"+g_time+"'" );
  75.  
  76.  
  77.  
  78. DecCash( player, cost );
  79.  
  80. status[ player.ID ].VIP = true;
  81.  
  82. status[ player.ID ].VIPExp = g_time;
  83.  
  84. }
  85.  
  86. else ErrorMessage( "You need $" + cost + " to buy VIP for " + g_time + " days.", player );
  87.  
  88. }
  89.  
  90. else ErrorMessage( "The duration day should be more than 0.", player );
  91.  
  92. }
Add Comment
Please, Sign In to add comment