SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Tutorials

Reply
 
Thread Tools Display Modes
Old 31/01/2011, 08:31 AM   #31
HyperZ
High-roller
 
HyperZ's Avatar
 
Join Date: Aug 2009
Location: Pakistan
Posts: 1,394
Reputation: 66
Default Re: Easy MySQL Register/Login system!

Quote:
Originally Posted by Delux13 View Post
That's hardly bugged mate, I register and when I rejoin and I try to login it says I'm not registered.
+1

Same here.
__________________
HyperZ is offline   Reply With Quote
Old 05/02/2011, 02:00 PM   #32
jesse237
Big Clucker
 
Join Date: Apr 2008
Posts: 113
Reputation: 1
Default Re: Easy MySQL Register/Login system!

Code:
SavePlayer(playerid)
{
	if(!PlayerLogged[playerid])
		return 0;

    	UserStats[playerid][Money] = GetPlayerMoney(playerid);
    

	CheckMySQL();
    
    	new string[256];
    	format(string, sizeof(string), "UPDATE Users SET Password='%s',Admin='%d',Money='%d' WHERE Name='%s'", UserStats[playerid][Password], UserStats[playerid][Admin], UserStats[playerid][Money], UserStats[playerid][Name]);
    	mysql_query(string);
    	return 1;
}
I am having some issues with the code above. I tried adding more .. but I get thess errors:

Code:
C:\SA-MP servers\The Roleplay Server\gamemodes\MySQL.pwn(1183) : error 075: input line too long (after substitutions)
C:\SA-MP servers\The Roleplay Server\gamemodes\MySQL.pwn(1184) : error 037: invalid string (possibly non-terminated string)
C:\SA-MP servers\The Roleplay Server\gamemodes\MySQL.pwn(1184) : error 017: undefined symbol "UPDATE"
C:\SA-MP servers\The Roleplay Server\gamemodes\MySQL.pwn(1184) : error 029: invalid expression, assumed zero
C:\SA-MP servers\The Roleplay Server\gamemodes\MySQL.pwn(1184) : fatal error 107: too many error messages on one line
I know this has something to do with .. too many charactars/ being too long inside the format function, but I'm no mastermind and can't figure out how to fix it currently. I know it has to be shortened to fix it probably, but I need all of them.
my code:

