SA-MP Forums Archive
MYSQL Database problem 2 - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: MYSQL Database problem 2 (/showthread.php?tid=577999)



MYSQL Database problem 2 - darkowner - 15.06.2015

Hello guys, I have another problem with the database on mysql.
I gave someone level 1 admin on the server,then I restarted the server cause I made some changes,I looked in the database,and his level was still 0,not 1.Everything is well configured.
Thank you for reading,hope you can help me.
PS:My server is hosted.


AW: MYSQL Database problem 2 - Mencent - 15.06.2015

Hello!

Maybe it is a mistake in your save-function. Can you share this function with us?

- Mencent


Re: AW: MYSQL Database problem 2 - darkowner - 15.06.2015

Quote:
Originally Posted by Mencent
Посмотреть сообщение
Hello!

Maybe it is a mistake in your save-function. Can you share this function with us?

- Mencent :cool:
This?:
Код HTML:
//------------------------------------------------------------------
            //MySQL INSERT
            //------------------------------------------------------------------
			format(rQuery, 4096, "INSERT INTO `Accounts` (`ID`, `Name`, `Password`, `IP`, `E-Mail`, `LoggedIn`, `RegisterDate`, `LastOn`, `Level`, `VIP`, `Cash`, `Score`, `Coins`, `Credits`, \
											  `Headshots`, `Kills`, `Deaths`, `Hours`, `Minutes`, `Seconds`, `BestKillings`, `KillingSpree`, `FavSkin`, `UseSkin`, `House`, `Property`, \
											  `Description1`, `Description2`, `Description3`, `Positive`, `Negative`, `ClanID`, `ClanRank`, `ClanPoints`, `ClanKills`, `ClanDeaths`,");
			//------------------------------------------------------------------
			format(rQuery, 4096, "%s `Kicks`, `Bans`, `Jails`, `Warns`, `ClearChats`, `ReactionTest`, `MathTest`, `Mutes`, `Jailed`, `JailTime`, `Frozen`, `FreezeTime`, `Muted`, `MuteTime`, \
											  `RaceScore`, `StuntScore`, `DriftScore`, `GangID`, `GangRank`, `GangSkin`, `GangKills`, `GangDeaths`, `GangWarns`, `GangCaptures`, `GangPoints`, \
											  `Ignores`, `LottoNumber`, `C4`, `StatsNote`, `VIPTime`, `FreeVIP`, `TempVIP`, `RLSClan`, `RLSRank`, `AdmWarns`, `VIPWarns`, `KickW`)", rQuery);
			//------------------------------------------------------------------
			format(rQuery, 4096, "%s VALUES (0, '%s', '%s', '%s', 'changeme@etrion.ro', '1', '%02d/%02d/%02d', '%02d/%02d/%02d', \
											'0', '0', '25000', '100', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '217', '1', '0', '0', \
											' ', ' ', ' ', '0', '0', '0', '0', '0', '0', '0', \
											'0', '0', '0', '0', '0', '0', '0', '0', '0', '00:00', '0', '00:00', '0', '00:00', \
											'0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', \
											'0/0/0/0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0')", rQuery, PlayerName(playerid), rPassword, GetPlayerIPEx(playerid), liDay, liMonth, liYear, liDay, liMonth, liYear);
			//------------------------------------------------------------------
			mysql_tquery(DB_Connect, rQuery, "OnAccountCreated", "i", playerid);
			//------------------------------------------------------------------



Re: MYSQL Database problem 2 - Konstantinos - 15.06.2015

Check the mysql logs (in case it fails to update on disconnect or when the command is used) + use default values in those fields you know their initial value in INSERT statement. By doing that, it will reduce the query a lot.


Re: MYSQL Database problem 2 - darkowner - 16.06.2015

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Check the mysql logs (in case it fails to update on disconnect or when the command is used) + use default values in those fields you know their initial value in INSERT statement. By doing that, it will reduce the query a lot.
I change the values that I provided above which are in gamemode?
What do I change them to?
I'm a newbie on samp scripting, so I'm asking you to help me step by step if you want to of course.


