Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include a_samp
- #include a_mysql
- #include sscanf2
- #include zcmd
- native gpci (playerid, serial [], len);
- new mysql;
- public OnFilterScriptInit() {
- mysql = mysql_connect("HOST","USER","DATABASE","PASSWORD");
- if(mysql_errno(mysql) != 0)
- {
- print("Could not connect to database!");
- }
- else
- {
- new Query[250];
- print(" Successfully connected on DB ");
- format(Query,sizeof(Query),"CREATE TABLE IF NOT EXISTS gpci(Name VARCHAR(128), gpci VARCHAR(256) )");
- mysql_tquery(mysql, Query, "", "");
- }
- return 1;
- }
- public OnPlayerConnect(playerid) {
- new gpcis[256],Query[250];
- gpci(playerid,gpcis,sizeof(gpcis));
- mysql_format(mysql, Query, sizeof Query,"SELECT * FROM `gpci` WHERE `gpci` = '%s'",gpcis);
- return mysql_tquery(mysql, Query, "gpcicheck", "i", playerid);
- }
- forward gpcicheck(playerid);
- public gpcicheck(playerid) {
- new rows,fields;
- cache_get_data(rows, fields, mysql);
- if(rows) {
- new serial[256],string[360];
- cache_get_field_content(0, "gpci", serial, mysql, 256);
- format(string,sizeof string,"{FF0000}Your Hardware ID is Banned!\n{FF0000}Serial: {FFFFFF}%s\n{FF0000}if that's a mistake take a picture of this screen and make topic on our forums.\n\
- {FF0000}Your topic should be made on 'Unban Appeals'.");
- ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX,"Hardware ID Banned!",string,"ok","");
- }
- }
- CMD:rban(playerid,params[]) {
- if(IsPlayerAdmin(playerid)) {
- new id,gpcis[256],Query[250],pname[MAX_PLAYER_NAME+1];
- if(sscanf(params,"i",id)) return SendClientMessage(playerid,-1,"Usage: /rban [playerid]");
- if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-1,"ERROR: Player is not connected!");
- gpci(id,gpcis,sizeof(gpcis));
- GetPlayerName(id,pname,sizeof pname);
- mysql_format(mysql,Query, sizeof(Query),"INSERT INTO `gpci`(`Name`,`gpci`) VALUES ('%s','%s')",pname,gpcis);
- mysql_tquery(mysql, Query, "", "");
- SendClientMessage(playerid,-1,"You have success fully hardwire ban this player!");
- return Kick(id);
- } else return SendClientMessage(playerid,-1,"ERROR: You need to be rcon to use this command");
- }
Advertisement
Add Comment
Please, Sign In to add comment