- 0
Comanda /bano
-
Similar Content
-
- 5 replies
- 54 views
-
Comanda /fly
By xLinix96,
- 4 replies
- 1,920 views
-
- 3 answers
- 107 views
-
- 1 reply
- 70 views
-
- 0 replies
- 78 views
-
-
Recently Browsing 0 members
- No registered users viewing this page.
By xLinix96,
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.
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;
}
Link to comment
Share on other sites
22 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.