funkcio OnAccountCheck(playerid){GetPlayerName(playerid,nev,sizeof(nev));format(query,MAX_STRING,\"SELECT userid FROM `\"#MYSQL_JATEKOS_TABLA\"` WHERE nev = \'%e\'\",nev); mysql_query(kapcsolat,query);mysql_store_result();new rows = cache_num_rows(); if(rows == 1) { new dest[64];cache_get_field_content(0, \"jelszo\", dest);format(PlayerInfo[playerid][Jelszo],64,dest); PlayerInfo[playerid][iD] = cache_get_field_content_int(0, \"userid\"); ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,\"Bejelentkezés\", \"Add meg a jelszavad!\", \"Mehet\", \"Mégse\"); } else { ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,\"Regisztráció\", \"Add meg a jelszavad!\", \"Mehet\", \"Mégse\"); } mysql_free_result(kapcsolat); return true;}
/*Navicat MySQL Data TransferSource Server : LocalhostSource Server Version : 50505Source Host : localhost:3306Source Database : regisztracioTarget Server Type : MYSQLTarget Server Version : 50505File Encoding : 65001Date: 2016-11-03 17:33:44*/SET FOREIGN_KEY_CHECKS=0;-- ------------------------------ Table structure for `felhasznalok`-- ----------------------------DROP TABLE IF EXISTS `felhasznalok`;CREATE TABLE `felhasznalok` ( `ID` int(11) NOT NULL AUTO_INCREMENT, `JatekosNev` varchar(24) NOT NULL DEFAULT \'Nincs\', `Jelszo` varchar(32) NOT NULL DEFAULT \'----\', `Penz` int(11) NOT NULL DEFAULT \'0\', PRIMARY KEY (`ID`)) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;-- ------------------------------ Records of felhasznalok-- ----------------------------INSERT INTO `felhasznalok` VALUES (\'1\', \'Her0ic\', \'A8F5F167F44F4964E6C998DEE827110C\', \'0\');
#include <a_samp>#include <a_mysql>#include <md5>new sql_ID;new adatok[128];#define mysql_get_int(%1,%2,%3) (%3 = cache_get_field_content_int(%1,%2))#define mysql_get_float(%1,%2,%3) (%3 = cache_get_field_content_float(%1,%2))#define mysql_get_string cache_get_field_content#define doQuery(%0,%1) mysql_tquery(sql_ID,(Format(adatok,(%0), %1), adatok),\"\",\"\")#define Format(%1,%2,%3) format(%1,sizeof(%1),(%2),%3)#define forpublic%0(%1) forward%0(%1); public%0(%1)main(){}enum{DIALOG_LOGIN,DIALOG_REG} public OnGameModeInit(){mysql_log(LOG_ERROR | LOG_WARNING | LOG_DEBUG, LOG_TYPE_TEXT); // Host User Adatbazis Jelszosql_ID = mysql_connect(\"localhost\",\"root\",\"regisztracio\",\"asdasd\");SetGameModeText(\"Alap Mysql es Regisztracio\");AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);return 1;}stock PlayerName(playerid){new nev[MAX_PLAYER_NAME];GetPlayerName(playerid,nev,MAX_PLAYER_NAME);return nev;}enum PlayerEnum {pBelepve,pPenz}new PlayerInfo[MAX_PLAYERS][PlayerEnum];public OnGameModeExit(){mysql_close(sql_ID);return 1;}public OnPlayerRequestClass(playerid, classid){TogglePlayerSpectating(playerid, true);if(PlayerInfo[playerid][pBelepve] == 0){new query[128];Format(query,\"SELECT * FROM felhasznalok WHERE JatekosNev=\'%s\'\",PlayerName(playerid));mysql_tquery(sql_ID,query,\"Belepes\",\"i\",playerid); }return 1;}forpublic Belepes(playerid){new nums,fields;cache_get_data(nums,fields);if(nums){SendClientMessage(playerid,-1,\"Be vagy Regisztrálva!\");ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,\"Belépés\",\"Írd be a jelszavad\",\"OK\",\"\");}else{SendClientMessage(playerid,-1,\"Nem vagy beregisztrálva!\");ShowPlayerDialog(playerid,DIALOG_REG,DIALOG_STYLE_INPUT,\"Regisztráció\",\"Írd be a jelszavad!\",\"OK\",\"\");}}public OnPlayerConnect(playerid){PlayerInfo[playerid][pBelepve] = 0;PlayerInfo[playerid][pPenz] = 0;return 1;}public OnPlayerDisconnect(playerid, reason){return 1;}public OnPlayerSpawn(playerid){return 1;}public OnPlayerDeath(playerid, killerid, reason){return 1;}public OnVehicleSpawn(vehicleid){return 1;}public OnVehicleDeath(vehicleid, killerid){return 1;}public OnPlayerText(playerid, text[]){return 1;}public OnPlayerCommandText(playerid, cmdtext[]){if (strcmp(\"/mycommand\", cmdtext, true, 10) == 0){// Do something herereturn 1;}return 0;}public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger){return 1;}public OnPlayerExitVehicle(playerid, vehicleid){return 1;}public OnPlayerStateChange(playerid, newstate, oldstate){return 1;}public OnPlayerEnterCheckpoint(playerid){return 1;}public OnPlayerLeaveCheckpoint(playerid){return 1;}public OnPlayerEnterRaceCheckpoint(playerid){return 1;}public OnPlayerLeaveRaceCheckpoint(playerid){return 1;}public OnRconCommand(cmd[]){return 1;}public OnPlayerRequestSpawn(playerid){return 1;}public OnObjectMoved(objectid){return 1;}public OnPlayerObjectMoved(playerid, objectid){return 1;}public OnPlayerPickUpPickup(playerid, pickupid){return 1;}public OnVehicleMod(playerid, vehicleid, componentid){return 1;}public OnVehiclePaintjob(playerid, vehicleid, paintjobid){return 1;}public OnVehicleRespray(playerid, vehicleid, color1, color2){return 1;}public OnPlayerSelectedMenuRow(playerid, row){return 1;}public OnPlayerExitedMenu(playerid){return 1;}public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid){return 1;}public OnPlayerKeyStateChange(playerid, newkeys, oldkeys){return 1;}public OnRconLoginAttempt(ip[], password[], success){return 1;}public OnPlayerUpdate(playerid){return 1;}public OnPlayerStreamIn(playerid, forplayerid){return 1;}public OnPlayerStreamOut(playerid, forplayerid){return 1;}public OnVehicleStreamIn(vehicleid, forplayerid){return 1;}public OnVehicleStreamOut(vehicleid, forplayerid){return 1;}forpublic Beleptetes(playerid){new nums,fields;cache_get_data(nums,fields);if(nums){mysql_get_int(0,\"Penz\",PlayerInfo[playerid][pPenz]);TogglePlayerSpectating(playerid, false);SpawnPlayer(playerid);GivePlayerMoney(playerid,PlayerInfo[playerid][pPenz]);SetPlayerPos(playerid,0,0,5);}else{SendClientMessage(playerid,-1,\"Helytelen jelszó!\");ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,\"Belépés\",\"Írd be a jelszavad\",\"OK\",\"\");}}public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]){switch(dialogid){case DIALOG_LOGIN:{ new query[128]; new szoveg[32]; Format(szoveg,\"%s\",inputtext); mysql_real_escape_string(szoveg,szoveg); Format(query,\"SELECT * FROM felhasznalok WHERE JatekosNev=\'%s\' AND Jelszo=\'%s\'\",PlayerName(playerid),md5(szoveg)); mysql_tquery(sql_ID,query,\"Beleptetes\",\"i\",playerid);}case DIALOG_REG:{ new szoveg[32] Format(szoveg,\"%s\",inputtext); mysql_real_escape_string(szoveg,szoveg); doQuery(\"INSERT INTO felhasznalok (JatekosNev,Jelszo) VALUES (\'%s\',\'%s\')\",PlayerName(playerid),md5(szoveg)); SendClientMessage(playerid,-1,\"Sikeresen Beregisztráltál, most már beléphetsz!\"); ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,\"Belépés\",\"Írd be a jelszavad\",\"OK\",\"\");}}return 1;}public OnPlayerClickPlayer(playerid, clickedplayerid, source){return 1;}
PlayerInfo[playerid][iD] = cache_get_field_content_int(0, \"userid\");PlayerInfo[playerid][Admin] = cache_get_field_content_int(0, \"admin\");
[20:44:41] [DEBUG] mysql_tquery - connection: 1, query: \"SELECT * FROM karakterek WHERE nev=\'Jake_Wood\'\", callback: \"Belepes\", format: \"i\"[20:44:41] [DEBUG] CMySQLQuery::CMySQLQuery() - constructor called[20:44:41] [DEBUG] mysql_tquery - scheduling query \"SELECT * FROM karakterek WHERE nev=\'Jake_Wood\'\"..[20:44:41] [DEBUG] CMySQLQuery::Execute[belepes(i)] - starting query execution[20:44:41] [DEBUG] CMySQLQuery::Execute[belepes(i)] - query was successful[20:44:41] [DEBUG] CMySQLResult::CMySQLResult() - constructor called[20:44:41] [DEBUG] CMySQLQuery::Execute[belepes(i)] - data being passed to ProcessCallbacks()[20:44:41] [DEBUG] Calling callback \"Belepes\"..[20:44:41] [DEBUG] cache_get_data - connection: 1[20:44:41] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called[20:44:41] [DEBUG] CMySQLQuery::~CMySQLQuery() - deconstructor called[20:44:43] [DEBUG] mysql_escape_string - source: \"asd\", connection: 1, max_len: 32[20:44:43] [DEBUG] mysql_tquery - connection: 1, query: \"SELECT * FROM karakterek WHERE nev=\'Jake_Wood\' AND jelszo=\'asd\'\", callback: \"Beleptetes\", format: \"i\"[20:44:43] [DEBUG] CMySQLQuery::CMySQLQuery() - constructor called[20:44:43] [DEBUG] mysql_tquery - scheduling query \"SELECT * FROM karakterek WHERE nev=\'Jake_Wood\' AND jelszo=\'asd\'\"..[20:44:43] [DEBUG] CMySQLQuery::Execute[beleptetes(i)] - starting query execution[20:44:43] [DEBUG] CMySQLQuery::Execute[beleptetes(i)] - query was successful[20:44:43] [DEBUG] CMySQLResult::CMySQLResult() - constructor called[20:44:43] [DEBUG] CMySQLQuery::Execute[beleptetes(i)] - data being passed to ProcessCallbacks()[20:44:43] [DEBUG] Calling callback \"Beleptetes\"..[20:44:43] [DEBUG] cache_get_data - connection: 1[20:44:43] [DEBUG] cache_get_field_content_int - row: 0, field_name: \"userid\", connection: 1[20:44:43] [DEBUG] CMySQLResult::GetRowDataByName - row: \'0\', field: \"userid\", data: \"1\"[20:44:43] [DEBUG] cache_get_field_content_int - row: 0, field_name: \"admin\", connection: 1[20:44:43] [DEBUG] CMySQLResult::GetRowDataByName - row: \'0\', field: \"admin\", data: \"0\"[20:44:43] [DEBUG] cache_get_field_content_int - row: 0, field_name: \"moderator\", connection: 1[20:44:43] [DEBUG] CMySQLResult::GetRowDataByName - row: \'0\', field: \"moderator\", data: \"0\"[20:44:43] [DEBUG] cache_get_field_content_int - row: 0, field_name: \"frakcio\", connection: 1[20:44:43] [DEBUG] CMySQLResult::GetRowDataByName - row: \'0\', field: \"frakcio\", data: \"0\"[20:44:43] [DEBUG] cache_get_field_content_int - row: 0, field_name: \"frakcioleader\", connection: 1[20:44:43] [DEBUG] CMySQLResult::GetRowDataByName - row: \'0\', field: \"frakcioleader\", data: \"0\"[20:44:43] [DEBUG] cache_get_field_content_int - row: 0, field_name: \"jelvenyszam\", connection: 1[20:44:43] [DEBUG] CMySQLResult::GetRowDataByName - row: \'0\', field: \"jelvenyszam\", data: \"0\"[20:44:43] [DEBUG] cache_get_field_content_int - row: 0, field_name: \"alosztaly\", connection: 1[20:44:43] [DEBUG] CMySQLResult::GetRowDataByName - row: \'0\', field: \"alosztaly\", data: \"0\"[20:44:43] [DEBUG] cache_get_field_content_int - row: 0, field_name: \"rang\", connection: 1[20:44:43] [DEBUG] CMySQLResult::GetRowDataByName - row: \'0\', field: \"rang\", data: \"0\"[20:44:43] [DEBUG] cache_get_field_content_int - row: 0, field_name: \"kommando\", connection: 1[20:44:43] [DEBUG] CMySQLResult::GetRowDataByName - row: \'0\', field: \"kommando\", data: \"0\"[20:44:43] [DEBUG] cache_get_field_content_int - row: 0, field_name: \"kommandofelsz\", connection: 1[20:44:43] [DEBUG] CMySQLResult::GetRowDataByName - row: \'0\', field: \"kommandofelsz\", data: \"0\"[20:44:43] [DEBUG] cache_get_field_content_int - row: 0, field_name: \"munka\", connection: 1[20:44:43] [DEBUG] CMySQLResult::GetRowDataByName - row: \'0\', field: \"munka\", data: \"0\"[20:44:43] [DEBUG] cache_get_field_content_int - row: 0, field_name: \"penz\", connection: 1[20:44:43] [DEBUG] CMySQLResult::GetRowDataByName - row: \'0\', field: \"penz\", data: \"300000\"[20:44:43] [DEBUG] cache_get_field_content_int - row: 0, field_name: \"szint\", connection: 1[20:44:43] [DEBUG] CMySQLResult::GetRowDataByName - row: \'0\', field: \"szint\", data: \"0\"[20:44:43] [DEBUG] cache_get_field_content_float - row: 0, field_name: \"elet\", connection: 1[20:44:43] [DEBUG] CMySQLResult::GetRowDataByName - row: \'0\', field: \"elet\", data: \"100\"[20:44:43] [DEBUG] cache_get_field_content_float - row: 0, field_name: \"pajzs\", connection: 1[20:44:43] [DEBUG] CMySQLResult::GetRowDataByName - row: \'0\', field: \"pajzs\", data: \"0\"[20:44:43] [DEBUG] cache_get_field_content_int - row: 0, field_name: \"eletkor\", connection: 1[20:44:43] [DEBUG] CMySQLResult::GetRowDataByName - row: \'0\', field: \"eletkor\", data: \"0\"[20:44:43] [DEBUG] cache_get_field_content_int - row: 0, field_name: \"neme\", connection: 1[20:44:43] [DEBUG] CMySQLResult::GetRowDataByName - row: \'0\', field: \"neme\", data: \"0\"[20:44:43] [DEBUG] cache_get_field_content_int - row: 0, field_name: \"civilruha\", connection: 1[20:44:43] [DEBUG] CMySQLResult::GetRowDataByName - row: \'0\', field: \"civilruha\", data: \"26\"[20:44:43] [DEBUG] cache_get_field_content_int - row: 0, field_name: \"munkaruha\", connection: 1[20:44:43] [DEBUG] CMySQLResult::GetRowDataByName - row: \'0\', field: \"munkaruha\", data: \"-1\"[20:44:43] [DEBUG] cache_get_field_content_int - row: 0, field_name: \"muted\", connection: 1[20:44:43] [DEBUG] CMySQLResult::GetRowDataByName - row: \'0\', field: \"muted\", data: \"0\"[20:44:43] [DEBUG] cache_get_field_content_int - row: 0, field_name: \"warn\", connection: 1[20:44:43] [DEBUG] CMySQLResult::GetRowDataByName - row: \'0\', field: \"warn\", data: \"0\"[20:44:43] [DEBUG] cache_get_field_content_int - row: 0, field_name: \"korhaz\", connection: 1[20:44:43] [DEBUG] CMySQLResult::GetRowDataByName - row: \'0\', field: \"korhaz\", data: \"0\"[20:44:43] [DEBUG] cache_get_field_content_float - row: 0, field_name: \"markposx\", connection: 1[20:44:43] [DEBUG] CMySQLResult::GetRowDataByName - row: \'0\', field: \"markposx\", data: \"7\"[20:44:43] [DEBUG] cache_get_field_content_float - row: 0, field_name: \"markposy\", connection: 1[20:44:43] [DEBUG] CMySQLResult::GetRowDataByName - row: \'0\', field: \"markposy\", data: \"0\"[20:44:43] [DEBUG] cache_get_field_content_float - row: 0, field_name: \"markposz\", connection: 1[20:44:43] [DEBUG] CMySQLResult::GetRowDataByName - row: \'0\', field: \"markposz\", data: \"0\"[20:44:43] [DEBUG] cache_get_field_content_int - row: 0, field_name: \"markint\", connection: 1[20:44:43] [DEBUG] CMySQLResult::GetRowDataByName - row: \'0\', field: \"markint\", data: \"0\"[20:44:43] [DEBUG] cache_get_field_content_int - row: 0, field_name: \"serules\", connection: 1[20:44:43] [DEBUG] CMySQLResult::GetRowDataByName - row: \'0\', field: \"serules\", data: \"0\"[20:44:43] [DEBUG] cache_get_field_content_int - row: 0, field_name: \"hazszam\", connection: 1[20:44:43] [DEBUG] CMySQLResult::GetRowDataByName - row: \'0\', field: \"hazszam\", data: \"-1\"[20:44:43] [DEBUG] cache_get_field_content_int - row: 0, field_name: \"mobilletezik\", connection: 1[20:44:43] [DEBUG] CMySQLResult::GetRowDataByName - row: \'0\', field: \"mobilletezik\", data: \"0\"[20:44:43] [DEBUG] cache_get_field_content_int - row: 0, field_name: \"mobilhost\", connection: 1[20:44:43] [DEBUG] CMySQLResult::GetRowDataByName - row: \'0\', field: \"mobilhost\", data: \"0\"[20:44:43] [DEBUG] cache_get_field_content_int - row: 0, field_name: \"mobilszam\", connection: 1[20:44:43] [DEBUG] CMySQLResult::GetRowDataByName - row: \'0\', field: \"mobilszam\", data: \"0\"[20:44:43] [DEBUG] cache_get_field_content_int - row: 0, field_name: \"mobilegyenleg\", connection: 1[20:44:43] [DEBUG] CMySQLResult::GetRowDataByName - row: \'0\', field: \"mobilegyenleg\", data: \"0\"[20:44:43] [DEBUG] cache_get_field_content_int - row: 0, field_name: \"olesek\", connection: 1[20:44:43] [DEBUG] CMySQLResult::GetRowDataByName - row: \'0\', field: \"olesek\", data: \"0\"[20:44:43] [DEBUG] cache_get_field_content_int - row: 0, field_name: \"halalok\", connection: 1[20:44:43] [DEBUG] CMySQLResult::GetRowDataByName - row: \'0\', field: \"halalok\", data: \"0\"[20:44:43] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called[20:44:43] [DEBUG] CMySQLQuery::~CMySQLQuery() - deconstructor called
funkcio OnAccountLoad(playerid){ PlayerInfo[playerid][iD] = cache_get_field_content_int(0, \"userid\"); PlayerInfo[playerid][Admin] = cache_get_field_content_int(0, \"admin\"); PlayerInfo[playerid][Moderator] = cache_get_field_content_int(0, \"moderator\"); PlayerInfo[playerid][Frakcio] = cache_get_field_content_int(0, \"frakcio\"); PlayerInfo[playerid][Frakcioleader] = cache_get_field_content_int(0, \"frakcioleader\"); PlayerInfo[playerid][Jelvenyszam] = cache_get_field_content_int(0, \"jelvenyszam\"); PlayerInfo[playerid][Alosztaly] = cache_get_field_content_int(0, \"alosztaly\"); PlayerInfo[playerid][Rang] = cache_get_field_content_int(0, \"rang\"); PlayerInfo[playerid][Kommando] = cache_get_field_content_int(0, \"kommando\"); PlayerInfo[playerid][Kommandofelsz] = cache_get_field_content_int(0, \"kommandofelsz\"); PlayerInfo[playerid][Munka] = cache_get_field_content_int(0, \"munka\"); PlayerInfo[playerid][Penz] = cache_get_field_content_int(0, \"penz\"); PlayerInfo[playerid][szint] = cache_get_field_content_int(0, \"szint\"); PlayerInfo[playerid][HP] = cache_get_field_content_float(0, \"elet\"); PlayerInfo[playerid][AP] = cache_get_field_content_float(0, \"pajzs\"); PlayerInfo[playerid][Eletkor] = cache_get_field_content_int(0, \"eletkor\"); PlayerInfo[playerid][Neme] = cache_get_field_content_int(0, \"neme\"); PlayerInfo[playerid][Civilruha] = cache_get_field_content_int(0, \"civilruha\"); PlayerInfo[playerid][Munkaruha] = cache_get_field_content_int(0, \"munkaruha\"); PlayerInfo[playerid][Muted] = cache_get_field_content_int(0, \"muted\"); PlayerInfo[playerid][Warn] = cache_get_field_content_int(0, \"warn\"); PlayerInfo[playerid][Korhaz] = cache_get_field_content_int(0, \"korhaz\"); PlayerInfo[playerid][MarkPosX] = cache_get_field_content_float(0, \"markposx\"); PlayerInfo[playerid][MarkPosY] = cache_get_field_content_float(0, \"markposy\"); PlayerInfo[playerid][MarkPosZ] = cache_get_field_content_float(0, \"markposz\"); PlayerInfo[playerid][MarkInt] = cache_get_field_content_int(0, \"markint\"); PlayerInfo[playerid][serules] = cache_get_field_content_int(0, \"serules\"); PlayerInfo[playerid][Hazszam] = cache_get_field_content_int(0, \"hazszam\"); PlayerInfo[playerid][MobilLetezik] = cache_get_field_content_int(0, \"mobilletezik\"); PlayerInfo[playerid][MobilHost] = cache_get_field_content_int(0, \"mobilhost\"); PlayerInfo[playerid][MobilSzam] = cache_get_field_content_int(0, \"mobilszam\"); PlayerInfo[playerid][MobilEgyenleg] = cache_get_field_content_int(0, \"mobilegyenleg\"); PlayerInfo[playerid][Olesek] = cache_get_field_content_int(0, \"olesek\"); PlayerInfo[playerid][Halalok] = cache_get_field_content_int(0, \"halalok\"); new IP[16],string[128]; GetPlayerIp(playerid,IP, sizeof(IP)); format(string,sizeof(string),\"(( %s[%d|%d] csatlakozott a szerverre! IP: %s ))\",nev,playerid,PlayerInfo[playerid][iD],IP); SendModeratorMessage(YELLOW,string);SpawnPlayer(playerid);SCM(playerid,GREEN,\"(( Sikeresen bejelentkeztél! ))\");Logged[playerid] = true; return true;}
Megoldottam ezt a problémát, egy olyan kérdésem viszont felmerült, hogy hogyan csinálok olyat mint pl dinibe a fexist funkció?