17.07.2013, 05:11
Nice tutorial, extremely helpful; good luck with everything!
public OnPlayerDisconnect( playerid, reason ) { for( new i; i < _: USER_DATA; ++i ) User[ playerid ][ USER_DATA: i ] = 0; // ... return 1; }
This tutorial have a little bug I guess.
If you use this: Code:
public OnPlayerDisconnect( playerid, reason ) { for( new i; i < _: USER_DATA; ++i ) User[ playerid ][ USER_DATA: i ] = 0; // ... return 1; } |
Before we start again, I want to tell you that I use an include "easydialog" for my dialogs because I used to have few problems with just 3 dialogs and the dialogids differ from each other. If you don't want to use it, then you can simply switch to the old method.
|
error 017: undefined symbol "ShowDialog"
#define DIALOG_LOGIN 1 #define DIALOG_REGISTER 2
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Type in your password below to log in.", "Login", "Leave"); //or this ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", "Type in a password below to register an account.", "Register", "Leave");
db_query( Database, "CREATE TABLE IF NOT EXISTS users (userid INTEGER PRIMARY KEY AUTOINCREMENT, username VARCHAR(24) COLLATE NOCASE, password VARCHAR(129), admin INTEGER DEFAULT 0 NOT NULL)" ); return 1;
ormat( Query, sizeof( Query ), "SELECT password FROM users WHERE username = '%s' LIMIT 0, 1", DB_Escape( User[ playerid ][ USER_NAME ] ) );// SELECT field FROM table WHERE field = something. Take a look at the DB_Escape Result = db_query( Database, Query );
[..]plus how do you know the parameters for the queries?[..]The first one doesn't use the same format as the second (SELECT field FROM table WHERE field = something)
|
SELECT column1, column2, columnN FROM table_name;
CREATE TABLE database_name.table_name(
column1 datatype PRIMARY KEY(one or more columns),
column2 datatype,
column3 datatype,
.....
columnN datatype,
);