Jump to content

Question

Posted

Problema intalnita (descriere): Am incercat sa fac un sistem de cont putin mai avansat,(pentru mine), insa nu salveaza in baza de date.
Ero(area / rile) / warning-(ul / urile): CMySQLQuery::Execute[OnPlayerRegisterd] - (error #1065) Query was empty 
Liniile de cod / sursa / script-ul(obligatoriu): 

	if(dialogid == D_REGISTER)
	{
	    if(!response)
	    	return KickEx(playerid);
	 	if(response)
	 	{
	 	    new query[1024], query2[2000];
	 		if(!strlen(inputtext))
  				return SPD(playerid, D_REGISTER, DSP, "SERVER: Register", "{CA4F21}ERROR Message: {8EB2D8}Nu ai introdus nici o parola.\n Introdu o porola pentru a-ti crea contul", "Register", "Exit");
			// Create register callbreck
			new i[22];
			GetPlayerIp(playerid, i, sizeof(i));
			strmid(query2, "INSERT INTO `accounts`(`ID`, `Username`, `Password`, `IP`, `Mail`, `Age`, `Sex`, `City`, `Admin`, `Helper`, `Premium`, `Leader`, `Member`, `Rank`, `FPunish`, `FWarn`, `CMember`, `CRank`, `CPunish`, `CWarn`, `Job`, `Skill1`, `Skill2`, `Skill3`, `Skill4`, `Bank`, `Money`, `Score`, `Skin`, `Respect`, `Cars1`, `Cars2`, `Cars3`, `Cars4`, ", 0, 255, sizeof(query2));
			strmid(query2, "`House`, `Bussines`, `DriveLic`, `FlyLic`, `BoatLic`, `GunLic`, `DriveLicT`, `FlyLicT`, `BoatLicT`, `GunLicT`, `Materials`, `Drugs`, `Arrest`, `Jail`, `Crimes`, `Deaths`, `Warn`, `Banned`, `Mute`, `MuteTime`, `Freeze`, `FreezeTime`, `Wanted`, `Color`, `FightingStyle`, `Rent`, , `RentPrice`, `RentPX`, `RentPY`, `RentPZ`, `RentPR`, `Interior`, `AfkTime`, `PlayedTime`, `Registred`, `LLogin`)", 255, 255, sizeof(query2));
            strmid(query2, " VALUES ('','%s','%s','%s','NULL','','','NULL','','','','','','','','','','','','','','','','','','','','','','',''", 255, 255, sizeof(query2));
		 	strmid(query2, ",'','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','0','%s','NULL');", 255, 255, sizeof(query2));

            mysql_format(cHandle, query, sizeof(query), query2, GetNameEx(playerid), inputtext, i, RegDate());
			mysql_pquery(cHandle, query, "OnPlayerRegisterd", "i", playerid);
			RPM(playerid);
			GPM(playerid, 10000);
			SetPlayerScore(playerid, 1);
			SetPlayerSkin(playerid, 2);
			SPD(playerid, D_EMAIL, DIALOG_STYLE_INPUT, "SERVER: Email", "Introdu un email.\nVa ajuta la recuperarea parolei/cont", "Urmatorul", "");
 		}
	}


Imagini / Video (optional): http://i.imgur.com/mGOHxhE.png
Ati incercat sa rezolvati singur?: Da, dar nu imi dau seama de unde este problema .

"Mulţi programatori buni fac programare nu pentru că se aşteaptă să câştige bani sau să fie lăudaţi de public, ci pentru că e amuzant să programezi." - Linus Torvalds

9 answers to this question

Recommended Posts

  • 0
  • 0
Posted
public OnPlayerRegisterd(playerid)
{
    PI[playerid][uID] = cache_insert_id(cHandle);
    printf("MySQL Bot: Player with ID: %d has been registred !", playerid);
	return 1;
}
stock GetNameEx(playerid)
{
	new Name[MAX_PLAYER_NAME];
	GetPlayerName(playerid, Name, sizeof(Name));
	return Name;
}

stock RegDate()
{
	new date[32], yr, mh, dy, h, m, s;
	getdate(yr, mh, dy), gettime(h, m, s);
	format(date, sizeof(date), "%02d-%02d-%02d - %02d:%02d:%02d", dy, mh, yr, h, m, s);
	return date;
}

 

"Mulţi programatori buni fac programare nu pentru că se aşteaptă să câştige bani sau să fie lăudaţi de public, ci pentru că e amuzant să programezi." - Linus Torvalds

  • 0
Posted (edited)

La PI[playerid][uID]; uID este AUTO_INCREMENT?

Sunt ametit si te-as ruga sa-mi spui la ce te astepti sa se intample din aceasta secventa?

mysql_format(cHandle, query, sizeof(query), query2, GetNameEx(playerid), inputtext, i, RegDate());
			mysql_pquery(cHandle, query, "OnPlayerRegisterd", "i", playerid);

Este ok asa? Explica putin te rog ce e aici :) Multumesc!

Edited by DCosmin
  • 0
Posted

Cred ca asta ar trebui sa fie asa :

 

mysql_format(cHandle, query, sizeof(query), query2, GetNameEx(playerid), inputtext, i, RegDate());
mysql_tquery(cHandle, query, "OnPlayerRegisterd", "d", playerid);

 

  • 0
Posted

@DCosmin da este pe AUTO_INCREMENT

iar aici:

mysql_format(cHandle, query, sizeof(query), query2, GetNameEx(playerid), inputtext, i, RegDate());
			mysql_pquery(cHandle, query, "OnPlayerRegisterd", "i", playerid);

query2 = cu ce se va salva in cont;

iar query = nush ce face, sunt incepator.

"Mulţi programatori buni fac programare nu pentru că se aşteaptă să câştige bani sau să fie lăudaţi de public, ci pentru că e amuzant să programezi." - Linus Torvalds

  • 0
Posted
mysql_format(cHandle, query2, sizeof(query), "INSERT INTO `accounts`(`ID`, `Username`, `Password`, `IP`, `Mail`, `Age`, `Sex`, `City`, `Admin`, `Helper`, `Premium`, `Leader`, `Member`, `Rank`, `FPunish`, `FWarn`, `CMember`, `CRank`, `CPunish`, `CWarn`, `Job`, `Skill1`, `Skill2`, `Skill3`, `Skill4`, `Bank`, `Money`, `Score`, `Skin`, `Respect`, `Cars1`, `Cars2`, `Cars3`, `Cars4`, ", sizeof(query2));
mysql_format(cHandle, query2, sizeof(query), "%s `House`, `Bussines`, `DriveLic`, `FlyLic`, `BoatLic`, `GunLic`, `DriveLicT`, `FlyLicT`, `BoatLicT`, `GunLicT`, `Materials`, `Drugs`, `Arrest`, `Jail`, `Crimes`, `Deaths`, `Warn`, `Banned`, `Mute`, `MuteTime`, `Freeze`, `FreezeTime`, `Wanted`, `Color`, `FightingStyle`, `Rent`, , `RentPrice`, `RentPX`, `RentPY`, `RentPZ`, `RentPR`, `Interior`, `AfkTime`, `PlayedTime`, `Registred`, `LLogin`)", query2, sizeof(query2));
mysql_format(cHandle, query2, sizeof(query), "%s VALUES ('','%s','%s','%s','NULL','','','NULL','','','','','','','','','','','','','','','','','','','','','','',''", query2, sizeof(query2));
mysql_format(cHandle, query2, sizeof(query), "%s '','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','0','%s','NULL');", query2, sizeof(query2));

mysql_pquery(cHandle, query2, "OnPlayerRegisterd", "i", playerid);

Incearca asa si daca nu merge, spune-mi.

242086.png

  • 0
Posted (edited)

Ar merge daca nu ar afisa aceasta eroare !

 

F:\r39\gamemodes\r39.pwn(822) : warning 204: symbol is assigned a value that is never used: "query"
Pawn compiler 3.2.3664              Copyright (c) 1997-2006, ITB CompuPhase


1 Warning.

Edit: Erori noi...

fdrd_t10.png

sa-mp-10.png

Edited by Staark

"Mulţi programatori buni fac programare nu pentru că se aşteaptă să câştige bani sau să fie lăudaţi de public, ci pentru că e amuzant să programezi." - Linus Torvalds

  • 0
Posted

Multumesc tuturor pentru ajutor, am rezolvat !

Se poate inchide topicul.

"Mulţi programatori buni fac programare nu pentru că se aşteaptă să câştige bani sau să fie lăudaţi de public, ci pentru că e amuzant să programezi." - Linus Torvalds

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.