Code:
stock SavePInfo(playerid)
{
	if(GetPVarInt(playerid, "LoggedIN") == 1)
	{
		new Query[600];

		format(Query, sizeof(Query), "UPDATE `playerinfo` SET `kills` = %d, `deaths` = %d, `money` = %d, `Level` = %d, `Last Pos X` = %f, `Last Pos Y` = %f, `Last Pos Z` = %f, `Interior` = %d, `PMstatus` = %d, `Phonenumber` = %d, `Strength` = %d, `Jailtime` = %d, `Prisontime` = %d, `FactionID` = %d, `FactionRank` = %d, `FactionName` = %s, `RadioFreq` = %d, `PaycheckTime` = %d, `Gun0` = %d, `Gun1` = %d, `Gun2` = %d, `Gun3` = %d, `Gun4` = %d WHERE `user` = '%s'", // Also remember to update this...

		PVar[playerid][pKills],
		PVar[playerid][pDeaths],
		GetPlayerMoney(playerid),
		PVar[playerid][pAdminLevel],
		PVar[playerid][pLastX],
		PVar[playerid][pLastY],
		PVar[playerid][pLastZ],
		GetPlayerInterior(playerid),
		PVar[playerid][pPMstatus],
		PVar[playerid][pPhoneNumber],
		PVar[playerid][pStrentgh],
		PVar[playerid][pJailtime],
		PVar[playerid][pPrisontime],
		PVar[playerid][pFaction],
		PVar[playerid][pFactionRank],
		PVar[playerid][pFactionName],
		PVar[playerid][pRadioFrequency],
		PVar[playerid][pPaycheckTime],
		PVar[playerid][pGun0],
		PVar[playerid][pGun1],
		PVar[playerid][pGun2],
		PVar[playerid][pGun3],
		PVar[playerid][pGun4],
		pName(playerid));
		
		new Query2[600];
		format(Query, sizeof(Query), "UPDATE `playerinfo` SET `Ammo0` = %d, `Ammo1` = %d, `Ammo2` = %d, `Ammo3` = %d, `Ammo4` = %d, `IDnumber` = %d, `CarKey1` = %d, `Carkey2` = %d, `Carkey3` = %d,`WeaponLicense` = %d, `DrivingLicense` = %d, `Origin` = %d, `Sex` = %d, `BankPin` = %d, `Housekey1` = %d, `Housekey2` = %d, `Housekey3` = %d, `Bizkey1` = %d, `Bizkey2` = %d, `Bizkey3` = %d, `Rentkey` = %d, `Job` = %d, `Phonecontact1` = %d, `Phonecontact2` = %d, `Phonecontact3` = %d, `Phonecontact4` = %d WHERE `user` = '%s'", // Also remember to update this...
		
		PVar[playerid][pAmmo0],
		PVar[playerid][pAmmo1],
		PVar[playerid][pAmmo2],
		PVar[playerid][pAmmo3],
		PVar[playerid][pAmmo4],
		PVar[playerid][pIDnumber],
		PVar[playerid][pCarkey1],
		PVar[playerid][pCarkey2],
		PVar[playerid][pCarkey3],
		PVar[playerid][pWeaponLicense],
		PVar[playerid][pDrivingLicense],
		PVar[playerid][pOrigin],
		PVar[playerid][pSex],
		PVar[playerid][pBankpin],
		PVar[playerid][pHousekey1],
		PVar[playerid][pHousekey2],
		PVar[playerid][pHousekey3],
		PVar[playerid][pBizkey1],
		PVar[playerid][pBizkey2],
		PVar[playerid][pBizkey3],
		PVar[playerid][pRentkey],
		PVar[playerid][pJob],
		PVar[playerid][pPhoneContact1],
		PVar[playerid][pPhoneContact2],
		PVar[playerid][pPhoneContact3],
		PVar[playerid][pPhoneContact4],
		pName(playerid));
		
		new Query3[600];

		format(Query3, sizeof(Query3), "UPDATE `playerinfo` SET , `Phonecontact5` = %d, `Phonecontact6` = %d, `Phonecontact7` = %d, `Phonecontact8` = %d, `Phonecontact9` = %d, `Phonecontact10` = %d, `Phonecontact1` = %d, `Phonecontact11` = %d, `Phonecontact12` = %d, `Phonecontact13` = %d, `Phonecontact14` = %d, `Phonecontact15` = %d, `Jobcheckpoints` = %d, `Accent` = %d, `Virtualworld` = %d WHERE `user` = '%s'", // Also remember to update this...
		
		PVar[playerid][pPhoneContact5],
		PVar[playerid][pPhoneContact6],
		PVar[playerid][pPhoneContact7],
		PVar[playerid][pPhoneContact8],
		PVar[playerid][pPhoneContact9],
		PVar[playerid][pPhoneContact10],
		PVar[playerid][pPhoneContact11],
		PVar[playerid][pPhoneContact12],
		PVar[playerid][pPhoneContact13],
		PVar[playerid][pPhoneContact14],
		PVar[playerid][pPhoneContact15],
		PVar[playerid][pJobCheckpoints],
		PVar[playerid][pAccent],
		PVar[playerid][pVirtualWorld],
		pName(playerid));

		mysql_query(Query);
		mysql_query(Query2);
		mysql_query(Query3);
		mysql_free_result();
		return 1;
	}
	else return 0;
}
__________________

www.-.com - where roleplay really starts...(coming soon)
jesse237 is offline   Reply With Quote
Old 11/10/2011, 01:04 PM   #33
TheLazySloth
Huge Clucker
 
TheLazySloth's Avatar
 
