26.01.2010, 07:38
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:
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;
}