Re: MYSQL Database problem 2 - mamorunl - 16.06.2015

If you set the admin level of the user, do you save it to the database with a UPDATE query?


Re: MYSQL Database problem 2 - darkowner - 16.06.2015

Quote:
Originally Posted by mamorunl
Посмотреть сообщение
If you set the admin level of the user, do you save it to the database with a UPDATE query?
Shouldn't it be saving automatically?
By the way, I don't even what query is.


Re: MYSQL Database problem 2 - mamorunl - 16.06.2015

No, nothing in your server is saving automatically. You have to save it either by a timer running every x seconds/minutes or by executing a query when an action has performed.


Re: MYSQL Database problem 2 - darkowner - 16.06.2015

Quote:
Originally Posted by mamorunl
Посмотреть сообщение
No, nothing in your server is saving automatically. You have to save it either by a timer running every x seconds/minutes or by executing a query when an action has performed.
Okay,I got it,now the question is,how do I execute a query?


Re: AW: MYSQL Database problem 2 - mamorunl - 17.06.2015

Quote:
Originally Posted by darkowner
Посмотреть сообщение
Okay,I got it,now the question is,how do I execute a query?
Quote:
Originally Posted by darkowner
Посмотреть сообщение
This?:
Код HTML:
//------------------------------------------------------------------
            //MySQL INSERT
            //------------------------------------------------------------------
			format(rQuery, 4096, "INSERT INTO `Accounts` (`ID`, `Name`, `Password`, `IP`, `E-Mail`, `LoggedIn`, `RegisterDate`, `LastOn`, `Level`, `VIP`, `Cash`, `Score`, `Coins`, `Credits`, \
											  `Headshots`, `Kills`, `Deaths`, `Hours`, `Minutes`, `Seconds`, `BestKillings`, `KillingSpree`, `FavSkin`, `UseSkin`, `House`, `Property`, \
											  `Description1`, `Description2`, `Description3`, `Positive`, `Negative`, `ClanID`, `ClanRank`, `ClanPoints`, `ClanKills`, `ClanDeaths`,");
			//------------------------------------------------------------------
			format(rQuery, 4096, "%s `Kicks`, `Bans`, `Jails`, `Warns`, `ClearChats`, `ReactionTest`, `MathTest`, `Mutes`, `Jailed`, `JailTime`, `Frozen`, `FreezeTime`, `Muted`, `MuteTime`, \
											  `RaceScore`, `StuntScore`, `DriftScore`, `GangID`, `GangRank`, `GangSkin`, `GangKills`, `GangDeaths`, `GangWarns`, `GangCaptures`, `GangPoints`, \
											  `Ignores`, `LottoNumber`, `C4`, `StatsNote`, `VIPTime`, `FreeVIP`, `TempVIP`, `RLSClan`, `RLSRank`, `AdmWarns`, `VIPWarns`, `KickW`)", rQuery);
			//------------------------------------------------------------------
			format(rQuery, 4096, "%s VALUES (0, '%s', '%s', '%s', 'changeme@etrion.ro', '1', '%02d/%02d/%02d', '%02d/%02d/%02d', \
											'0', '0', '25000', '100', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '217', '1', '0', '0', \
											' ', ' ', ' ', '0', '0', '0', '0', '0', '0', '0', \
											'0', '0', '0', '0', '0', '0', '0', '0', '0', '00:00', '0', '00:00', '0', '00:00', \
											'0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', \
											'0/0/0/0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0')", rQuery, PlayerName(playerid), rPassword, GetPlayerIPEx(playerid), liDay, liMonth, liYear, liDay, liMonth, liYear);
			//------------------------------------------------------------------
			mysql_tquery(DB_Connect, rQuery, "OnAccountCreated", "i", playerid);
			//------------------------------------------------------------------
Like this. You can check the parameters on the sa-mp wiki for the plugin you are using