Jump to content
  • 0

Problema start server


Blade

Question

Problema intalnita (descriere): Am facut un gamemode cu un system de logare, dar cand il pornesc nu vrea sa plece..
Ero(area / rile) / warning-(ul / urile): -
Liniile de cod / sursa / script-ul(obligatoriu): am incerca sa sterg linia din conectarea mysql din gamemode si dupia o plecat
Imagini / Video (optional): linia conectare mysql 

 

public OnGameModeInit()

{
    MySQLConnect();
    return 1;
}
 
forward MySQLConnect();
public MySQLConnect()
 {
    sqldb = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_BASE, MYSQL_PASS);
    if(sqldb && mysql_errno(sqldb) == 0)
    {
        printf("[MYSQL]: Connection to database (%s) was established!", MYSQL_BASE);
    }
    else
    {
        printf("[MYSQL]: Connection to database (%s) failed!", MYSQL_BASE);
        SendRconCommand("exit");
    }
    return 1;
}

Am incarcat sa rezolv dar nu am reusit

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Nu se poate conecta la baza de date.

Verifica daca ai instalat corect baza de date.

Ofer servicii de web designer/developer(contact me pentru portofoliu etc)

Metode de plata: Paysafecard,Skrill,PayPal,Bitcoin

Ofer si servicii de Penetration Testing.

Vand si VPN-uri. 5 euro pe luna

Skype: live:mrtunne.tkcode

Discord: https://mrtunne.info/discord

Link to comment
Share on other sites

  • 0

Verifica si daca ai scris corect datele de la baza de date.

Nu mai deschideti in pu*a mea servere de SA:MP !

Jucati-va pe cele care sunt !   Sunt suficiente !

Reguli de bun simt:

1. Nu faceti reclama unde nu trebuie !

2. Nu injurati ca la usa cortului !

3. Daca esti analfabeti, taci din gura !

4. Nu abuza de 'scuze', 'din greseala' !

 

My work ::: http://pastebin.com/VRNRcaAs

Link to comment
Share on other sites

  • 0

Conexiunea la baza de date este buna.. eu am facut un script la onplayerconenct casa selecteze din bans si dupaia sa selecteze din players

 

va las scriptul:

public OnPlayerConnect(playerid)
{
    gLogged[playerid] = 0;
	//
    new pName[MAX_PLAYERS];
	new qstr[612];
	new string[128];
	GetPlayerName(playerid, pName, sizeof(pName));
	format(qstr,sizeof(qstr), "SELECT * FROM bans WHERE `Nick` = '%s'", pName);
	mysql_query(sqldb, qstr);
	mysql_store_result();
	if(mysql_num_rows())
	{
		SendClientMessage(playerid, COLOR_SAMP,"You are banned from this server!");
        format(string, sizeof(string), "Post an unban request on http://%s", website_forum);
        SendClientMessage(playerid, COLOR_SAMP, string);
		SetTimerEx("KickTimer", 500, false, "d", playerid);
	}
	else
	{
		LogRegCheck(playerid);
	}
	mysql_free_result();
	//
	TogglePlayerSpectating(playerid, 1);
	return 1;
}

forward LogRegCheck(playerid);
public LogRegCheck(playerid)
{
    new pName[MAX_PLAYERS];
	new qstr[612];
	new string[128];
	new result[456];
	GetPlayerName(playerid, pName, sizeof(pName));
	format(qstr,sizeof(qstr), "SELECT * FROM players WHERE `Nick` = '%s'", pName);
	mysql_query(sqldb, qstr);
	mysql_store_result();
	if(mysql_num_rows())
	{
	    if(mysql_retrieve_row())
      	{
      	    mysql_fetch_field_row(result, "Registered"); PlayerInfo[playerid][pRegistered] = strval(result);
			mysql_fetch_field_row(result, "LastLogin"); PlayerInfo[playerid][pLastLogin] = strval(result);
      	}
      	//
      	if(PlayerInfo[playerid][pRegistered] == 1)
		{
	        format(string,sizeof(string),"{BECBFC}Welcome back, {95A3FF}%s{BECBFC}!nnPlease enter your password below to login to your account.nn{FFFFFF}* Last login: %s *",pName, PlayerInfo[playerid][pLastLogin]);
			ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"Account Login",string,"Login","Quit");
			InterpolateCameraPos(playerid, 795.448364, -1035.059692, 63.971153, 1488.203491, -1731.146484, 72.215118, 30000);
			InterpolateCameraLookAt(playerid, 791.667602, -1038.115844, 62.802383, 1490.974975, -1727.566528, 70.093200, 20000);
			PlayAudioStreamForPlayer(playerid, "http://playzed.ro/music/intro.mp3");
			logintimer = SetTimer("LoginTimer", 30000, false);
		}
		else
		{
			format(string,sizeof(string),"{BECBFC}Welcome {95A3FF}%s{BECBFC}!nnPlease enter your password below to login to your account.",pName);
            ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"Account Registration",string,"Register","Quit");
		}
	}
	else
	{
		format(string,sizeof(string),"{BECBFC}Welcome to the server, {95A3FF}%s{BECBFC}!nnPlease register an account by entering your desired password below.",pName);
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,"Account Registration",string,"Register","Quit");
	}
	mysql_free_result();
	return 1;
}

