Jump to content

CiJey

Membru
  • Posts

    1
  • Joined

  • Last visited

Profile Information

  • Level of knowledge
    Experimentat

CiJey's Achievements

Newbie

Newbie (1/14)

  • First Post
  • Conversation Starter
  • Week One Done
  • One Month Later
  • One Year In

Recent Badges

0

Reputation

  1. #include <a_samp> #include <a_mysql> new MySQL: sql; new PlayerLogged[MAX_PLAYERS]; #define DIALOG_REGISTER 0 #define DIALOG_LOGIN 1 stock GetName(playerid) { new playerName[24]; GetPlayerName(playerid, playerName, 24); return playerName; } public OnGameModeInit() { sql = mysql_connect("", "", "", ""); return 1; } public OnGameModeExit() { mysql_close(sql); return 1; } public OnPlayerConnect(playerid) { new query[128]; mysql_format(sql, query, 128, "SELECT * FROM `` WHERE `Name` = '%s' LIMIT 1", GetName(playerid)); mysql_query(sq;, query); if(cache_num_rows() == 0) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "", "", "", ""); if(cache_num_rows() > 0) return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "", "", "", ""); return 1; } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { switch(dialogid) { case DIALOG_REGISTER: { if(!response) return Kick(playerid); if(response) { if(strlen(inputtext) == 0) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "", "", "", ""); if(strlen(inputtext) > 0) { new query[256]; mysql_format(sql, query, 256, "INSERT INTO `` (`Name`, `Password`) VALUES ('%s', '%s')", GetName(playerid), inputtext); mysql_query(sql, query); PlayerLogged[playerid] = 1; } } } case DIALOG_LOGIN: { if(!response) return Kick(playerid); if(response) { new query[128]; mysql_format(sql, query, 128, "SELECT * FROM `` WHERE `Name` = '%s' AND `Password` = '%s' LIMIT 1", GetName(playerid), inputtext); mysql_query(sql, query); if(cache_num_rows() == 0) return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "", "", "", ""); if(cache_num_rows() > 0) { PlayerLogged[playerid] = 1; // Aici scrieti voi ce sa se intample dupa ce se logheaza. } } } } return 1; }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.