Join Date: Aug 2011
Location: United States > California > Los Angeles County > Antellope Valley > Lancaster
Posts: 402
Reputation: 31
Default Re: Easy MySQL Register/Login system!

What about Floats? In the loading system.
__________________
I'm in the Script Help section helping people the best I can.

Guidelines:
I won't respond to your help thread IF there's 2 or more posts already and I havn't previously viewed it.

I won't respond to your help thread IF the title doesn't relate to the question.

I won't respond to your help thread IF it isn't in understandable English.

If I've HELPED you and SOLVED your problem, +rep is appreciated but not expected.

"This forum requires that you wait 120 seconds between posts. Please try again in 69 seconds." Is the reason I'm probably not responding swiftly, so be patient.
TheLazySloth is offline   Reply With Quote
Old 22/02/2012, 04:29 AM   #34
falor
Huge Clucker
 
Join Date: Dec 2007
Posts: 208
Reputation: 0
Default Re : Easy MySQL Register/Login system!

I did it, but when i'm connected to my server, i have absolutely no message from your script

And if i do /register it does nothing

i'm kinda lost
__________________
Création d'un serveur rôleplay innovant et unique, et bénéficiant de mysql : rejoignez-nous sur: http://dev.thralle.com/
falor is offline   Reply With Quote
Old 22/02/2012, 11:02 AM   #35
ArmyOps
Big Clucker
 
Join Date: Feb 2012
Posts: 89
Reputation: 2
Default Re: Easy MySQL Register/Login system!

is it secured of injecting?
ArmyOps is offline   Reply With Quote
Old 23/02/2012, 12:43 AM   #36
swindle69
Little Clucker
 
Join Date: Nov 2010
Posts: 22
Reputation: 0
Default Re: Easy MySQL Register/Login system!

this is just the worse... i can code in C++ and create my own scripts just fine, but when it comes to pawn..
well..
i fucking hate pawn..
swindle69 is offline   Reply With Quote
Old 26/02/2012, 08:48 AM   #37
ValenRatti
Huge Clucker
 
ValenRatti's Avatar
 
Join Date: Apr 2011
Posts: 407
Reputation: 5
Default Respuesta: Easy MySQL Register/Login system!

Uhm, any help about the id? I mean, iv put on the table a column(idk if its a column) which was ids which it auto increments, but i dont know how to apply that to the sv =S, anyways, very useful tut. =)
ValenRatti is offline   Reply With Quote
Old 19/07/2012, 02:33 PM   #38
x96664
Gangsta
 
x96664's Avatar
 
Join Date: Jun 2009
Posts: 599
Reputation: 7
Default Re: Easy MySQL Register/Login system!

It's not working!
-When I enter the server and type /register (it doesn't matter did I type password or no) it tells me that I'm already registered!
-When I login , I can do it with any password ! (for an example : I enter the server and type /login 1234 it shows me message that I'm succesfully logged in! When I restart the server and enter it again and type /login 123456 it again shows me that I'm succesfully logged in).
-Also must it save the money ? Before restarting the server I had about 20k $ and when I restarted the server I had 0$.. (Is it not saving the data in database or I didn't make as it's shown ?
x96664 is offline   Reply With Quote
Old 04/12/2012, 01:22 AM   #39
Yashas
Gangsta
 
Join Date: Jun 2012
Location: India
Posts: 875
Reputation: 266
Default Re: Easy MySQL Register/Login system!

error 017: undefined symbol "mysql_query"

Only "mysql_query" ,other functions work!!
I am using R7 Windows Version of MySQL.
Yashas is offline   Reply With Quote
Old 04/12/2012, 04:00 PM   #40
x96664
Gangsta
 
x96664's Avatar
 
Join Date: Jun 2009
Posts: 599
Reputation: 7
Default Re: Easy MySQL Register/Login system!

Quote:
Originally Posted by Yashas View Post
error 017: undefined symbol "mysql_query"

Only "mysql_query" ,other functions work!!
I am using R7 Windows Version of MySQL.
Change with older plugin R5 or R6
x96664 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 11:03 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.