Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enum PlayerStatistics
- {
- VipTime, // This is used for a Pvar
- };
- public OnPlayerConnect(playerid)
- {
- new file[256];
- format(file, sizeof(file), "Accounts/%s.ini", GetName(playerid));
- if(dini_Exists(file))
- {
- Player[playerid][VipTime] = dini_Int(file, "VipTime");
- SetPVarInt(playerid, "VipTime", Player[playerid][VipTime]);
- }
- return 1;
- }
- command(buddyinvite, playerid, params[])
- {
- new id, string[256];
- if(sscanf(params, "u", id))
- {
- SendClientMessage(playerid, WHITE, "SYNTAX: /buddyinvite [playerid]");
- SendClientMessage(playerid, WHITE, "This feature is only available to gold vip or above!");
- }
- else
- {
- if(Player[playerid][VipRank] >= 4)
- {
- if(IsPlayerConnectedEx(id))
- {
- if(Player[playerid][VipRank] < 1)
- {
- format(string, sizeof(string), "** %s has buddy-invited you! You are now a bronze vip for one hour.", GetName(playerid));
- SendClientMessage(id, NICESKY, string);
- format(string, sizeof(string), "** You have buddy-invited %s!", GetName(id));
- SendClientMessage(playerid, NICESKY, string);
- SetPVarInt(playerid, "VipTime", 3600);
- Player[id][VipRank] = 1;
- }
- else SendClientMessage(playerid, GREy, "You cannot buddy-invite a vip!");
- }
- else SendClientMessage(playerid, GREy, "That user is not connected!"); }
- }
- return 1;
- }
- public OneSecondPublic()
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(gettime() > GetPVarInt(i, "VipTime"))
- {
- SendClientMessage(i, YELLOW, "Your buddy-invite has expired.");
- Player[i][VipRank] = 0;
- }
- }
- return 1;
- }
Add Comment
Please, Sign In to add comment