11.10.2014, 03:24
I need R7 Windows files anybody have it?
enum E_PLAYERS { ORM:ORM_ID, ID, Name[MAX_PLAYER_NAME], Password[129], Money, bool:IsLoggedIn, bool:IsRegistered, LoginAttempts, LoginTimer }; new Player[MAX_PLAYERS][E_PLAYERS]; new MysqlRaceCheck[MAX_PLAYERS];
public OnPlayerConnect(playerid) { MysqlRaceCheck[playerid]++; //reset player data for(new E_PLAYERS:e; e < E_PLAYERS; ++e) Player[playerid][e] = 0; GetPlayerName(playerid, Player[playerid][Name], MAX_PLAYER_NAME); //create orm instance and register all needed variables new ORM:ormid = Player[playerid][ORM_ID] = orm_create("players", SQL); orm_addvar_int(ormid, Player[playerid][ID], "id"); orm_addvar_string(ormid, Player[playerid][Name], MAX_PLAYER_NAME, "username"); orm_addvar_string(ormid, Player[playerid][Password], 129, "password"); orm_addvar_int(ormid, Player[playerid][Money], "money"); orm_setkey(ormid, "username"); //tell the orm system to load all data, assign it to our variables and call our callback when ready orm_load(ormid, "OnPlayerDataLoaded", "dd", playerid, MysqlRaceCheck[playerid]); return 1; }
public OnPlayerDisconnect(playerid,reason) { MysqlRaceCheck[playerid]++; if(Player[playerid][IsLoggedIn] && Player[playerid][ID] > 0) orm_save(Player[playerid][ORM_ID]); //if Player[playerid][ID] has a valid value, orm_save sends an UPDATE query, else an INSERT query return 1; }
I want to load data into a seperate variable from a specific field and then save data from another variable into the same field. Will orm_delvar and then orm_addvar_string suffice or do I have to redo something..?
|
new variable1, variable2; orm_addvar_int(ormid, variable1, "Field");//first addvar andthen you load data in before u save again just set the variable1 by normally function such variable1 = variable2; and then orm_save
text here
In general, try to connect new plug-in and then the error
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1256) : error 035: argument type mismatch (argument 1) C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (125 : error 017: undefined symbol "mysql_num_rows" C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1260) : error 017: undefined symbol "mysql_fetch_int" C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1264) : error 017: undefined symbol "mysql_free_result" C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1269) : error 035: argument type mismatch (argument 1) C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1271) : error 017: undefined symbol "mysql_num_rows" C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1273) : error 017: undefined symbol "mysql_fetch_int" C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1277) : error 017: undefined symbol "mysql_free_result" C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1292) : error 035: argument type mismatch (argument 1) C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1294) : error 017: undefined symbol "mysql_fetch_row_format" C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1296) : error 017: undefined symbol "mysql_free_result" C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (2331) : error 035: argument type mismatch (argument 1) C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (233 : error 035: argument type mismatch (argument 1) C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (2339) : error 017: undefined symbol "mysql_store_result" C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (2340) : error 017: undefined symbol "mysql_fetch_row_format" C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (235 : error 017: undefined symbol "mysql_free_result" C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (2895) : error 035: argument type mismatch (argument 1) C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (2985) : error 035: argument type mismatch (argument 1) C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (2986) : error 017: undefined symbol "mysql_store_result" C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (2987) : error 017: undefined symbol "mysql_fetch_row" C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (3040) : error 017: undefined symbol "mysql_free_result" C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (3199) : error 035: argument type mismatch (argument 1) C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (3200) : error 017: undefined symbol "mysql_store_result" C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (3201) : error 017: undefined symbol "mysql_fetch_row" C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (3204) : error 017: undefined symbol "mysql_free_result" C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (325 : error 035: argument type mismatch (argument 1) |
// Try to get the password from the SQL-table (he might have already registered and needs to login properly by entering the password, or he might be a new player)
printf("Executing Player_PasswordLoad");
Player_PasswordLoad(playerid);
// This function is called when the player logs in (OnPlayerConnect) and sends a query to try to retrieve the password for this player
Player_PasswordLoad(playerid)
{
printf("Executed Player_PasswordLoad");
// Setup local variables
new Query[128];
// Try to get the password from the SQL-table
mysql_format(SQL_db, Query, sizeof(Query), "SELECT Password FROM %s WHERE PlayerName = '%e' LIMIT 1", table_playerdata, APlayerData[playerid][PlayerName]);
printf("Running query to select password");
printf("Query: %s", Query);
mysql_tquery(SQL_db, Query, "Player_OnPasswordLoad", "i", playerid);
}
// This custom callback is called when a player connects to the server (MySQL received a query to get his password using the function "Player_PasswordLoad")
forward Player_OnPasswordLoad(playerid);
public Player_OnPasswordLoad(playerid)
{
printf("Executed Player_OnPasswordLoad");
// Check if this player's account exists (number of rows should be 1)
if (cache_get_row_count(SQL_db) == 1)
{
// Store the password from the query-result
cache_get_row(0, 0, APlayerData[playerid][PlayerPassword], SQL_db, 130);
printf("Password: %s", APlayerData[playerid][PlayerPassword]);
// Ask the player to enter his password to login
ShowPlayerDialog(playerid, DialogLogin, DIALOG_STYLE_PASSWORD, "Welcome", "Please login by entering your password:", "Login", "Cancel");
}
else // The player isn't registered yet (he has no account), so let him enter a password to register his account
ShowPlayerDialog(playerid, DialogRegister, DIALOG_STYLE_PASSWORD, "Welcome", "Please register by entering your password:", "Register", "Cancel");
return 1;
}
[00:45:32] [DEBUG] mysql_format - connection: 1, len: 128, format: "SELECT Password FROM %s WHERE PlayerName = '%e' LIMIT 1" [00:45:32] [DEBUG] mysql_tquery - connection: 1, query: "SELECT Password FROM playerdata WHERE PlayerName = 'PowerPC603' ", callback: "Player_OnPasswordLoad", format: "i" [00:45:32] [DEBUG] CMySQLQuery::Execute[Player_OnPasswordLoad] - starting query execution [00:45:32] [DEBUG] CMySQLQuery::Execute[Player_OnPasswordLoad] - query was successfully executed within 0.369 milliseconds [00:45:32] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [00:45:32] [DEBUG] Calling callback "Player_OnPasswordLoad".. [00:45:32] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [00:45:44] [DEBUG] mysql_close - connection: 1 [00:45:44] [DEBUG] CMySQLConnection::Disconnect - connection was closed [00:45:44] [DEBUG] CMySQLConnection::Disconnect - connection was closed [00:45:44] [DEBUG] CMySQLHandle::~CMySQLHandle - deconstructor called
[00:51:28] [DEBUG] mysql_format - connection: 1, len: 128, format: "SELECT Password FROM %s WHERE PlayerName = '%e' LIMIT 1" [00:51:28] [DEBUG] mysql_tquery - connection: 1, query: "SELECT Password FROM playerdata WHERE PlayerName = 'PowerPC603' ", callback: "Player_OnPasswordLoad", format: "i" [00:51:28] [DEBUG] CMySQLQuery::CMySQLQuery() - constructor called [00:51:28] [DEBUG] mysql_tquery - scheduling query "SELECT Password FROM playerdata WHERE PlayerName = 'PowerPC603' LIMIT 1".. [00:51:28] [DEBUG] CMySQLQuery::Execute[Player_OnPasswordLoad(i)] - starting query execution [00:51:28] [DEBUG] CMySQLQuery::Execute[Player_OnPasswordLoad(i)] - query was successful [00:51:28] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [00:51:28] [DEBUG] CMySQLQuery::Execute[Player_OnPasswordLoad(i)] - data being passed to ProcessCallbacks() [00:51:28] [DEBUG] Calling callback "Player_OnPasswordLoad".. [00:51:28] [DEBUG] cache_get_row_count - connection: 1 [00:51:28] [DEBUG] cache_get_row - row: 0, field_idx: 0, connection: 1, max_len: 130 [00:51:28] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '0', data: "96655ca25611e89ba5090709b70950605691cd8e4578f4d1d1fd8a9ceca49e921451de31a7d3d37abd01691b82a6d8256075b11790a779b803a320d27727d78" [00:51:28] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [00:51:28] [DEBUG] CMySQLQuery::~CMySQLQuery() - deconstructor called [00:51:31] [DEBUG] mysql_format - connection: 1, len: 128, format: "SELECT * FROM %s WHERE PlayerName = '%e' LIMIT 1" [00:51:31] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM playerdata WHERE PlayerName = 'PowerPC603' LIMIT 1", callback: "Player_OnAccountLoad", format: "i" [00:51:31] [DEBUG] CMySQLQuery::CMySQLQuery() - constructor called [00:51:31] [DEBUG] mysql_tquery - scheduling query "SELECT * FROM playerdata WHERE PlayerName = 'PowerPC603' LIMIT 1".. [00:51:31] [DEBUG] CMySQLQuery::Execute[Player_OnAccountLoad(i)] - starting query execution [00:51:31] [DEBUG] CMySQLQuery::Execute[Player_OnAccountLoad(i)] - query was successful [00:51:31] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [00:51:31] [DEBUG] CMySQLQuery::Execute[Player_OnAccountLoad(i)] - data being passed to ProcessCallbacks() [00:51:31] [DEBUG] Calling callback "Player_OnAccountLoad".. [00:51:31] [DEBUG] cache_get_field_content_int - row: 0, field_name: "SpeedInMph", connection: 1 [00:51:31] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "SpeedInMph", data: "0" [00:51:31] [DEBUG] cache_get_field_content_int - row: 0, field_name: "ID", connection: 1 [00:51:31] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "ID", data: "3" [00:51:31] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Fines", connection: 1 [00:51:31] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Fines", data: "0" [00:51:31] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Tickets", connection: 1 [00:51:31] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Tickets", data: "0" [00:51:31] [DEBUG] cache_get_field_content_int - row: 0, field_name: "TicketCost", connection: 1 [00:51:31] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "TicketCost", data: "0" [00:51:31] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Money", connection: 1 [00:51:31] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Money", data: "811256" [00:51:31] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Score", connection: 1 [00:51:31] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Score", data: "5961" [00:51:31] [DEBUG] cache_get_field_content_int - row: 0, field_name: "AdminLevel", connection: 1 [00:51:31] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "AdminLevel", data: "6" [00:51:31] [DEBUG] cache_get_field_content_int - row: 0, field_name: "JailTime", connection: 1 [00:51:31] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "JailTime", data: "0" [00:51:31] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [00:51:31] [DEBUG] CMySQLQuery::~CMySQLQuery() - deconstructor called [00:51:43] [DEBUG] mysql_close - connection: 1, wait: true [00:51:43] [DEBUG] CMySQLConnection::Disconnect - connection was closed [00:51:43] [DEBUG] CMySQLConnection::Disconnect - connection was closed [00:51:43] [DEBUG] CMySQLHandle::~CMySQLHandle - deconstructor called
[23:04:12] [ERROR] "mysql_format" - invalid connection handle (id: -1)
[23:04:12] [ERROR] "mysql_tquery" - invalid connection handle (id: -1)
mysql_format(SQL, szQuery, sizeof(szQuery),"UPDATE `accounts` SET `skin` = '%d', `sex` = '%d', `age` = '%d', `from` = '%d', `sta` = '%d' WHERE `x` = '%d' LIMIT 1", PlayerInfo[playerid][Skin], PlayerInfo[playerid][Sex], PlayerInfo[playerid][Age], PlayerInfo[playerid][From], PlayerInfo[playerid][sta], PlayerInfo[playerid][X]);
mysql_tquery(SQL, szQuery, "OnQueryFinish", "ii", THREAD_NO_RESULT, playerid);
Any idea what this:
pawn Код:
i'm trying save this: pawn Код:
p.s: its loading and registering new accounts, only that values dont save, strange. |
new SQL = mysql_connect( ... );
native mysql_connect(const host[], const user[], const database[], const password[], port = 3306, bool:autoreconnect = true, pool_size = 2); // <-- this one
mysql_tquery(1, szQuery, "OnQueryFinish", "ii", THREAD_NO_RESULT, playerid);