Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //#############################################################
- //Serial Ban Filterscript
- //Written by GWX from http://forum.sa-mp.com
- //Profile Link: http://forum.sa-mp.com/member.php?u=193359
- //#############################################################
- // This program is free software: you can redistribute it and/or modify
- // it under the terms of the GNU General Public License as published by
- // the Free Software Foundation, either version 3 of the License, or
- // (at your option) any later version.
- //
- // This program is distributed in the hope that it will be useful,
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- // GNU General Public License for more details.
- //
- // You should have received a copy of the GNU General Public License
- // along with this program. If not, see <http://www.gnu.org/licenses/>.
- //#############################################################
- #include <a_samp>
- #include <sscanf2>
- #define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
- native gpci(playerid, serial[], maxlen);
- new Location[100] = "/Serial_Bans/%s.lock";
- public OnPlayerConnect(playerid)
- {
- new Code[50], Line[256];
- gpci(playerid, Code, sizeof Code);
- format(Line, sizeof(Line), Location, Code);
- if(fexist(Line)) return Kick(playerid);
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- dcmd(Ban, 3, cmdtext);
- dcmd(Code, 4, cmdtext);
- return 0;
- }
- dcmd_Ban(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return 0;
- new Code[50], Line[128], User, Nickname[MAX_PLAYER_NAME];
- if(sscanf(params, "u", User)) return SendClientMessage(playerid, 0xFF0000FF, "{FF0000}Command:{FF0000} {FFFFFF}/Ban <Nickname / ID>{FFFFFF}");
- if(!IsPlayerConnected(User)) return SendClientMessage(playerid, 0xFF0000FF, "User was not fount. Please check input data.");
- gpci(User, Code, sizeof(Code));
- format(Line, sizeof(Line), Location, Code);
- GetPlayerName(User, Nickname, sizeof(Nickname));
- new File:Datoteka = fopen(Line, io_write);
- fwrite(Datoteka, Nickname);
- fclose(Datoteka);
- Kick(User);
- SendClientMessage(playerid, 0xFFFFFF, "User was sucesefully added to ban list and kicked from server.");
- return 1;
- }
- dcmd_Code(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return 0;
- new Code[50], Line[128], User;
- if(sscanf(params, "u", User)) return SendClientMessage(playerid, 0xFF0000FF, "{FF0000}Komanda:{FF0000} {FFFFFF}/Code <Nickname / ID>{FFFFFF}");
- if(!IsPlayerConnected(User)) return SendClientMessage(playerid, 0xFF0000FF, "User was not fount. Please check input data.");
- gpci(User, Code, sizeof(Code));
- format(Line, sizeof(Line), "User Serial: %s", Code);
- SendClientMessage(playerid, 0xFFFFFF, Line);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement