jlalt

Hardware ban

Jan 15th, 2016
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.13 KB | None | 0 0
  1. #include a_samp
  2. #include a_mysql
  3. #include sscanf2
  4. #include zcmd
  5. native gpci (playerid, serial [], len);
  6. new mysql;
  7. public OnFilterScriptInit() {
  8.    mysql = mysql_connect("HOST","USER","DATABASE","PASSWORD");
  9.    if(mysql_errno(mysql) != 0)
  10.    {
  11.    print("Could not connect to database!");
  12.    }
  13.    else
  14.    {
  15.    new Query[250];
  16.    print("  Successfully connected on DB ");
  17.    format(Query,sizeof(Query),"CREATE TABLE IF NOT EXISTS gpci(Name VARCHAR(128), gpci VARCHAR(256) )");
  18.    mysql_tquery(mysql, Query, "", "");
  19.    }
  20.    return 1;
  21. }
  22. public OnPlayerConnect(playerid) {
  23.    new gpcis[256],Query[250];
  24.    gpci(playerid,gpcis,sizeof(gpcis));
  25.    mysql_format(mysql, Query, sizeof Query,"SELECT * FROM `gpci` WHERE `gpci` = '%s'",gpcis);
  26.    return mysql_tquery(mysql, Query, "gpcicheck", "i", playerid);
  27. }
  28.  
  29. forward gpcicheck(playerid);
  30. public gpcicheck(playerid) {
  31.    new rows,fields;
  32.    cache_get_data(rows, fields, mysql);
  33.    if(rows) {
  34.      new serial[256],string[360];
  35.      cache_get_field_content(0, "gpci", serial, mysql, 256);
  36.      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\
  37.      {FF0000}Your topic should be made on 'Unban Appeals'.");
  38.      ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX,"Hardware ID Banned!",string,"ok","");
  39.    }
  40. }
  41. CMD:rban(playerid,params[]) {
  42.    if(IsPlayerAdmin(playerid)) {
  43.      new id,gpcis[256],Query[250],pname[MAX_PLAYER_NAME+1];
  44.      if(sscanf(params,"i",id)) return SendClientMessage(playerid,-1,"Usage: /rban [playerid]");
  45.      if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-1,"ERROR: Player is not connected!");
  46.      gpci(id,gpcis,sizeof(gpcis));
  47.      GetPlayerName(id,pname,sizeof pname);
  48.      mysql_format(mysql,Query, sizeof(Query),"INSERT INTO `gpci`(`Name`,`gpci`) VALUES ('%s','%s')",pname,gpcis);
  49.      mysql_tquery(mysql, Query, "", "");
  50.      SendClientMessage(playerid,-1,"You have success fully hardwire ban this player!");
  51.      return Kick(id);
  52.    } else return SendClientMessage(playerid,-1,"ERROR: You need to be rcon to use this command");
  53. }
Advertisement
Add Comment
Please, Sign In to add comment