#define FILTERSCRIPT #include <a_samp> #include <a_mysql> #define SQL_WRITE 0 #define SQL_READ 1 #define SQL_HOST "sql2.freemysqlhosting.net" #define SQL_DB "sql2105739" #define SQL_USER_WRITE "sql2105739" #define SQL_USER_READ "sql2105739" #define SQL_USER_WRITE_PASS "fZ1!cI1*" #define SQL_USER_READ_PASS "fZ1!cI1*" new g_Write; new g_Read; enum { DIALOG_LOGIN, DIALOG_REGISTER } enum PlayerStatistics { Accountid, bool:Registered, bool:LoggedIn } new pInfo[MAX_PLAYERS][PlayerStatistics]; public OnFilterScriptInit() { print(" ************************************************"); print(" "); print(" Successfully Loaded OxiRegister 1.0 - MySQL R39-2"); print(" "); print(" FilterScript Creator:"); print(" "); print(" OxigEN. - (ME) Created the whole script."); print(" "); print(" Include Creators:"); print(" "); print(" a_samp - SA-MP TEAM"); print(" a_mysql - BlueG - Version R39-2"); print(" "); print(" Successfully Loaded OxiRegister 1.0 - MySQL R39-2"); print(" "); print(" ************************************************"); print(" "); print(" PLEASE AWAIT FOR DATABASE CONNECTION!"); print(" "); SQL_DB_CONNECT(SQL_WRITE); SQL_DB_CONNECT(SQL_READ); return 1; } forward SQL_DB_CONNECT(database); public SQL_DB_CONNECT(database) { if(database == SQL_WRITE) { g_Write = mysql_connect(SQL_HOST, SQL_USER_WRITE, SQL_DB, SQL_USER_WRITE_PASS); if(mysql_errno() != 0) { printf("FAILED CONNECTION TO DATABASE USING %s --- SERVER SHUTTING DOWN ~~~", SQL_USER_WRITE); SendRconCommand("exit"); } else { printf(" SUCCESSFULLY CONNECTED TO DATABASE '%s' WITH USER '%s'", SQL_DB, SQL_USER_WRITE); } } else { g_Read = mysql_connect(SQL_HOST, SQL_USER_READ, SQL_DB, SQL_USER_READ_PASS); if(mysql_errno() != 0) { printf("FAILED CONNECTION TO DATABASE USING %s --- SERVER SHUTTING DOWN ~~~", SQL_USER_READ); SendRconCommand("exit"); } else { printf(" SUCCESSFULLY CONNECTED TO DATABASE '%s' WITH USER '%s'", SQL_DB, SQL_USER_READ); print(" "); } } return 1; } public OnFilterScriptExit() { print(" ************************************************"); print(" "); print(" Successfully UNLoaded OxiRegister 1.0 - MySQL R39-2"); print(" "); print(" FilterScript Creator:"); print(" "); print(" OxigEN. - (ME) Created the whole script."); print(" "); print(" Include Creators:"); print(" "); print(" a_samp - SA-MP TEAM"); print(" a_mysql - BlueG - Version R39-2"); print(" "); print(" Successfully UNLoaded OxiRegister 1.0 - MySQL R39-2"); print(" "); print(" ************************************************"); print(" "); print(" PLEASE AWAIT FOR DATABASE DISCONNECTION!"); print(" "); mysql_close(g_Write); mysql_close(g_Read); print(" **SUCCESSFULL DISCONNECTION FROM DATABASE**"); return 1; } public OnPlayerConnect(playerid) { new query[100]; mysql_format(g_Read, query, sizeof(query), "SELECT * FROM players WHERE Name = '%s'", GetName(playerid)); mysql_pquery(g_Read, query, "OnConnection", "d", playerid); return 1; } forward OnConnection(playerid); public OnConnection(playerid) { new rows, fields; cache_get_data(rows, fields); if(rows) { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Your account has been found - Log-in", "Your account has been found in our database.\nPlease insert your password to continue.\n\nOxiRegister 1.0\n", "Log-in", "Quit"); } else { ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Your account hasn't been found - Register", "Your account couldn't be found in our database.\nPlease insert a new password to complete the registration.\n\nOxiRegister 1.0\n", "Register", "Quit"); } return 1; } public OnPlayerDisconnect(playerid, reason) { new query[1000],ip[40],query2[1000], fquery[2000]; GetPlayerIp(playerid, ip, sizeof(ip)); strcat(query, "UPDATE `players`"); strcat(query, " SET `Logged_In`= 0,`Name`= %s,`Account_ID`= %s,`IP`= %s,"); strcat(query, "`Admin`= %d,`VIP`= %d,`Skin`= %d,`Pms`= %d,`Gos`= %d,"); strcat(query, "`Godmode`= %d,`MegaJump`= %d,`Deaths`= %d,`FreeRoam_Score`= %d,`Deathmatch_Score`= %d,"); strcat(query, "`Duel_Score`= %d,`Fighting_Style`= %d,`Chat_Messages`= %d,`Color`= %d,`Ban_Count`= %d,"); strcat(query, "`Jail_Count`= %d,`Kick_Count`= %d,`Mute_Count`= %d,`Explode_Count`= %d,`Slap_Count`= %d,"); strcat(query, "`Weapons_Reset_Count`= %d,`Banned`= %d,`Jailed`= %d,`Muted`= %d,`Frozen`= %d,"); strcat(query, "`Time`= %d,`Weather`= %d WHERE Account_ID = %d"); strcat(query2,", PlayerInfo[playerid][pLogged], GetName(playerid), PlayerInfo[playerid][Accountid], ip"); strcat(query2,"PlayerInfo[playerid][pAdmin], PlayerInfo[playerid][pVip], PlayerInfo[playerid][pSkin], PlayerInfo[playerid][Pms]"); strcat(query2,"PlayerInfo[playerid][Gos], God[playerid], MegaJump[playerid], PlayerInfo[playerid][pDeaths], PlayerInfo[playerid][pKills]"); strcat(query2,"PlayerInfo[playerid][pDeathmatchScore], PlayerInfo[playerid][DuelScore], PlayerInfo[playerid][FightStyles], PlayerInfo[playerid][CMS]"); strcat(query2,"PlayerInfo[playerid][pColor], PlayerInfo[playerid][BanC], PlayerInfo[playerid][KickC], PlayerInfo[playerid][MuteC], PlayerInfo[playerid][ExplodeC]"); strcat(query2,"PlayerInfo[playerid][SlapC], PlayerInfo[playerid][WeaponRC], PlayerInfo[playerid][pBan], PlayerInfo[playerid][Jail], PlayerInfo[playerid][pMuted]"); strcat(query2,"PlayerInfo[playerid][Freeze], PlayerInfo[playerid][Time], PlayerInfo[playerid][pWeather], 0"); mysql_format(g_Write, fquery, sizeof(query), query, query2); mysql_pquery(g_Write, fquery); return 1; } forward OnLogin(playerid); public OnLogin(playerid) { new rows, fields; cache_get_data(rows, fields); if(rows) { pInfo[playerid][Accountid] = cache_get_field_content_int(0, "Accountid"); pInfo[playerid][LoggedIn] = true; SpawnPlayer(playerid); } else { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Incorrect Password!", "Please enter a correct password in order to log-in\nPress log-in to continue\n\nOxiRegister 1.0\n", "Log-in", "Quit"); } return 1; } forward OnRegistration(playerid); public OnRegistration(playerid) { new rows, fields; cache_get_data(rows, fields); if(rows) { pInfo[playerid][Accountid] = cache_get_field_content_int(0, "Accountid"); pInfo[playerid][Registered] = true; pInfo[playerid][LoggedIn] = true; SpawnPlayer(playerid); } return 1; } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { new query[1000], ip[25], query2[1000], fquery[2000]; if(dialogid == DIALOG_REGISTER) { if(!response) return Kick(playerid); if(response) { if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Please enter a valid password!", "Please enter a valid registration password\nTo continue press Register\n\nOxiRegister 1.0\n", "Register", "Quit"); else { GetPlayerIp(playerid, ip, sizeof(ip)); strcat(query,"INSERT INTO `players`"); strcat(query,"(`Logged_In`, `Name`, `Account_ID`, `IP`, `Password`, `Admin`, `VIP`, `Skin`, `Pms`, `Gos`, "); strcat(query,"`Godmode`, `MegaJump`, `Deaths`, `FreeRoam_Score`, `Deathmatch_Score`, `Duel_Score`, "); strcat(query,"`Fighting_Style`, `Chat_Messages`, `Color`, `Ban_Count`, `Jail_Count`, `Kick_Count`, "); strcat(query,"`Mute_Count`, `Explode_Count`, `Slap_Count`, `Weapons_Reset_Count`, `Banned`, `Jailed`, "); strcat(query,"`Muted`, `Frozen`, `Time`, `Weather`, `Last_Login`) VALUES "); strcat(query,"('1', '%s', '%d', '%e', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d',"); strcat(query," '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')"); strcat(query2,",GetName(playerid), PlayerInfo[playerid][Accountid], ip, PlayerInfo[playerid][pPass]"); strcat(query2,"PlayerInfo[playerid][pAdmin], PlayerInfo[playerid][pVip], PlayerInfo[playerid][pSkin], PlayerInfo[playerid][Pms]"); strcat(query2,"PlayerInfo[playerid][Gos], God[playerid], MegaJump[playerid], PlayerInfo[playerid][pDeaths], PlayerInfo[playerid][pKills]"); strcat(query2,"PlayerInfo[playerid][pDeathmatchScore], PlayerInfo[playerid][DuelScore], PlayerInfo[playerid][FightStyles], PlayerInfo[playerid][CMS]"); strcat(query2,"PlayerInfo[playerid][pColor], PlayerInfo[playerid][BanC], PlayerInfo[playerid][KickC], PlayerInfo[playerid][MuteC], PlayerInfo[playerid][ExplodeC]"); strcat(query2,"PlayerInfo[playerid][SlapC], PlayerInfo[playerid][WeaponRC], PlayerInfo[playerid][pBan], PlayerInfo[playerid][Jail], PlayerInfo[playerid][pMuted]"); strcat(query2,"PlayerInfo[playerid][Freeze], PlayerInfo[playerid][Time], PlayerInfo[playerid][pWeather], 0"); mysql_format(g_Write, fquery, sizeof(query), query, query2); mysql_pquery(g_Write, fquery, "OnRegistration", "d", playerid); } } return 1; } if(dialogid == DIALOG_LOGIN) { if(!response) return Kick(playerid); if(response) { if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Please enter a valid password!", "Please enter your valid logging in password\nTo continue press log-in\n\nOxiRegister 1.0\n", "Log-in", "Quit"); else { mysql_format(g_Read, query, sizeof(query), "SELECT * FROM accounts WHERE Password = '%e' LIMIT 0,1", inputtext); mysql_pquery(g_Read, query, "OnLogin", "d", playerid); } } return 1; } return 0; } stock GetName(playerid) { new Name[MAX_PLAYER_NAME]; GetPlayerName(playerid, Name, sizeof(Name)); return Name; }
[04:55:59] [WARNING] CMySQLHandle::Create - connection already exists [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%e" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] CMySQLQuery::Execute[OnRegistration] - (error #1136) Column count doesn't match value count at row 1 [04:58:02] [ERROR] mysql_format - no value for specifier "%s" available [04:58:02] [ERROR] mysql_format - no value for specifier "%s" available [04:58:02] [ERROR] mysql_format - no value for specifier "%d" available [04:58:02] [ERROR] mysql_format - no value for specifier "%d" available [04:58:02] [ERROR] mysql_format - no value for specifier "%d" available [04:58:02] [ERROR] mysql_format - no value for specifier "%d" available [04:58:02] [ERROR] mysql_format - no value for specifier "%d" available [04:58:02] [ERROR] mysql_format - no value for specifier "%d" available [04:58:02] [ERROR] mysql_format - no value for specifier "%d" available [04:58:02] [ERROR] mysql_format - no value for specifier "%d" available [04:58:02] [ERROR] mysql_format - destination size is too small [04:58:03] [ERROR] CMySQLQuery::Execute[] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' PlayerInfo[playerid][pLogged], GetName(playerid), PlayerInfo[playerid][Accounti' at line 1
I got a mysql login/register system filterscript from here
I tested it and it was working fine,it was saing the data on the mysql database but when i customized it to add it in my gamemode,it didnt worked. |
[04:55:59] [WARNING] CMySQLHandle::Create - connection already exists [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%e" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] mysql_format - no value for specifier "%d" available [04:57:19] [ERROR] CMySQLQuery::Execute[OnRegistration] - (error #1136) Column count doesn't match value count at row 1 [04:58:02] [ERROR] mysql_format - no value for specifier "%s" available [04:58:02] [ERROR] mysql_format - no value for specifier "%s" available [04:58:02] [ERROR] mysql_format - no value for specifier "%d" available [04:58:02] [ERROR] mysql_format - no value for specifier "%d" available [04:58:02] [ERROR] mysql_format - no value for specifier "%d" available [04:58:02] [ERROR] mysql_format - no value for specifier "%d" available [04:58:02] [ERROR] mysql_format - no value for specifier "%d" available [04:58:02] [ERROR] mysql_format - no value for specifier "%d" available [04:58:02] [ERROR] mysql_format - no value for specifier "%d" available [04:58:02] [ERROR] mysql_format - no value for specifier "%d" available [04:58:02] [ERROR] mysql_format - destination size is too small [04:58:03] [ERROR] CMySQLQuery::Execute[] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' PlayerInfo[playerid][pLogged], GetName(playerid), PlayerInfo[playerid][Accounti' at line 1