forward OnPlayerRegister(playerid, password[]);
public OnPlayerRegister(playerid, password[])
{
    new pName[MAX_PLAYERS];
	new qstr[200];
	new string[128];
	GetPlayerName(playerid, pName, sizeof(pName));
	format(qstr,sizeof(qstr),"INSERT INTO `players` (`Nick`,`password`) VALUES ('%s',MD5('%s'))", pName, password);
	mysql_query(sqldb, qstr);
	//
    format(string, sizeof(string), "Please enter your password below to login to your account.");
    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", string, "Login", "Exit");
	return 1;
}

forward OnPlayerLogin(playerid, password[]);
public OnPlayerLogin(playerid, password[])
{
    new pName[MAX_PLAYERS];
	new qstr[256];
	new result[456];
	GetPlayerName(playerid, pName, sizeof(pName));
	format(qstr,sizeof(qstr), "SELECT * FROM players WHERE `Nick` = '%s' AND `Password` = MD5('%s')", pName, password);
	mysql_query(sqldb, qstr);
	mysql_store_result();
	if(mysql_num_rows())
	{
	    if(mysql_retrieve_row())
      	{
			mysql_fetch_field_row(result, "ID"); PlayerInfo[playerid][pID] = strval(result);
			mysql_fetch_field_row(result, "Nick"); format(PlayerInfo[playerid][pNick], MAX_PLAYERS, result);
			mysql_fetch_field_row(result, "Password"); format(PlayerInfo[playerid][pPassword], 32, result);
			mysql_fetch_field_row(result, "AdminLevel"); PlayerInfo[playerid][pAdmin] = strval(result);
			mysql_fetch_field_row(result, "HelperLevel"); PlayerInfo[playerid][pHelper] = strval(result);
			mysql_fetch_field_row(result, "PremiumAccount"); PlayerInfo[playerid][pPremiumAccount] = strval(result);
			//mysql_fetch_field_row(result, "Registered"); PlayerInfo[playerid][pRegistered] = strval(result);
			mysql_fetch_field_row(result, "Tutorial"); PlayerInfo[playerid][pTutorial] = strval(result);
			mysql_fetch_field_row(result, "RegisterDate"); PlayerInfo[playerid][pRegistered] = strval(result);
			//mysql_fetch_field_row(result, "LastLogin"); PlayerInfo[playerid][pLastLogin] = strval(result);
			mysql_fetch_field_row(result, "IP"); PlayerInfo[playerid][pIP] = strval(result);
			
			WhenPlayerLoggedIn(playerid);
		}
	}
	else
	{
		ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Account Login", "Password doesn't match your name!nPlease reenter your password below to login your account.", "Login", "Quit");
	}
	mysql_free_result();
	return 1;
}

forward WhenPlayerLoggedIn(playerid);
public WhenPlayerLoggedIn(playerid)
{
    new pName[MAX_PLAYERS];
	GetPlayerName(playerid, pName, sizeof(pName));
	
    if(PlayerInfo[playerid][pRegistered] == 0)
	{
	
	}
	
	KillTimer(logintimer);
	printf("%s has logged in.", pName);
	gLogged[playerid] = 1;
	return 1;
}
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.