· 9 years ago · Dec 05, 2016, 05:38 PM
1QuerySQL(db, "CREATE TABLE IF NOT EXISTS VIP(Name TEXT, Time NUMERIC DEFAULT 0, TimeExp NUMERIC DEFAULT 0 ) );
2
3
4VIP = false;
5VIPExp = 0;
6
7
8else if ( cmd == "buyvip")
9{
10if ( status[ player.ID ].Registered == false ) ErrorMessage( "[#FFFFFF]You need to be a part of our community to use this command.", player );
11else if ( status[ player.ID ].Logged == false ) ErrorMessage( "[#FFFFFF]You need to be identified to use this command.", player );
12else if ( !text ) ErrorMessage( "Syntax: /" + cmd + " <days>", player );
13else if ( IsNoob( player, cmd ) ) return 0;
14else
15{
16local duration = duration(GetTok( text, " ", 1));
17if (!duration) ErrorMessage( "Syntax: /" + cmd + " <days>", player );
18 else
19{
20VIP( player, duration);
21 }
22}
23 }
24
25
26
27
28function VIP( player, duration )
29{
30local g_time, duration_type;
31switch( duration.len() )
32{
33case 2: //this is for slicing the type of 1d
34g_time = duration.slice(0,1);
35duration_type = duration.slice(1,2);
36break;
37
38case 3: //this is for slicing the type of 10d,10h,10m
39g_time = duration.slice(0,2);
40duration_type = duration.slice(2,3);
41break;
42}
43default:
44ErrorMessage( "Invalid Duration", player );
45{
46local g_time_, g_duration_type_;
47switch( duration_type )
48{
49case "d":
50g_time_ = g_timeexp.tointeger() * 86400;
51g_duration_type_ = "day(s)";
52break;
53
54default:
55SendMessage( "Invalid format, the format you typed is wrong", player );
56}
57local dur = g_time + " " + g_duration_type_;
58SendMessage( "[VIP] - You have purchased the vip pack for " + dur + ".", player );
59QuerySQL(db, "INSERT INTO VIP ( Name, Time, TimeExp ) VALUES ( '"+player.Name+"', '"+time()+"', '"+g_timeexp_+"'" );
60}
61}