30.09.2018, 01:29
entгo estou com o seguinte problema, quando reinicio meu server para atualizar a GM todas a informaзхes da tabela da conta do player й zerado nгo sei porquк, meu sistema й em mysql
peguem leve nas criticas, aprendi MYSQL agora, nгo tenho muita experiencia
PHP Code:
public OnPlayerRequestClass(playerid, classid)
{
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
for(new i; i < sizeof(NomesProibido); i++)
{
if(strfind(aname, NomesProibido[i], true) != -1)
{
new String[50];
format(String, sizeof(String), "[ANT-SPAM]o Jogador %s foi banido, Motivo: Nome Spam",aname);
SendClientMessageToAll(INFOA, String);
Kick(playerid);
}
}
SetSpawnInfo(playerid, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
TogglePlayerSpectating(playerid, 1);
return 1;
}
public OnPlayerConnect(playerid)
{
SetTimer("pStatus", 900, false);
new aname[MAX_PLAYER_NAME], Query[500], file[35], String[350];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file),"banidos/%s",aname);
if(strfind(aname, "_", true) != -1){}
else { ShowPlayerDialog(playerid, DIALOG_ERRO_NAME, DIALOG_STYLE_MSGBOX, "ERRO", "{FF5555}» {FFFF00}Formato de nome incorreto \n{FF5555}» {FFFF00}O formato deve ser: Nome_Sobrenome \n{FF5555}» {FFFF00}Em seu nome nгo deve conter caracteres especiais \n{FF5555}» {FFFF00}Nгo use nome de pessoas famosas \n\n\n{FF5555}» {FF5555}Relogue e mude seu nome","OK","");}
if(!DOF2_FileExists(file))
{
FomeA[playerid] = CreateProgressBar(548.035290, 58.083332, 57.5, 4.19, 0xFFFF00FF, 100.0);
SedeA[playerid] = CreateProgressBar(548.035290, 34.083332, 57.5, 4.19, 0x0000FFFF, 100.0);
format(Query, sizeof(Query), "SELECT * FROM `contas` WHERE `nome`='%s'", aname);
mysql_tquery(Conexao, Query, "ProcurarPlayer", "i", playerid);
}
else {
format(String, sizeof(String), "{FFFF00}Administrador que baniu: {5EAF03}%s \n\n {FFFF00}Dia do banimento: {5EAF03}%s \n {FFFF00}Hora do banimento: {5EAF03}%s \n {FFFF00}Desban: {5EAF03}%s \n\n {FFFF00}Motivo: {FFFFFF}%s", DOF2_GetString(file, "Adm"), DOF2_GetString(file, "Data"), DOF2_GetString(file, "Hora"), DOF2_GetString(file, "Desban"), DOF2_GetString(file, "motivo"));
ShowPlayerDialog(playerid, DIALOG_BAN, DIALOG_STYLE_MSGBOX, "BANIDO", String, "Fechar", "");
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
if(logado[playerid] == 1) { SalvarDados(playerid); }
return 1;
}
forward ProcurarPlayer(playerid);
public ProcurarPlayer(playerid)
{
new aname[MAX_PLAYER_NAME], Data[12];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
if(cache_num_rows() > 0)
{
cache_get_value(0, "senha", Senha[playerid]);
cache_get_value(0, "email", Email[playerid]);
cache_get_value(0, "data", Data);
logado[playerid] = 0;
for(new i; i < 21; i++) TextDrawShowForPlayer(playerid, TextLogin[i]);
SelectTextDraw(playerid, 0xFFFF00FF);
TextDrawSetString(TextLogin[16], aname);
TextDrawSetString(TextLogin[15], Data);
SCM(playerid, INFOA, "Login");
}
else {
SelectTextDraw(playerid, 0xFFFF00FF);
for(new i; i < 16; i++) TextDrawShowForPlayer(playerid, TextRegistro[i]);
SCM(playerid, INFOA, "Registro");
}
return 1;
}
stock SalvarDados(playerid)
{
new aname[MAX_PLAYER_NAME], Arquivo[999], dia, mes, ano;
GetPlayerName(playerid, aname, sizeof(aname));
getdate(ano, mes, dia);
GetPlayerPos(playerid, PlayerInfo[playerid][pSaveX], PlayerInfo[playerid][pSaveY], PlayerInfo[playerid][pSaveZ]);
PlayerInfo[playerid][pDinheiro] = GetPlayerMoney(playerid);
PlayerInfo[playerid][pSkin] = GetPlayerSkin(playerid);
GetPlayerHealth(playerid, PlayerInfo[playerid][pVida]);
GetPlayerArmour(playerid, PlayerInfo[playerid][pColete]);
format(Arquivo, sizeof(Arquivo), "UPDATE `contas` SET senha = '%s', email = '%s', admin = %d, skin = %d, dinheiro = %08d, vida = %f, colete = %f, sx = %f, sy = %f, sz = %f, data = %d%d%d, fome = %d, sede = %d WHERE nome = '%s'",
Senha[playerid],
Email[playerid],
PlayerInfo[playerid][pAdmin],
PlayerInfo[playerid][pSkin],
PlayerInfo[playerid][pDinheiro],
PlayerInfo[playerid][pVida],
PlayerInfo[playerid][pColete],
PlayerInfo[playerid][pSaveX],
PlayerInfo[playerid][pSaveY],
PlayerInfo[playerid][pSaveZ],
dia, mes, ano,
PlayerInfo[playerid][pFome],
PlayerInfo[playerid][pSede],
aname);
mysql_tquery(Conexao, Arquivo);
printf("%s", Arquivo);
return 1;
}