mysql score saving. - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: mysql score saving. (
/showthread.php?tid=123499)
mysql score saving. -
ajwar - 26.01.2010
Hi,
I am trying to make a score saving with mysql (G-sTyLeZzZ plugin). And something is wrong, the script saves the information to database, but not load's it when player is connects. So here is my code:
Код:
case LOGIN_THREAD_ID:
{
if(IsPlayerConnected(LOGIN_PLAYER_ID))
{
mysql_store_result();
if(mysql_num_rows() == 1)
{
PlayerMoney[LOGIN_PLAYER_ID] = mysql_fetch_int();
GivePlayerMoney(LOGIN_PLAYER_ID,PlayerMoney[LOGIN_PLAYER_ID]);
Score[LOGIN_PLAYER_ID] = mysql_fetch_int();
SetPlayerScore(LOGIN_PLAYER_ID,Score[LOGIN_PLAYER_ID]);
LoggedIn[LOGIN_PLAYER_ID] = true;
format(string,sizeof(string),">> You have been successfully logged in. (Money: %d), (Score: %d) ",PlayerMoney[LOGIN_PLAYER_ID], Score[LOGIN_PLAYER_ID]);
SendClientMessage(LOGIN_PLAYER_ID,GREY,string);
mysql_free_result();
}
else
{
Wrongattempt[LOGIN_PLAYER_ID] += 1;
printf("Bad log in attempt by %s (Total attempts: %d)",pName,Wrongattempt[LOGIN_PLAYER_ID]);
if(Wrongattempt[LOGIN_PLAYER_ID] >= 3)
{
SendClientMessage(LOGIN_PLAYER_ID,RED,">> You have been kicked.( 3 times wrong pass )");
mysql_free_result();
return Kick(LOGIN_PLAYER_ID);
}
mysql_free_result();
SendClientMessage(LOGIN_PLAYER_ID,RED,">> Wrong Password");
}
}
LOGIN_PLAYER_ID = INVALID_PLAYER_ID;
return 0;
}
Re: mysql score saving. -
maltheus. - 26.01.2010
And i have fucking problem with score,i was all trying but dont load...It looks no help for us.
Re: mysql score saving. -
ajwar - 26.01.2010
no ideas ?