SHARE
TWEET

Untitled

a guest Jul 21st, 2017 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CMD:login(playerid, params[])
  2. {
  3.     new sscanfinput[64], string[128];
  4.     if(sscanf(params, "s[64]", sscanfinput)) return SendClientMessage(playerid, COLOR_PURPLE, "<> /Login (Password)");
  5.     new Escape[2][MAX_PLAYER_NAME];
  6.     mysql_real_escape_string(Playername(playerid), Escape[0]);
  7.     mysql_real_escape_string(sscanfinput, Escape[1]);
  8.     format(string, 128, "SELECT * FROM `Accounts` WHERE Username = '%s' AND Password = '%s'", Escape[0], Escape[1]);
  9.     mysql_query(string);
  10.     mysql_query_callback(playerid,string,"OnUserLogin");
  11.     return 1;
  12. }
  13.  
  14. forward OnUserLogin(query[], index, extraid, connectionHandle);
  15. public OnUserLogin(query[], index, extraid, connectionHandle)
  16. {
  17.     if(IsPlayerConnected(index))
  18.     {
  19.         mysql_store_result();
  20.         if(mysql_num_rows() == 1)
  21.         {
  22.             IsLogged[index] = 1;
  23.             SendClientMessageFormatted(index,LIME,"|- You Have Successfully Logged In As {A82FED}%s {FFFFFF}-|", Playername(index));
  24.             LoadPlayerAccount(index);
  25.             printf("%s Has Logged In",Playername(index));
  26.             mysql_free_result();
  27.         }
  28.         else
  29.         {
  30.             mysql_free_result();
  31.             SendClientMessage(index, RED, "Your Password Is Incorrect Or Your Account Does Not Exist.");
  32.             SetPVarInt(index, "WrongPass", GetPVarInt(index, "WrongPass") + 1);
  33.             ShowPlayerDialog(index, LoginDialog, DIALOG_STYLE_INPUT , "Login", "This account is registered, please login", "OK", "Cancel");
  34.             if(GetPVarInt(index, "WrongPass") == 3)
  35.             {
  36.                 SendClientMessage(index, 0xF60000AA, "Max Password Tries Exceeded!,You Have BEen Kicked From The Server!");
  37.                 SafeKick(index,"Failing To Login");
  38.             }
  39.         }
  40.     }
  41.     else
  42.     {
  43.         mysql_store_result();
  44.         mysql_free_result();
  45.     }
  46.     return 1;
  47. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top