sscanf warning: Format specifier does not match parameter count.
[MySQL] Error (0): Failed to exeute query. Unknown column \'Usern\' in \'where clause\'.
sscanf(string, \"p<|>s[24]s[145]s[16]ddddddd\", name, HashedPW, IP, PlayerData[playerid][AdminLevel], PlayerData[playerid][score], PlayerData[playerid][Money], PlayerData[playerid][Kills], PlayerData[playerid][Deaths], PlayerData[playerid][blind], PlayerData[playerid][Cigi], PlayerData[playerid][Kaja]);
CMD:kaja(playerid, params[]){ if(GetPlayerAdminLevel(playerid) <= 2) return SendClientMessage(playerid, COLOR_ERROR, \"Nem használhatod ezt a parancsot!\"); {new player, kaja;if(sscanf(params, \"ud\", player, kaja)) return SendClientMessage(playerid, COLOR_ERROR, \"Használat: /kaja [Név/ID] [Kaja]\");else if(!IsPlayerConnected(player)) return SendClientMessage(playerid, COLOR_ERROR, \"A játékos nincs csatlakozva!\");{ new string[128]; format(string, sizeof(string), \"Sikeresen adtál kaját %s-nak/nek!\", PlayerName(player)); SendClientMessage(playerid, COLOR_INFO, string); PlayerData[player][Kaja] = kaja;}}return true;}
format(str,sizeof(str),\"SELECT * FROM `tablaneve`\");mysql_query(str);mysql_fetch_row(string);sscanf(string, \"p<|>s[24]s[145]s[16]ddddddd\", name, HashedPW, IP, PlayerData[playerid][AdminLevel], PlayerData[playerid][score], PlayerData[playerid][Money], PlayerData[playerid][Kills], PlayerData[playerid][Deaths], PlayerData[playerid][blind], PlayerData[playerid][Cigi], PlayerData[playerid][Kaja]);
if(!response) return Kick(playerid); else if(!IsValidText(inputtext)) return SendClientMessage(playerid, COLOR_ERROR, \"Hiba: A jelszó érvénytelen karaktereket tartalmaz! Írj be egy új jelszót.\"), LoginDialog(playerid); else if(strlen(inputtext) == 0) return SendClientMessage(playerid, COLOR_ERROR, \"Hiba: Meg kell adnod egy jelszót!\"), LoginDialog(playerid); { new string[220], HashedPW[145], IP[16]; WP_Hash(HashedPW, sizeof (HashedPW), inputtext); format(string, sizeof(string), \"SELECT * FROM `accounts` WHERE `Username` = \'%s\' AND `Password` = \'%s\'\", PlayerName(playerid), HashedPW); mysql_query(string); mysql_store_result(); if(mysql_num_rows() != 0) { new name[24]; IsPlayerLoggedIn[playerid] = 1; mysql_fetch_row(string, \"|\"); sscanf(string, \"p<|>s[24]s[145]s[16]ddddddd\", name, HashedPW, IP, PlayerData[playerid][AdminLevel], PlayerData[playerid][score], PlayerData[playerid][Money], PlayerData[playerid][Kills], PlayerData[playerid][Deaths], PlayerData[playerid][blind], PlayerData[playerid][Cigi], PlayerData[playerid][Kaja]); format(string, sizeof(string), \"UPDATE `accounts` SET `IP` = \'%s\' WHERE Username= \'%s\'\", PlayerIP(playerid), PlayerName(playerid)); mysql_query(string); SetPlayerScore(playerid, PlayerData[playerid][score]); GivePlayerMoney(playerid, PlayerData[playerid][Money]); #if defined ANTI_BAN_EVADE format(string, sizeof(string), \"SELECT `Username` FROM `banned` WHERE `Username` = \'%s\'\", PlayerName(playerid)); mysql_query(string); mysql_store_result(); if(mysql_num_rows()) { format(string, sizeof(string), \"[AUTO BAN] %s bannolva lett\", PlayerName(playerid)); SendClientMessageToAll(COLOR_INFO, string); BanPlayer(playerid, \"Anti-Cheat\", \"Ban\"); } mysql_free_result(); #endif } else SendClientMessage(playerid, COLOR_ERROR, \"Hiba: Helytelen jelszó. Írd be újra!\"), LoginDialog(playerid); mysql_free_result(); }
format(string, sizeof(string), \"INSERT INTO `accounts` (`Username`, `Password`, `IP`, `AdminLevel`, `Score`, `Money`, `Kills`, `Deaths`, `Blind`, `Cigi`, `Kaja`) VALUES (\'%s\', \'%s\', \'%s\', \'0\', \'0\', \'%i\', \'0\', \'0\', \'0\', \'0\', \'0\')\", PlayerName(playerid), HashedPW, PlayerIP(playerid), START_MONEY);
enum PlayerInfo{AdminLevel,Score,Money,Kills,Deaths}
enum PlayerInfo{AdminLevel,Score,Money,Kills,Deaths,Blind,Cigi,Kaja}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]){switch(dialogid){ case REGISTER_DIALOG: { if(!response) return Kick(playerid); if(!IsValidText(inputtext)) return SendClientMessage(playerid, COLOR_ERROR, \"Hiba: A jelszó érvénytelen karaktereket tartalmaz! Írj be egy új jelszót.\"), RegisterDialog(playerid); if(strlen(inputtext) == 0) return SendClientMessage(playerid, COLOR_ERROR, \"Hiba: Meg kell adnod egy jelszót!\"), RegisterDialog(playerid); { new string[310], HashedPW[129]; WP_Hash(HashedPW, sizeof (HashedPW), inputtext); format(string, sizeof(string), \"INSERT INTO `accounts` (Username, Password, IP, AdminLevel, Score, Money, Kills, Deaths) VALUES (\'%s\', \'%s\', \'%s\', \'0\', \'0\', \'%i\', \'0\', \'0\')\", PlayerName(playerid), HashedPW, PlayerIP(playerid), START_MONEY); mysql_query(string), LoginDialog(playerid); } return true;}case LOGIN_DIALOG: { if(!response) return Kick(playerid); else if(!IsValidText(inputtext)) return SendClientMessage(playerid, COLOR_ERROR, \"Hiba: A jelszó érvénytelen karaktereket tartalmaz! Írj be egy új jelszót.\"), LoginDialog(playerid); else if(strlen(inputtext) == 0) return SendClientMessage(playerid, COLOR_ERROR, \"Hiba: Meg kell adnod egy jelszót!\"), LoginDialog(playerid); { new string[220], HashedPW[145], IP[16]; WP_Hash(HashedPW, sizeof (HashedPW), inputtext); format(string, sizeof(string), \"SELECT * FROM `accounts` WHERE `Username` = \'%s\' AND `Password` = \'%s\'\", PlayerName(playerid), HashedPW); mysql_query(string); mysql_store_result(); if(mysql_num_rows() != 0) { new name[24]; IsPlayerLoggedIn[playerid] = 1; mysql_fetch_row(string, \"|\"); sscanf(string, \"p<|>s[24]s[145]s[16]ddddd\", name, HashedPW, IP, PlayerData[playerid][AdminLevel], PlayerData[playerid][score], PlayerData[playerid][Money], PlayerData[playerid][Kills], PlayerData[playerid][Deaths]); format(string, sizeof(string), \"UPDATE `accounts` SET `IP` = \'%s\' WHERE Username= \'%s\'\", PlayerIP(playerid), PlayerName(playerid)); mysql_query(string); SetPlayerScore(playerid, PlayerData[playerid][score]); GivePlayerMoney(playerid, PlayerData[playerid][Money]); #if defined ANTI_BAN_EVADE format(string, sizeof(string), \"SELECT `Username` FROM `banned` WHERE `Username` = \'%s\'\", PlayerName(playerid)); mysql_query(string); mysql_store_result(); if(mysql_num_rows()) { format(string, sizeof(string), \"[AUTO BAN] %s has been banned for ban evading\", PlayerName(playerid)); SendClientMessageToAll(COLOR_INFO, string); BanPlayer(playerid, \"Anti-Cheat\", \"Ban Evading\"); } mysql_free_result(); #endif } else SendClientMessage(playerid, COLOR_ERROR, \"Hiba: Helytelen jelszó. Írd be újra!\"), LoginDialog(playerid); mysql_free_result(); } return true;}}return false;}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]){switch(dialogid){ case REGISTER_DIALOG: { if(!response) return Kick(playerid); if(!IsValidText(inputtext)) return SendClientMessage(playerid, COLOR_ERROR, \"Hiba: A jelszó érvénytelen karaktereket tartalmaz! Írj be egy új jelszót.\"), RegisterDialog(playerid); if(strlen(inputtext) == 0) return SendClientMessage(playerid, COLOR_ERROR, \"Hiba: Meg kell adnod egy jelszót!\"), RegisterDialog(playerid); { new string[310], HashedPW[129]; WP_Hash(HashedPW, sizeof (HashedPW), inputtext); format(string, sizeof(string), \"INSERT INTO `accounts` (Username, Password, IP, AdminLevel, Score, Money, Kills, Deaths, Blind, Cigi, Kaja) VALUES (\'%s\', \'%s\', \'%s\', \'0\', \'0\', \'%i\', \'0\', \'0\', \'0\', \'0\', \'0\')\", PlayerName(playerid), HashedPW, PlayerIP(playerid), START_MONEY); mysql_query(string), LoginDialog(playerid); } return true;}case LOGIN_DIALOG: { if(!response) return Kick(playerid); else if(!IsValidText(inputtext)) return SendClientMessage(playerid, COLOR_ERROR, \"Hiba: A jelszó érvénytelen karaktereket tartalmaz! Írj be egy új jelszót.\"), LoginDialog(playerid); else if(strlen(inputtext) == 0) return SendClientMessage(playerid, COLOR_ERROR, \"Hiba: Meg kell adnod egy jelszót!\"), LoginDialog(playerid); { new string[220], HashedPW[145], IP[16]; WP_Hash(HashedPW, sizeof (HashedPW), inputtext); format(string, sizeof(string), \"SELECT * FROM `accounts` WHERE `Username` = \'%s\' AND `Password` = \'%s\'\", PlayerName(playerid), HashedPW); mysql_query(string); mysql_store_result(); if(mysql_num_rows() != 0) { new name[24]; IsPlayerLoggedIn[playerid] = 1; mysql_fetch_row(string, \"|\"); sscanf(string, \"p<|>s[24]s[145]s[16]ddddddd\", name, HashedPW, IP, PlayerData[playerid][AdminLevel], PlayerData[playerid][score], PlayerData[playerid][Money], PlayerData[playerid][Kills], PlayerData[playerid][Deaths], PlayerData[playerid][blind], PlayerData[playerid][Cigi], PlayerData[playerid][Kaja]); format(string, sizeof(string), \"UPDATE `accounts` SET `IP` = \'%s\' WHERE Username= \'%s\'\", PlayerIP(playerid), PlayerName(playerid)); mysql_query(string); SetPlayerScore(playerid, PlayerData[playerid][score]); GivePlayerMoney(playerid, PlayerData[playerid][Money]); #if defined ANTI_BAN_EVADE format(string, sizeof(string), \"SELECT `Username` FROM `banned` WHERE `Username` = \'%s\'\", PlayerName(playerid)); mysql_query(string); mysql_store_result(); if(mysql_num_rows()) { format(string, sizeof(string), \"[AUTO BAN] %s has been banned for ban evading\", PlayerName(playerid)); SendClientMessageToAll(COLOR_INFO, string); BanPlayer(playerid, \"Anti-Cheat\", \"Ban Evading\"); } mysql_free_result(); #endif } else SendClientMessage(playerid, COLOR_ERROR, \"Hiba: Helytelen jelszó. Írd be újra!\"), LoginDialog(playerid); mysql_free_result(); } return true;}}return false;}
stock SavePlayerAccount(playerid){new string[170];format(string, sizeof(string), \"UPDATE `accounts` SET `AdminLevel` = \'%d\', `Score` = \'%d\', `Money` = \'%d\', `Kills` = \'%d\', `Deaths` = \'%d\' WHERE Username= \'%s\'\", PlayerData[playerid][AdminLevel], GetPlayerScore(playerid), GetPlayerMoney(playerid), PlayerData[playerid][Kills], PlayerData[playerid][Deaths], PlayerName(playerid));mysql_query(string);}
stock SavePlayerAccount(playerid){new string[170];format(string, sizeof(string), \"UPDATE `accounts` SET `AdminLevel` = \'%d\', `Score` = \'%d\', `Money` = \'%d\', `Kills` = \'%d\', `Deaths` = \'%d\', `Blind` = \'%d\', `Cigi` = \'%d\', `Kaja` = \'%d\' WHERE Username= \'%s\'\", PlayerData[playerid][AdminLevel], GetPlayerScore(playerid), GetPlayerMoney(playerid), PlayerData[playerid][Kills], PlayerData[playerid][Deaths], PlayerData[playerid][blind], PlayerData[playerid][Cigi], PlayerData[playerid][Kaja], PlayerName(playerid));mysql_query(string);}
-- phpMyAdmin SQL Dump-- version 3.4.5-- http://www.phpmyadmin.net---- Hoszt: localhost-- Létrehozás ideje: 2012. ápr. 26. 15:54-- Szerver verzió: 5.5.16-- PHP verzió: 5.3.8SET SQL_MODE=\"NO_AUTO_VALUE_ON_ZERO\";SET time_zone = \"+00:00\"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;/*!40101 SET NAMES utf8 */;---- Adatbázis: `samp`---- ------------------------------------------------------------ Tábla szerkezet: `accounts`--CREATE TABLE IF NOT EXISTS `accounts` ( `Username` varchar(24) NOT NULL, `Password` varchar(128) NOT NULL, `IP` varchar(16) NOT NULL, `AdminLevel` int(1) NOT NULL, `Score` int(6) NOT NULL, `Money` int(9) NOT NULL, `Kills` int(6) NOT NULL, `Deaths` int(6) NOT NULL, `Blind` int(1) NOT NULL, `Cigi` int(2) NOT NULL, `Kaja` int(2) NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=latin1;---- A tábla adatainak kiíratása `accounts`--INSERT INTO `accounts` (`Username`, `Password`, `IP`, `AdminLevel`, `Score`, `Money`, `Kills`, `Deaths`, `Blind`, `Cigi`, `Kaja`) VALUES(\'TheMesziErik\', \'DE1E31E30846F64FEAA23E5D3EA5E05A19592AAA8D928729DAB49F0A72416F0461CA65AD7A57E947666E4C53EBCB1B118C72E914CF0B8A7E7E2D3765098DBA84\', \'127.0.0.1\', 7, 0, 30000, 0, 0, 0, 0, 0);/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
A string buffer méretét emeld fel nagyobbra, ez azért lesz, mivel nem tudja az egészet beleformázni.