Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function VIP( player, duration )
- {
- local g_time, duration_type;
- switch( duration.len() )
- {
- case 2: //this is for slicing the type of 1d
- g_time = duration.slice(0,1);
- duration_type = duration.slice(1,2);
- break;
- case 3: //this is for slicing the type of 10d,10h,10m
- g_time = duration.slice(0,2);
- duration_type = duration.slice(2,3);
- break;
- default:
- ErrorMessage( "Invalid Duration", player );
- }
- local g_time_, g_duration_type_;
- switch( duration_type )
- {
- case "d":
- g_time_ = g_time.tointeger() * 86400;
- g_duration_type_ = "day(s)";
- break;
- default:
- SendMessage( "Invalid format, the format you typed is wrong", player );
- }
- if ( g_time.tointeger() > 0 )
- {
- local cost = g_time.tointeger() * 30000;
- if ( player.Cash >= cost )
- {
- local dur = g_time + " " + g_duration_type_;
- SendMessage( "[VIP] - You have purchased the vip pack $" + cost + " for " + dur + ".", player );
- QuerySQL(db, "INSERT INTO VIP ( Name, Time, TimeExp ) VALUES ( '"+player.Name+"', '"+time()+"', '"+g_time+"'" );
- DecCash( player, cost );
- status[ player.ID ].VIP = true;
- status[ player.ID ].VIPExp = g_time;
- }
- else ErrorMessage( "You need $" + cost + " to buy VIP for " + g_time + " days.", player );
- }
- else ErrorMessage( "The duration day should be more than 0.", player );
- }
Add Comment
Please, Sign In to add comment