· 9 years ago · Dec 05, 2016, 05:24 PM
1QuerySQL(db, "CREATE TABLE IF NOT EXISTS VIP(Name TEXT, Time NUMERIC DEFAULT 0, TimeExp NUMERIC DEFAULT 0 ) );
2
3
4
5
6
7function VIP( player, duration )
8{
9local g_time, duration_type;
10switch( duration.len() )
11{
12case 2: //this is for slicing the type of 1d
13g_time = duration.slice(0,1);
14duration_type = duration.slice(1,2);
15break;
16}
17local g_time_, g_duration_type_;
18switch( duration_type )
19{
20case "d":
21g_time_ = g_timeexp.tointeger() * 86400;
22g_duration_type_ = "day(s)";
23break;
24
25default:
26SendMessage( "Invalid format, the format you typed is wrong", player );
27}
28local dur = g_time + " " + g_duration_type_;
29SendMessage( "[VIP] - You have purchased the vip pack for " + dur + ".", player );
30QuerySQL(db, "INSERT INTO VIP ( Name, Time, TimeExp ) VALUES ( '"+player.Name+"', '"+time()+"', '"+g_timeexp_+"'" );
31}