14.02.2016, 18:46
O sistema de registro/login em mysql tб criando a conta, mas nгo tб salvando os dados do players que ele conseguiu jogando.
pawn Код:
stock SalvarDados(playerid)
{
if(PlayerInfo[playerid][Logado] == false) return 1;
new Float:X, Float:Y, Float:Z, Query[320];
GetPlayerPos(playerid, Float:X, Float:Y, Float:Z);
mysql_format(Conexao, Query, sizeof(Query), "UPDATE `usuarios` SET `Admin`='%d', `Sexo`='%d', `Idade`='%d', `Dinheiro`='%d', `Skin`='%d', `Matou`='%d', `Morreu`='%d', `PosX`=%.1f, `PosY`=%.1f, `PosZ`=%.1f WHERE `ID`='%d'",
PlayerInfo[playerid][Admin],
PlayerInfo[playerid][Sexo],
PlayerInfo[playerid][Idade],
GetPlayerMoney(playerid),
PlayerInfo[playerid][Skin],
PlayerInfo[playerid][Matou],
PlayerInfo[playerid][Morreu],
Float:X,
Float:Y,
Float:Z,
PlayerInfo[playerid][ID]);
mysql_tquery(Conexao, Query,"DadosSalvos","d", playerid);
return 1;
}
stock CarregarDados(playerid)
{
TirarTextDraw(playerid);
CancelSelectTextDraw(playerid);
SetPlayerScore(playerid, PlayerInfo[playerid][Level]);
GivePlayerMoney(playerid, PlayerInfo[playerid][Dinheiro]);
SetSpawnInfo(playerid, 0, PlayerInfo[playerid][Skin], PlayerInfo[playerid][Pos][0], PlayerInfo[playerid][Pos][1], PlayerInfo[playerid][Pos][2], 269.15, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
SendClientMessage(playerid, -1, "Sua conta foi carregada com sucesso!");
PlayerInfo[playerid][Logado] = true;
return 1;
}
forward Mysql_Carregar(playerid);
public Mysql_Carregar(playerid)
{
PlayerInfo[playerid][Admin] = cache_get_field_content_int(0, "Admin");
PlayerInfo[playerid][Sexo] = cache_get_field_content_int(0, "Sexo");
PlayerInfo[playerid][Idade] = cache_get_field_content_int(0, "Idade");
PlayerInfo[playerid][Dinheiro] = cache_get_field_content_int(0, "Dinheiro");
PlayerInfo[playerid][Skin] = cache_get_field_content_int(0, "Skin");
PlayerInfo[playerid][Matou] = cache_get_field_content_int(0, "Matou");
PlayerInfo[playerid][Morreu] = cache_get_field_content_int(0, "Morreu");
PlayerInfo[playerid][Pos][0] = cache_get_field_content_int(0, "PosX");
PlayerInfo[playerid][Pos][1] = cache_get_field_content_int(0, "PosY");
PlayerInfo[playerid][Pos][2] = cache_get_field_content_int(0, "PosZ");
CarregarDados(playerid);
return 1;
}