- 0
Comanda /bano
-
Similar Content
-
- 2 answers
- 713 views
-
Am o problema cu un battlepass,de ce nu merge comanda /misiuni cand o scriu,tin sa precizez ca script-ul mi l-a facut chatgpt
By cbnmihaita,
- 2 answers
- 460 views
-
- 3 replies
- 593 views
-
Comanda /spec
By VAurel,
- 4 answers
- 815 views
-
- 3 replies
- 692 views
-
-
Recently Browsing 0 members
- No registered users viewing this page.
Question
TheGodfather
Salut, as vrea ca la comanda /bano, sa fac in asa fel incat daca un admin de nivel 1 sa nu poata da ban de exemplu unui admin 2 (cu level mai mare decat el). Cu /bano se pot bana jucatorii care nu sunt in joc, dupa numele din baza de date.
YCMD:bano(playerid, params[], help) {
new name[MAX_PLAYER_NAME];
if(PlayerInfo[playerid][pAdmin] < 1) return SCM(playerid,COLOR_WHITE,AdminOnly);
if(DeelayCommand[playerid][0] != 0) return DeelayTime(playerid, 0);
new giveplayerid[25],days,reason[128],string[128],cont;
if(sscanf(params, "s[25]ds[128]", giveplayerid, days,reason)) return SCM(playerid,COLOR_GREY, "Syntax: {FFFFFF}/bano <name> <0 = permanent/days> <reason>");
if(FaceReclama(reason)) return RemoveFunction(playerid, reason);
new userID = GetPlayerID( giveplayerid );
if(userID != INVALID_PLAYER_ID) return SCM(playerid, COLOR_GREY, "Acel jucator este deja conectat!");
cont = MySQLCheckAccount(giveplayerid);
if(cont == 0) return SCM(playerid,COLOR_ERROR,"Eroare:{FFFFFF} Acest cont nu a fost gasit in baza de date!");
GetPlayerName(playerid, name, sizeof name);
if(days > 0) {
new year,month,day;
getdate(year, month, day);
day += days;
if(IsMonth31(month)) {
if(day > 31) {
month += 1;
if(month > 12) {
year += 1;
while(day > 31) day -= 31;
}
else while(day > 31) day -= 31;
}
}
else if(!IsMonth31(month)) {
if(day > 30) {
month += 1;
if(month > 12) {
year += 1;
while(day > 30) day -= 30;
}
else while(day > 30) day -= 30;
}
}
else if(!IsMonth31(month) && IsMonth29(year) && month == 2) {
if(day > 29) {
month += 1;
if(month > 12) {
year += 1;
while(day > 29) day -= 29;
}
else while(day > 29) day -= 29;
}
}
else if(!IsMonth31(month) && !IsMonth29(year) && month == 2) {
if(day > 28) {
month += 1;
if(month > 12) {
year += 1;
while(day > 28) day -= 28;
}
else while(day > 28) day -= 28;
}
}
DeelayCommand[playerid][0] = 10;
if(days == 1) {
format(string,128,"Offline: %s has been banned by %s for %d days, reason: %s",giveplayerid,name,days,reason);
SCMTA(COLOR_LIGHTRED,string);
}
else if(days > 1) {
format(string,128,"Offline: %s has been banned by %s for %d days, reason: %s",giveplayerid,name,days,reason);
SCMTA(COLOR_LIGHTRED,string);
}
new szQuery[256];
mysql_format(SQL, szQuery, sizeof(szQuery), "UPDATE `users` SET `BTemp`='1', `BYear`='%d', `BMonth`='%d', `BDay`='%d', `BBy`='%s', `BReason`='%s' WHERE `name`='%s'",year, month, day, name, reason, giveplayerid);
mysql_tquery(SQL ,szQuery, "", "");
}
else if(days == 0) {
new szQuery[256];
mysql_format(SQL, szQuery,sizeof(szQuery),"UPDATE users SET `Banned`='1', `BBy`='%s', `BReason`='%s' WHERE `name`='%s'", GetName(playerid), reason, giveplayerid);
mysql_tquery(SQL,szQuery, "", "");
mysql_format(SQL, szQuery, sizeof(szQuery), "UPDATE users SET `HelpedPlayers` = '%d', `HelpedPlayersToday`='%d' WHERE `ID` = '%d'", PlayerInfo[playerid][pHelpedPlayers], PlayerInfo[playerid][pHelpedPlayersToday], PlayerInfo[playerid][pSQLID]);
mysql_tquery(SQL, szQuery, "", "");
if(strfind(reason, "Silent", true) != -1) {
format(string, sizeof(string), "Silent: %s (offline) has been banned by %s, reason: %s", giveplayerid, GetName(playerid),reason);
SendAdminMessage(COLOR_LIGHTRED, string, 1);
}
else {
format(string, sizeof(string), "Offline: %s has been permanent banned by %s, reason: %s", giveplayerid, GetName(playerid),reason);
SCMTA(COLOR_LIGHTRED, string);
}
}
else return true;
Banlog("Offline",giveplayerid,GetName(playerid),reason,days);
PlayerInfo[playerid][pHelpedPlayers] += 2;
PlayerInfo[playerid][pHelpedPlayersToday] += 2;
new szQuery[256];
mysql_format(SQL, szQuery, sizeof(szQuery), "UPDATE users SET `HelpedPlayers` = '%d', `HelpedPlayersToday`='%d' WHERE `ID` = '%d'", PlayerInfo[playerid][pHelpedPlayers], PlayerInfo[playerid][pHelpedPlayersToday], PlayerInfo[playerid][pSQLID]);
mysql_tquery(SQL, szQuery, "", "");
return true;
}
22 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now