I can't register or Login
#1

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:08password ""  (string)
[
11:17:08
[
11:17:08Server Plugins
[11:17:08] --------------
[
11:17:08]  Loading plugincrashdetect.so
[11:17:08]   CrashDetect v4.15.1 is OK.
[
11:17:08]   Loaded.
[
11:17:08]  Loading pluginstreamer.so
[11:17:08]   Loaded.
[
11:17:08]  Loading pluginmysql.so
[11:17:08
  > 
MySQL plugin R6 successfully loaded.
[
11:17:08]   Loaded.
[
11:17:08]  Loading pluginmysql_static.so
[11:17:08]  SA:MP MySQL Plugin v2.1.1 Loaded.
[
11:17:08]   Loaded.
[
11:17:08]  Loading pluginsscanf.so
[11:17:08
[
11:17:08]  ===============================
[
11:17:08]       sscanf plugin loaded.     
[
11:17:08]          Version:  2.8.1        
[11:17:08]    (c2012 Alex "******" Cole  
[11:17:08]  ===============================
[
11:17:08]   Loaded.
[
11:17:08]  Loaded 5 plugins.
[
11:17:09] [MySQLThread runningThreadsafeYes.
[
11:17:09
[
11:17:09Ban list
[
11:17:09] --------
[
11:17:09]  Loadedsamp.ban
[11:17:09
[
11:17:09
[
11:17:09Filterscripts
[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:23Loading Vehicles
[11:17:23] (1LoadedOwner24
[11:17:23] (2LoadedOwner24
[11:17:23] (3LoadedOwner24
[11:17:23] (4LoadedOwner24
[11:17:23] (5LoadedOwner24
[11:17:23] (6LoadedOwner24
[11:17:23] (7LoadedOwner24
[11:17:23] (8LoadedOwner110781
[11:17:23] (9LoadedOwner110781
[11:17:23] (10LoadedOwner335
[11:17:23] (11LoadedOwner335
[11:17:23] (12LoadedOwner340
[11:17:23] (13LoadedOwner466
[11:17:23] (14LoadedOwner335
[11:17:23] (15LoadedOwner329
[11:17:23] (16LoadedOwner767
[11:17:23] (17LoadedOwner329
[11:17:23] (18LoadedOwner329
[11:17:23] (19LoadedOwner329
[11:17:23] (20LoadedOwner735
[11:17:23] (21LoadedOwner219
[11:17:23] (22LoadedOwner776
[11:17:23] (23LoadedOwner776
[11:17:23] (25LoadedOwner776
[11:17:23] (26LoadedOwner776
[11:17:23] (27LoadedOwner776
[11:17:23] (29LoadedOwner776
[11:17:23] (30LoadedOwner293
[11:17:23] (31LoadedOwner293
[11:17:23] (32LoadedOwner293
[11:17:23] (33LoadedOwner293
[11:17:23] (34LoadedOwner293
[11:17:23] (35LoadedOwner293
[11:17:23] (36LoadedOwner293
[11:17:23] (38LoadedOwner783
[11:17:23] (39LoadedOwner326
[11:17:23] (40LoadedOwner326
[11:17:23] (41LoadedOwner326
[11:17:23] (42LoadedOwner776
[11:17:23] (44LoadedOwner616
[11:17:23] (45LoadedOwner2
[11:17:23] (46LoadedOwner2
[11:17:23] (47LoadedOwner1
[11:17:23] (48LoadedOwner40
[11:17:23] (50LoadedOwner40
[11:17:23] (51LoadedOwner40
[11:17:23] (52LoadedOwner23
[11:17:23] (53LoadedOwner40
[11:17:23] (54LoadedOwner23
[11:17:23] (56LoadedOwner3
[11:17:23] (57LoadedOwner40
[11:17:23] (58LoadedOwner23
[11:17:23] (59LoadedOwner56
[11:17:23] (60LoadedOwner56
[11:17:23] (61LoadedOwner40
[11:17:23] (62LoadedOwner3
[11:17:23] (64LoadedOwner56
[11:17:23] (65LoadedOwner56
[11:17:23] (67LoadedOwner56
[11:17:23] (68LoadedOwner40
[11:17:23] (69LoadedOwner56
[11:17:23] (72LoadedOwner56
[11:17:23] (73LoadedOwner1
[11:17:23] (74LoadedOwner1
[11:17:23] (75LoadedOwner1
[11:17:23] (76LoadedOwner1
[11:17:23] (77LoadedOwner3
[11:17:23] (78LoadedOwner96
[11:17:23] (79LoadedOwner125
[11:17:23] (80LoadedOwner125
[11:17:23] (81LoadedOwner125
[11:17:23] (82LoadedOwner125
[11:17:23] (83LoadedOwner125
[11:17:23] (84LoadedOwner125
[11:17:23] (85LoadedOwner7
[11:17:24
-----------------------------------
[
11:17:24UGCNR Cops And Robbers by Dark
[11:17:24] ------------------------------------
[
11:17:24Number of vehicle models98
[11:34:56] [connectionincoming connection196.64.129.62:57870 id0
[11:34:56
[
11:34:56Ban list
[
11:34:56] --------
[
11:34:56]  Loadedsamp.ban
[11:34:56
[
11:34:56] [joinDark has joined the server (0:196.64.129.62)
[
11:35:20] [chat] [Dark]: test
[11:35:26] [partDark has left the server (0:1
Hope you help me
Reply
#2

Do you even have a login & register system
Reply
#3

Yes i have login and register systems
Reply
#4

Can you post the code?
Reply
#5

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.
Reply
#6

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(playeridPlayerInfo[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(handlequerysizeof(query), "SELECT id FROM users WHERE name = '%e'"PlayerInfo[playerid][pName]);
        
mysql_pquery(handlequery"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(playeridPlayerText:playertextid)
{
    if(
playertextid == PlayerLoginTextDraw[playerid][0])
      {
        if(
pRegistered[playerid] == true)
        {
              
ShowPlayerDialog(playeridDIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login""Please login to your account:""Ok""Cancel");
        }
        else
        {
              
ShowPlayerDialog(playeridDIALOG_REGISTER,DIALOG_STYLE_PASSWORD,"Registration""Please register yourself:""Ok""Cancel");
        }
      }
      return 
0;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    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(playeridDIALOG_REGISTERDIALOG_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(handlequerysizeof(query), "INSERT INTO users (name, password) VALUES ('%e', MD5('%e'))"PlayerInfo[playerid][pName], inputtext);
        
//The query is sent and we call OnUserRegister
        
mysql_pquery(handlequery"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(playeridDIALOG_LOGINDIALOG_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(handlequerysizeof(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(handlequery"OnUserLogin""d"playerid);
        return 
1;
    }
    return 
0;
}
public 
OnPlayerDisconnect(playeridreason)
{
    
//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(playerid0x00FF00FF"[Account] Registration succesful.");
    
PlayerPlaySound(playerid1057 0.00.00.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(playeridDIALOG_LOGINDIALOG_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(playerid0x00FF00FF"[Account] Signed in.");
        
PlayerPlaySound(playerid1057 0.00.00.0);
        
GivePlayerMoney(playeridPlayerInfo[playerid][pMoney]);
        
HideLoginTextDraws(playerid);
    }
    return 
1;
}
public 
OnPlayerDeath(playeridkilleridreason)
{
    
//Example Code
    
if(killerid != INVALID_PLAYER_ID)
    {
        
PlayerInfo[killerid][pKills]++;
        
GivePlayerMoney(killerid10);
        
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(handlequerysizeof(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(handlequery);
    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_HOSTMYSQL_USERMYSQL_PASSMYSQL_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;

Reply
#7

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
Reply
#8

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.
Reply
#9

whole of script is good no bug but i can't login or register, i tried to re connect the mysql but same problem
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)