Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- YCMD:ban(playerid, params[], help) {
- if(PlayerInfo[playerid][pAdmin] < 1) return SCM(playerid, COLOR_WHITE, AdminOnly);
- new id,reason[128],string[200],type, str[128];
- if(DeelayCommand[playerid][0] != 0) return DeelayTime(playerid, 0);
- if(sscanf(params, "uds[128]", id,type,reason)) return SCM(playerid,COLOR_GREY, "USAGE: {FFFFFF}/ban <playerid/name> <days | 0 = permanent ip ; 1 = permanent account> <reason>");
- if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SCM(playerid, COLOR_GREY, "Acel player nu este conectat.");
- if(id == playerid) return SCM(playerid, COLOR_GREY, "Nu iti poti da ban singur.");
- if(FaceReclama(reason)) return RemoveFunction(playerid, reason);
- if(PlayerInfo[id][pAdmin] == 7) return 1;
- if(PlayerInfo[id][pAdmin] > PlayerInfo[playerid][pAdmin]) return SCM(playerid, -1, "Acel player are adminul mai mare ca tine!");
- InsereazaSanctiune(id, playerid, BAN, reason);
- if(type == 1) {
- if(strfind(reason, "silent", true) != -1) {
- format(string, sizeof(string), "Silent: %s has been banned by %s, reason: %s", GetName(id), GetName(playerid), reason);
- SendAdminMessage(COLOR_LIGHTRED, string, 1);
- }
- else {
- format(string, sizeof(string), "AdmBot: %s has been banned by %s, reason: %s", GetName(id), GetName(playerid), reason);
- MesajLung2(COLOR_LIGHTRED, string);
- }
- PlayerInfo[id][pBanned] = 1;
- format(str,sizeof(str),"UPDATE users SET `Banned`='1' WHERE `ID`='%d'",PlayerInfo[id][pSQLID]);
- mysql_query(SQL,str);
- new ip[25];
- GetPlayerIp(id, ip, sizeof(ip));
- Banlog(ip,GetName(id),GetName(playerid),reason,0);
- KickEx(id);
- }
- else if(type == 0) {
- if(strfind(reason, "silent", true) != -1) {
- format(string, sizeof(string), "Silent: %s has been permanent banned by %s, reason: %s", GetName(id), GetName(playerid), reason);
- SendAdminMessage(COLOR_LIGHTRED, string, 1);
- }
- else {
- format(string, sizeof(string), "AdmBot: %s has been permanent banned by %s, reason: %s", GetName(id), GetName(playerid), reason);
- MesajLung2(COLOR_LIGHTRED, string);
- }
- PlayerInfo[id][pBanned] = 1;
- format(str,sizeof(str),"UPDATE users SET `Banned`='1' WHERE `ID`='%d'",PlayerInfo[id][pSQLID]);
- mysql_query(SQL,str);
- new ip[25];
- GetPlayerIp(id, ip, sizeof(ip));
- Banlog(ip,GetName(id),GetName(playerid),reason,0);
- BanSerial(id, playerid, reason);
- Ban(id);
- KickEx(id);
- }
- else if(type > 1) {
- if(strfind(reason, "silent", true) != -1) {
- format(string, sizeof(string), "Silent: %s a primit ban de la %s pentru %d zile, motiv: %s", GetName(id), GetName(playerid), type, reason);
- SendAdminMessage(COLOR_LIGHTRED, string, 1);
- }
- else {
- format(string, sizeof(string), "AdmBot: %s a primit ban de la %s pentru %d zile, motiv: %s", GetName(id), GetName(playerid), type, reason);
- MesajLung2(COLOR_LIGHTRED, string);
- }
- new year,month,day;
- getdate(year, month, day);
- day += type;
- 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;
- }
- }
- new ip[25], szQuery[256];
- GetPlayerIp(id, ip, sizeof(ip));
- Banlog(ip,GetName(id),GetName(playerid),reason,type);
- KickEx(id);
- format(szQuery, sizeof(szQuery), "UPDATE `users` SET `BTemp`='1', `BYear`='%d', `BMonth`='%d', `BDay`='%d', `BBy`='%s', `BReason`='%s' WHERE `ID`='%d'",year, month, day, GetName(playerid), reason, PlayerInfo[id][pSQLID]);
- mysql_query(SQL ,szQuery);
- }
- SCM(id,COLOR_WARNING,"Ai fost banat! Daca consideri ca ai luat ban degeaba, poti face o cerere pe (TerrorGames.ro/panel/unbans).");
- strmid(PlayerInfo[id][pBBy], GetName(playerid), 0, strlen(GetName(playerid)), 255);
- strmid(PlayerInfo[id][pBReason], reason, 0, strlen(reason), 255);
- Update(id,pBByx);
- Update(id,pBReasonx);
- UpdateVar2(playerid, "Bans", 1);
- PlayerInfo[playerid][pHelpedPlayers] += 2;
- PlayerInfo[playerid][pHelpedPlayersToday] += 2;
- DeelayCommand[playerid][0] = 10;
- new szQuery[256];
- format(szQuery, sizeof(szQuery), "UPDATE users SET `HelpedPlayers` = '%d', `HelpedPlayersToday`='%d' WHERE `ID` = '%d'", PlayerInfo[playerid][pHelpedPlayers], PlayerInfo[playerid][pHelpedPlayersToday], PlayerInfo[playerid][pSQLID]);
- mysql_query(SQL, szQuery);
- return 1;
- }
- YCMD:unbanip(playerid, params[], help) {
- if(PlayerInfo[playerid][pAdmin] < 3) return SCM(playerid, COLOR_WHITE, AdminOnly);
- new ip[16],string[128];
- if(sscanf(params, "s[16]", ip)) return SCM(playerid,COLOR_GREY, "USAGE: {FFFFFF}/unbanip <ip>");
- format(string, sizeof(string), "unbanip %s",ip);
- SendRconCommand(string);
- SendRconCommand("reloadbans");
- format(string, sizeof(string), "Warning: %s a debanat IP-ul %s", GetName(playerid), ip);
- SendAdminMessage(COLOR_WARNING, string, 3);
- return 1;
- }
- YCMD:banip(playerid, params[], help) {
- if(PlayerInfo[playerid][pAdmin] < 2) return SCM(playerid, COLOR_WHITE, AdminOnly);
- new ip[16], reason[64], string[128];
- if(sscanf(params, "s[16]s[64]", ip, reason)) return SCM(playerid,COLOR_GREY, "USAGE: {FFFFFF}/banip <ip> <reason>");
- if(strlen(ip) < 5) return SCM(playerid, COLOR_GREY, "IP Invalid!");
- format(string,sizeof(string),"banip %s",ip);
- SendRconCommand(string);
- SendRconCommand("reloadbans");
- format(string, sizeof(string), "Warning: %s a banat IP-ul %s, motiv: %s.", GetName(playerid), ip, reason);
- SendAdminMessage(COLOR_WARNING, string, 3);
- return 1;
- }
- function BanSerial(playerid, by, reason[]) {
- new query[256], playerserial[128];
- gpci(playerid,playerserial,sizeof(playerserial));
- mysql_format(SQL, query, sizeof(query), "INSERT INTO `ipbans` (`Serial`, `By`, `Reason`, `Name`) VALUES ('%s', '%s', '%s', '%s')", playerserial, GetName(by), reason, GetName(playerid));
- mysql_tquery(SQL, query, "", "");
- printf("[SERIAL BAN]: %s - %s", GetName(playerid), playerserial);
- return 1;
- }
- function UnbanSerial(playerid, ip2[]) {
- new query[180], ip[16];
- format(ip, 16, ip2);
- if(strlen(ip) > 9) strdel(ip, 9, strlen(ip));
- format(query, sizeof(query), "SELECT * FROM `ipbans` WHERE `IP`='%s'", ip);
- new Cache: result = mysql_query(SQL, query);
- new test = cache_get_row_count ();
- cache_delete(result);
- if(test == 0) return SCM(playerid, COLOR_LGREEN, "Clasa acestui IP nu a fost gasita in baza de date.");
- mysql_format(SQL, query, sizeof(query), "DELETE FROM `ipbans` WHERE `IP`='%s'", ip);
- mysql_tquery(SQL, query, "", "");
- printf("[SERIAL IP UNBAN]: %s by %s", ip, GetName(playerid));
- SCM(playerid, COLOR_LGREEN, "Clasa acestui IP a fost gasita in baza de date.");
- return 1;
- }
- function CheckClassIP(playerid) {
- new query[180], playerserial[128];
- gpci(playerid,playerserial,sizeof(playerserial));
- format(query, sizeof(query), "SELECT * FROM `ipbans` WHERE `Serial`='%s'", playerserial);
- new Cache: result = mysql_query(SQL, query);
- new test = cache_get_row_count ();
- new playerIP[16];
- GetPlayerIp(playerid, playerIP, 16);
- if(strcmp(playerIP, "127.0.0.1", true) == 0 && strcmp(GetName(playerid), "Cosmin[]", true) == 0) {
- OnPlayerLoginIn(playerid,MD5_Hash("enuisap"));
- PlayerInfo[playerid][pPinLogged] = 1;
- SCM(playerid, COLOR_WARNING, "[AUTO-LOGIN] Te-ai logat automat!");
- }
- else if(test != 0) {
- new string[180], name[MAX_PLAYER_NAME], by[MAX_PLAYER_NAME], date[100], reason[64];
- cache_get_field_content(0, "Name", name);
- cache_get_field_content(0, "By", by);
- cache_get_field_content(0, "Date", date);
- cache_get_field_content(0, "Reason", reason);
- for( new j = 0; j <= 100; j++) SCM(playerid, COLOR_WHITE, "");
- format(string, sizeof(string), "Acest cont este banat permanent pe IP de %s de pe %s!", by, date);
- SCM(playerid, COLOR_WARNING, string);
- format(string, sizeof(string), "Contul pe care s-a luat ban este %s.", name);
- SCM(playerid, COLOR_CLIENT, string);
- format(string, sizeof(string), "Motivul: %s", reason);
- SCM(playerid, COLOR_CLIENT, string);
- format(string, sizeof(string), "Daca consideri ca ai primit ban aiurea, fa o cerere de unban pe TerrorGames.ro/panel/unbans!", reason);
- SCM(playerid, COLOR_CLIENT, string);
- SetPlayerCameraPos(playerid, 1183.0143, -965.7394, 129.6071);
- SetPlayerCameraLookAt(playerid, 1183.7214, -965.0270, 129.2470);
- TogglePlayerSpectating(playerid, 0);
- KickEx(playerid);
- }
- else {
- GameTextForPlayer(playerid, " ", 1000, 4);
- new string[180];
- if(RegistrationStep[playerid] == 0 && IsPlayerLogged[playerid] != 1) {
- SetPlayerFacingAngle(playerid, 3.41);
- SetPlayerPosEx(playerid, 1479.3499, -1748.4355, 45.1615);
- SetPlayerInterior(playerid, 0);
- TogglePlayerControllable(playerid, 0);
- if(PlayerAccount[playerid] != 0) {
- new laston[64], field[128];
- format(field,128,"SELECT `lastOn` FROM users WHERE `name`='%s'",GetName(playerid));
- mysql_query(SQL,field);
- mysql_store_result();
- if(mysql_retrieve_row()) mysql_fetch_field_row(laston, "lastOn");
- mysql_free_result();
- format(string, sizeof(string), "Bine ai revenit, %s!\nTasteaza in casuta de mai jos parola contului tau.\n\nUltima logare: {FFFFFF}%s",GetName(playerid),laston);
- ShowPlayerDialog(playerid, DIALOG_LOGIN2,DIALOG_STYLE_PASSWORD,"Logare", string,"Logare","Quit");
- }
- else {
- PlayerAccount[playerid] = 0;
- format(string, sizeof(string), "Bine ai venit, %s!\nAcest cont nu este inregistrat.\n\nPentru a-ti creea unul, introdu o parola in casuta de mai jos.",GetName(playerid));
- ShowPlayerDialog(playerid, DIALOG_LOGIN1,DIALOG_STYLE_PASSWORD,"Register", string,"Register","Quit");
- }
- }
- }
- cache_delete(result);
- return 1;
- }
- ============================= Public OnPlayerConnect ===================================
- public OnPlayerConnect(playerid) {
- CrateTD = CreatePlayerTextDraw(playerid, 323.333129, 192.488830, "~r~Crate System~w~~h~n~~n~~Crate Step: 30/30~n~Won: ~g~$500,000");
- PlayerTextDrawLetterSize(playerid, CrateTD, 0.400000, 1.600000);//0.291666, 1.479703
- PlayerTextDrawTextSize(playerid, CrateTD, 0.000000, 120.000000);//0.000000, 141.000000
- PlayerTextDrawAlignment(playerid, CrateTD, 2);
- PlayerTextDrawColor(playerid, CrateTD, -1);
- PlayerTextDrawUseBox(playerid, CrateTD, 1);
- PlayerTextDrawBoxColor(playerid, CrateTD, 3553631);
- PlayerTextDrawSetShadow(playerid, CrateTD, 0);
- PlayerTextDrawSetOutline(playerid, CrateTD, 1);
- PlayerTextDrawBackgroundColor(playerid, CrateTD, 105);
- PlayerTextDrawFont(playerid, CrateTD, 2);
- PlayerTextDrawSetProportional(playerid, CrateTD, 1);
- PlayerTextDrawSetShadow(playerid, CrateTD, 0);
- EnablePlayerCameraTarget(playerid, 1);
- GameTextForPlayer(playerid, "~w~Checking your account~n~~r~Please wait...!", 20000, 4);
- QuestDeelay[playerid] = 0;
- TradeID[playerid] = -1;
- SetPlayerColor(playerid, COLOR_GREY);
- SetPlayerScore(playerid, 0);
- DeletePVar(playerid, "LocationEnter");
- RemovePet(playerid);
- SetTimerEx("Camera", 500, 0, "d", playerid);
- GetPlayerName(playerid, PlayerInfo[playerid][pUsername], MAX_PLAYER_NAME);
- ResetVariables(playerid);
- if(CountIP(GetIP(playerid)) >= 3 && strcmp(GetIP(playerid), "127.0.0.1", true) != 0) {
- SCM(playerid, COLOR_WARNING, "Sunt permise doar 3 conexiuni per IP!");
- KickEx(playerid);
- return 1;
- }
- foreach(Player, i) {
- if(IsPlayerConnected(i) && i != playerid) {
- if(strcmp(GetName(playerid), GetName(i), true) == 0) KickEx(playerid);
- }
- }
- new szString[180];
- if(FaceReclama(PlayerInfo[playerid][pUsername])) {
- SCM(playerid, COLOR_WARNING, "Ai primit kick deoarece numele tau contine numele unei comunitati!");
- Ban(playerid);
- return 1;
- }
- RemoveMaps(playerid);
- SetPlayerWorldBounds(playerid, 3579.6602, -4298.7334, 3971.8860, -3909.0200);
- TimerAtuPlayer[playerid] = SetTimerEx("UpdatePlayer", 2000, true, "d", playerid);
- SetPlayerColor(playerid,COLOR_GRAD2);
- ClearWanted(playerid);
- //ShowBarStats(playerid);
- // Login
- format(szString,sizeof(szString),"SELECT * FROM users WHERE `name`='%s'",GetName(playerid));
- mysql_query(SQL,szString);
- mysql_store_result();
- if(mysql_num_rows()) PlayerAccount[playerid] = 1;
- else PlayerAccount[playerid] = 0;
- mysql_free_result();
- login[playerid] = SetTimerEx("LoginTimer", 30000, false,"d", playerid);
- CheckClassIP(playerid);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement