I can't register or Login -
JohnRastion - 03.02.2018
Hey guys i m making my cnr server, i compiled my gamemode and there no error
This is my logs:
PHP код:
----------
Loaded log file: "server_log.txt".
----------
SA-MP Dedicated Server
----------------------
v0.3.7-R2, (C)2005-2015 SA-MP Team
[11:17:08] password = "" (string)
[11:17:08]
[11:17:08] Server Plugins
[11:17:08] --------------
[11:17:08] Loading plugin: crashdetect.so
[11:17:08] CrashDetect v4.15.1 is OK.
[11:17:08] Loaded.
[11:17:08] Loading plugin: streamer.so
[11:17:08] Loaded.
[11:17:08] Loading plugin: mysql.so
[11:17:08]
> MySQL plugin R6 successfully loaded.
[11:17:08] Loaded.
[11:17:08] Loading plugin: mysql_static.so
[11:17:08] SA:MP MySQL Plugin v2.1.1 Loaded.
[11:17:08] Loaded.
[11:17:08] Loading plugin: sscanf.so
[11:17:08]
[11:17:08] ===============================
[11:17:08] sscanf plugin loaded.
[11:17:08] Version: 2.8.1
[11:17:08] (c) 2012 Alex "******" Cole
[11:17:08] ===============================
[11:17:08] Loaded.
[11:17:08] Loaded 5 plugins.
[11:17:09] [MySQL] Thread running. Threadsafe: Yes.
[11:17:09]
[11:17:09] Ban list
[11:17:09] --------
[11:17:09] Loaded: samp.ban
[11:17:09]
[11:17:09]
[11:17:09] Filterscripts
[11:17:09] ---------------
[11:17:09] Loading filterscript 'UltraHost.amx'...
[11:17:10] Loading filterscript 'shouryamaps.amx'...
[11:17:12] Loading filterscript 'lab.amx'...
[11:17:13] Loading filterscript 'speedv2.amx'...
[11:17:15]
--Loaded Simple Speedometer and Vehicle Health System by Dark!--
[11:17:15] Loading filterscript 'Headshot.amx'...
[11:17:17] Loading filterscript 'antirapidfire.amx'...
[11:17:19] Loaded 6 filterscripts.
[11:17:23]
[11:17:23]
[11:17:23]
[11:17:23] =======================================
[11:17:23] | |
[11:17:23] | YSI version 3.09.0684 |
[11:17:23] | By Alex "******" Cole |
[11:17:23] | |
[11:17:23] =======================================
[11:17:23]
[11:17:23] Loading Vehicles
[11:17:23] (1) Loaded! Owner: 24
[11:17:23] (2) Loaded! Owner: 24
[11:17:23] (3) Loaded! Owner: 24
[11:17:23] (4) Loaded! Owner: 24
[11:17:23] (5) Loaded! Owner: 24
[11:17:23] (6) Loaded! Owner: 24
[11:17:23] (7) Loaded! Owner: 24
[11:17:23] (8) Loaded! Owner: 110781
[11:17:23] (9) Loaded! Owner: 110781
[11:17:23] (10) Loaded! Owner: 335
[11:17:23] (11) Loaded! Owner: 335
[11:17:23] (12) Loaded! Owner: 340
[11:17:23] (13) Loaded! Owner: 466
[11:17:23] (14) Loaded! Owner: 335
[11:17:23] (15) Loaded! Owner: 329
[11:17:23] (16) Loaded! Owner: 767
[11:17:23] (17) Loaded! Owner: 329
[11:17:23] (18) Loaded! Owner: 329
[11:17:23] (19) Loaded! Owner: 329
[11:17:23] (20) Loaded! Owner: 735
[11:17:23] (21) Loaded! Owner: 219
[11:17:23] (22) Loaded! Owner: 776
[11:17:23] (23) Loaded! Owner: 776
[11:17:23] (25) Loaded! Owner: 776
[11:17:23] (26) Loaded! Owner: 776
[11:17:23] (27) Loaded! Owner: 776
[11:17:23] (29) Loaded! Owner: 776
[11:17:23] (30) Loaded! Owner: 293
[11:17:23] (31) Loaded! Owner: 293
[11:17:23] (32) Loaded! Owner: 293
[11:17:23] (33) Loaded! Owner: 293
[11:17:23] (34) Loaded! Owner: 293
[11:17:23] (35) Loaded! Owner: 293
[11:17:23] (36) Loaded! Owner: 293
[11:17:23] (38) Loaded! Owner: 783
[11:17:23] (39) Loaded! Owner: 326
[11:17:23] (40) Loaded! Owner: 326
[11:17:23] (41) Loaded! Owner: 326
[11:17:23] (42) Loaded! Owner: 776
[11:17:23] (44) Loaded! Owner: 616
[11:17:23] (45) Loaded! Owner: 2
[11:17:23] (46) Loaded! Owner: 2
[11:17:23] (47) Loaded! Owner: 1
[11:17:23] (48) Loaded! Owner: 40
[11:17:23] (50) Loaded! Owner: 40
[11:17:23] (51) Loaded! Owner: 40
[11:17:23] (52) Loaded! Owner: 23
[11:17:23] (53) Loaded! Owner: 40
[11:17:23] (54) Loaded! Owner: 23
[11:17:23] (56) Loaded! Owner: 3
[11:17:23] (57) Loaded! Owner: 40
[11:17:23] (58) Loaded! Owner: 23
[11:17:23] (59) Loaded! Owner: 56
[11:17:23] (60) Loaded! Owner: 56
[11:17:23] (61) Loaded! Owner: 40
[11:17:23] (62) Loaded! Owner: 3
[11:17:23] (64) Loaded! Owner: 56
[11:17:23] (65) Loaded! Owner: 56
[11:17:23] (67) Loaded! Owner: 56
[11:17:23] (68) Loaded! Owner: 40
[11:17:23] (69) Loaded! Owner: 56
[11:17:23] (72) Loaded! Owner: 56
[11:17:23] (73) Loaded! Owner: 1
[11:17:23] (74) Loaded! Owner: 1
[11:17:23] (75) Loaded! Owner: 1
[11:17:23] (76) Loaded! Owner: 1
[11:17:23] (77) Loaded! Owner: 3
[11:17:23] (78) Loaded! Owner: 96
[11:17:23] (79) Loaded! Owner: 125
[11:17:23] (80) Loaded! Owner: 125
[11:17:23] (81) Loaded! Owner: 125
[11:17:23] (82) Loaded! Owner: 125
[11:17:23] (83) Loaded! Owner: 125
[11:17:23] (84) Loaded! Owner: 125
[11:17:23] (85) Loaded! Owner: 7
[11:17:24]
-----------------------------------
[11:17:24] UGCNR Cops And Robbers by Dark
[11:17:24] ------------------------------------
[11:17:24] Number of vehicle models: 98
[11:34:56] [connection] incoming connection: 196.64.129.62:57870 id: 0
[11:34:56]
[11:34:56] Ban list
[11:34:56] --------
[11:34:56] Loaded: samp.ban
[11:34:56]
[11:34:56] [join] Dark has joined the server (0:196.64.129.62)
[11:35:20] [chat] [Dark]: test
[11:35:26] [part] Dark has left the server (0:1)
Hope you help me
Re: I can't register or Login -
solstice_ - 03.02.2018
Do you even have a login & register system
Re: I can't register or Login -
JohnRastion - 03.02.2018
Yes i have login and register systems
Re: I can't register or Login -
solstice_ - 03.02.2018
Can you post the code?
Re: I can't register or Login -
Sew_Sumi - 03.02.2018
Quote:
Originally Posted by willbedie
Can you post the code?
|
^^
OP, if this is a new script, you should not be using such outdated plugins. If it's an old script, and it's using those plugins, then you'll want to look at whether you want to keep it and update it, or make a new one.
Re: I can't register or Login -
JohnRastion - 03.02.2018
This is the login and register system, I m using old script
PHP код:
#include <a_samp>
#include <a_mysql>
#include <logintextdraws-en>
#define MYSQL_HOST "127.0.0.1" //IP Adresse from the MySQL Server
#define MYSQL_USER "server_44" //Username to sign in
#define MYSQL_PASS "dark123" //Password from the user
#define MYSQL_DBSE "server_44_cnr" //Name from the database
new MySQL:handle; //The connection handle which we need later to acces the tables
//Dialog IDs (you may change them if they're already taken)
#define DIALOG_REGISTER 1403
#define DIALOG_LOGIN 2401
enum pDataEnum
{
p_id,
bool:pLoggedIn,
pName[MAX_PLAYER_NAME],
pLevel,
pMoney,
pKills,
pDeaths
}
new PlayerInfo[MAX_PLAYERS][pDataEnum];
public OnFilterScriptInit()
{
MySQL_SetupConnection();
return 1;
}
public OnFilterScriptExit()
{
mysql_close(handle);
return 1;
}
public OnPlayerConnect(playerid)
{
CreatePlayerLoginTextDraws(playerid);
PlayerInfo[playerid][p_id] = 0;
PlayerInfo[playerid][pLoggedIn] = false;
PlayerInfo[playerid][pLevel] = 0;
PlayerInfo[playerid][pMoney] = 0;
PlayerInfo[playerid][pKills] = 0;
PlayerInfo[playerid][pDeaths] = 0;
GetPlayerName(playerid, PlayerInfo[playerid][pName], MAX_PLAYER_NAME);
return 1;
}
public OnPlayerRequestClass(playerid)
{
//If the player enters the class selection, we check if he's already logged in
if(!PlayerInfo[playerid][pLoggedIn])
{
//If not, we check if he got already an account
//We send a query and call a new callback
new query[128];
mysql_format(handle, query, sizeof(query), "SELECT id FROM users WHERE name = '%e'", PlayerInfo[playerid][pName]);
mysql_pquery(handle, query, "OnUserCheck", "d", playerid);
}
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
if(!PlayerInfo[playerid][pLoggedIn])
{
SendClientMessage(playerid, -1, "{FF0000}You've to login before you're able to spawn yourself!");
return 0;
}
return 1;
}
public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
{
if(playertextid == PlayerLoginTextDraw[playerid][0])
{
if(pRegistered[playerid] == true)
{
ShowPlayerDialog(playerid, DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login", "Please login to your account:", "Ok", "Cancel");
}
else
{
ShowPlayerDialog(playerid, DIALOG_REGISTER,DIALOG_STYLE_PASSWORD,"Registration", "Please register yourself:", "Ok", "Cancel");
}
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_REGISTER)
{
//The player has selected cancel
if(!response) return Kick(playerid);
//If the player has typed nothing or a short password
if(strlen(inputtext) < 3) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Registration", "Please register yourself:\n{FF0000}At least 3 character!", "Ok", "Cancel");
//If everything is alright, we insert the user into the databse
//We encode the password with the MD5 hash
new query[256];
mysql_format(handle, query, sizeof(query), "INSERT INTO users (name, password) VALUES ('%e', MD5('%e'))", PlayerInfo[playerid][pName], inputtext);
//The query is sent and we call OnUserRegister
mysql_pquery(handle, query, "OnUserRegister", "d", playerid);
return 1;
}
if(dialogid == DIALOG_LOGIN)
{
//The player has selected cancel
if(!response) return Kick(playerid);
//If the player has typed nothing or a short password
if(strlen(inputtext) < 3) return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Please login to your account:\n{FF0000}At least 3 charachter!", "Ok", "Cancel");
//If everything is alright, we read from the database
new query[256];
mysql_format(handle, query, sizeof(query), "SELECT * FROM users WHERE name = '%e' AND password = MD5('%e')", PlayerInfo[playerid][pName], inputtext);
//The query is sent and we call OnUserLogin
mysql_pquery(handle, query, "OnUserLogin", "d", playerid);
return 1;
}
return 0;
}
public OnPlayerDisconnect(playerid, reason)
{
//We save the player when he leave the server
SaveUserStats(playerid);
DestroyPlayerLoginTextDraws(playerid);
return 1;
}
forward OnUserCheck(playerid);
public OnUserCheck(playerid)
{
new rows;
cache_get_row_count(rows);
if(rows == 0)
{
//The player was not found, he has to register
PlayerIsNotRegistered(playerid);
ShowLoginTextDraws(playerid);
}
else
{
//The account exist, he has to login
PlayerIsRegistered(playerid);
ShowLoginTextDraws(playerid);
}
return 1;
}
forward OnUserRegister(playerid);
public OnUserRegister(playerid)
{
PlayerInfo[playerid][p_id] = cache_insert_id();
PlayerInfo[playerid][pLoggedIn] = true;
SendClientMessage(playerid, 0x00FF00FF, "[Account] Registration succesful.");
PlayerPlaySound(playerid, 1057 , 0.0, 0.0, 0.0);
HideLoginTextDraws(playerid);
return 1;
}
forward OnUserLogin(playerid);
public OnUserLogin(playerid)
{
new rows;
cache_get_row_count(rows);
if(rows == 0)
{
//The player has typed in a wrong password
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Please login to your account:\n{FF0000}Wrong password!", "Ok", "Cancel");
}
else
{
//The player has typed in his correct password
cache_get_value_name_int(0, "id", PlayerInfo[playerid][p_id]);
cache_get_value_name_int(0, "level", PlayerInfo[playerid][pLevel]);
cache_get_value_name_int(0, "money", PlayerInfo[playerid][pMoney]);
cache_get_value_name_int(0, "kills", PlayerInfo[playerid][pKills]);
cache_get_value_name_int(0, "deaths", PlayerInfo[playerid][pDeaths]);
PlayerInfo[playerid][pLoggedIn] = true;
SendClientMessage(playerid, 0x00FF00FF, "[Account] Signed in.");
PlayerPlaySound(playerid, 1057 , 0.0, 0.0, 0.0);
GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]);
HideLoginTextDraws(playerid);
}
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
//Example Code
if(killerid != INVALID_PLAYER_ID)
{
PlayerInfo[killerid][pKills]++;
GivePlayerMoney(killerid, 10);
PlayerInfo[killerid][pMoney] += 10;
if(PlayerInfo[killerid][pKills] > 3)
{
PlayerInfo[killerid][pLevel] = 1;
}
}
PlayerInfo[playerid][pDeaths]++;
return 1;
}
stock SaveUserStats(playerid)
{
//If the player is not logged in, we don't save his account
if(!PlayerInfo[playerid][pLoggedIn]) return 1;
//If he has an account, we save it
new query[256];
mysql_format(handle, query, sizeof(query), "UPDATE users SET level = '%d', money = '%d', kills = '%d', deaths = '%d' WHERE id = '%d'",
PlayerInfo[playerid][pLevel], PlayerInfo[playerid][pMoney], PlayerInfo[playerid][pKills], PlayerInfo[playerid][pDeaths], PlayerInfo[playerid][p_id]);
//Query sent
mysql_pquery(handle, query);
return 1;
}
stock MySQL_SetupConnection(ttl = 3)
{
print("[MySQL] Connecting to the database...");
mysql_log(); //<- Remove the // to activate the Debug Mode
handle = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS, MYSQL_DBSE);
if(mysql_errno(handle) != 0)
{
if(ttl > 1)
{
//We try again to connect to the database
print("[MySQL] The connection to the databse was not succesful.");
printf("[MySQL] Try again (TTL: %d).", ttl-1);
return MySQL_SetupConnection(ttl-1);
}
else
{
//Cancel and close the server
print("[MySQL] The connection to the database was not succesful.");
print("[MySQL] Please check the MySQL Login Information.");
print("[MySQL] Shutting server down");
return SendRconCommand("exit");
}
}
printf("[MySQL] The connection to the database was succesful! Handle: %d", _:handle);
return 1;
}
Re: I can't register or Login -
Sew_Sumi - 03.02.2018
If that is everything that relates to the MySQL portion, you're in a good position to update the script via the tutorials.
I think there's 2 you will need considering the age of it. You'll update from the R5 to the R30~, and then to the R40+.
If there is more code relating to the MySQL interactions, then it may be a bit more work, but definitely worth it.
The differences in these versions are quite a bit, but they work very different as the threaded vs non-threaded is a major advancement.
Read up a lot before commiting to full changes.
https://sampforum.blast.hk/showthread.php?tid=575103
https://sampforum.blast.hk/showthread.php?tid=616103
Re: I can't register or Login -
Fratello - 03.02.2018
What've you done?
CNRSF has already built in User Control Panel system (Login/Register). Another login/registration isn't required at all. Also, this will mess up with the native CNRSF's login / registration.
Remove the new login & register system. If there is no dialog after you connect to the server, try putting ˝cnrsf.sql˝ file into the database which you use.
Re: I can't register or Login -
JohnRastion - 03.02.2018
whole of script is good no bug but i can't login or register, i tried to re connect the mysql but same problem
Re: I can't register or Login -
Sew_Sumi - 03.02.2018
Is the MySQL server showing any logs, or are there any logs from the MySQL plugin?
Maybe it's having issues even connecting to it.