Код:
CMD: setdonator(playerid, params[]) {
if(PlayerInfo[playerid][pAdmin] >= 6) {
new string[128], giveplayerid, level;
if(sscanf(params, "ud", giveplayerid, level)) {
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setdonator [player] [level]");
SendClientMessage(playerid, COLOR_GRAD3, "Available Levels: |0| None |1| Pearl Donator |2| Emerald Donator |3| Diamond Donator");
return 1;
}
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(level < 0 || level > 3)
{
SendClientMessage(playerid, COLOR_GRAD1, "Donator Level can't be below 0 or above 3!");
return 1;
}
PlayerInfo[giveplayerid][pDonator] = level;
new playerip[32];
GetPlayerIp(giveplayerid, playerip, sizeof(playerip));
if(level == 0)
{
format(string, sizeof(string), "AdmCmd: %s has set %s's donator level to None (%d).", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), level);
ABroadCast(COLOR_LIGHTRED,string, 4);
format(string, sizeof(string), "Your donator level has been set to None by Admin %s.", GetPlayerNameEx(playerid));
SendClientMessage(giveplayerid, COLOR_WHITE, string);
format(string, sizeof(string), "AdmCmd: %s has set %s's (IP:%s) donator level to None (%d).", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), playerip, level);
Log("logs/setvip.log", string);
return 1;
}
if(level == 1)
{
PlayerInfo[giveplayerid][pDonatorExpire] = gettime()+2592000;
format(string, sizeof(string), "AdmCmd: %s has set %s's donator level to Pearl Donator (%d).", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), level);
ABroadCast(COLOR_LIGHTRED,string, 4);
format(string, sizeof(string), "Your donator level has been set to Pearl Donator by Admin %s.", GetPlayerNameEx(playerid));
SendClientMessage(giveplayerid, COLOR_WHITE, string);
format(string, sizeof(string), "AdmCmd: %s has set %s's (IP:%s) donator level to Pearl Donator (%d).", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), playerip, level);
Log("logs/setvip.log", string);
return 1;
}
if(level == 2)
{
PlayerInfo[giveplayerid][pDonatorExpire] = gettime()+2592000;
format(string, sizeof(string), "AdmCmd: %s has set %s's donator level to Emerald Donator (%d).", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), level);
ABroadCast(COLOR_LIGHTRED,string, 4);
format(string, sizeof(string), "Your donator level has been set to Emerald Donator by Admin %s.", GetPlayerNameEx(playerid));
SendClientMessage(giveplayerid, COLOR_WHITE, string);
format(string, sizeof(string), "AdmCmd: %s has set %s's (IP:%s) donator level to Emerald Donator (%d).", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), playerip, level);
Log("logs/setvip.log", string);
return 1;
}
if(level == 3)
{
PlayerInfo[giveplayerid][pDonatorExpire] = gettime()+2592000;
format(string, sizeof(string), "AdmCmd: %s has set %s's donator level to Diamond Donator (%d).", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), level);
ABroadCast(COLOR_LIGHTRED,string, 4);
format(string, sizeof(string), "Your donator level has been set to Diamond Donator by Admin %s.", GetPlayerNameEx(playerid));
SendClientMessage(giveplayerid, COLOR_WHITE, string);
format(string, sizeof(string), "AdmCmd: %s has set %s's (IP:%s) donator level to Diamond Donator (%d).", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), playerip, level);
Log("logs/setvip.log", string);
return 1;
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
}
return 1;