Jump to content
  • 0

Problema incarcare date mysql


Question

Posted (edited)

Problema intalnita (descriere): Nu incarca datele adica nustiu.. dar cand le folosesc nu spune datele corecte din mysql
Ero(area / rile) / warning-(ul / urile): Nu incarca bine datele

Liniile de cod / sursa / script-ul(obligatoriu):

 

forward WhenPlayerLogin(playerid);
public WhenPlayerLogin(playerid)
{
new query[128];
new string[128];
    new rows, fields;
cache_get_data(rows, fields);
if(rows)
{
   //cache_get_field_content(0, "ID", temp); PlayerInfo[playerid][pID] = strval(temp);
   //cache_get_field_content(0, "Nick", temp); PlayerInfo[playerid][pNick] = strval(temp);
   //cache_get_field_content(0, "password", temp),  format(PlayerInfo[playerid][pPassword], 32, temp);
   cache_get_field_content(0, "AdminLevel", temp); PlayerInfo[playerid][pAdmin] = strval(temp);
   cache_get_field_content(0, "HelperLevel", temp); PlayerInfo[playerid][pHelper] = strval(temp);
   cache_get_field_content(0, "PremiumAccount", temp); PlayerInfo[playerid][pPremiumAccount] = strval(temp);
   cache_get_field_content(0, "Registered", temp); PlayerInfo[playerid][pRegistered] = strval(temp);
   cache_get_field_content(0, "Tutorial", temp); PlayerInfo[playerid][pTutorial] = strval(temp);
   cache_get_field_content(0, "Language", temp); PlayerInfo[playerid][pLanguage] = strval(temp);
   cache_get_field_content(0, "Email", temp),  format(PlayerInfo[playerid][pEmail], 255, temp);
   cache_get_field_content(0, "Referral", temp); PlayerInfo[playerid][pReferral] = strval(temp);
   cache_get_field_content(0, "Sex", temp); PlayerInfo[playerid][pSex] = strval(temp);
   cache_get_field_content(0, "Skin", temp); PlayerInfo[playerid][pSkin] = strval(temp);
   cache_get_field_content(0, "RegisterDate", temp); PlayerInfo[playerid][pRegisterDate] = strval(temp);
   cache_get_field_content(0, "LastLogin", temp); PlayerInfo[playerid][pLastLogin] = strval(temp);
   cache_get_field_content(0, "IP", temp); PlayerInfo[playerid][pIP] = strval(temp);
   
   new Year, Month, Day, Hour, Minute, Second;
   getdate(Year, Month, Day);
   gettime(Hour, Minute, Second);
   
   if(PlayerInfo[playerid][pRegistered] == 0)
{
   format(string,sizeof(string), "%02d.%02d.%02d %02d:%02d", Day, Month, Year, Hour, Minute);
strmid(PlayerInfo[playerid][pRegisterDate], string, 0, strlen(string), 255);
Update(playerid, pRegisterDatex);
 
   PlayerInfo[playerid][pRegistered] = 1;
   Update(playerid, pRegisteredx);
}
 
format(string,sizeof(string), "%02d.%02d.%02d %02d:%02d", Day, Month, Year, Hour, Minute);
strmid(PlayerInfo[playerid][pLastLogin], string, 0, strlen(string), 255);
Update(playerid, pLastLoginx);
 
strmid(PlayerInfo[playerid][pIP], GetIP(playerid), 0, 100, 255);
Update(playerid, pIPx);
 
mysql_format(sqldb, query, sizeof(query) ,"INSERT INTO `playerlogs` (`ID`,`Nick`,`Time`,`IP`,`Type`) VALUES ('','%e','%02d.%02d.%02d %02d:%02d','%e','1')", GetName(playerid), Day, Month, Year, Hour, Minute, GetIP(playerid));
        mysql_query(sqldb, query);
 
if (PlayerInfo[playerid][pAdmin] >= 1)
{
format(string, sizeof(string), "SERVER: You're logged in as a level %d admin.", PlayerInfo[playerid][pAdmin]);
        SendClientMessage(playerid, COLOR_WHITE, string);
}
 
if (PlayerInfo[playerid][pHelper] >= 1)
{
format(string, sizeof(string), "SERVER: You're logged in as a level %d helper.", PlayerInfo[playerid][pHelper]);
SendClientMessage(playerid, COLOR_WHITE, string);
}
 
if (PlayerInfo[playerid][pPremiumAccount] >= 1)
{
SendClientMessage(playerid, COLOR_WHITE,"SERVER: You are a Premium Account user.");
}
 
StopAudioStreamForPlayer(playerid);
TogglePlayerSpectating(playerid, 0);
 
        SetSpawnInfo(playerid, PlayerInfo[playerid][pSkin], 0, 1642.3352, -2240.9292, 13.4945, 180.0000, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
 
KillTimer(logintimer);
printf("[iNFO]: %s has logged in !", GetName(playerid));
gLogged[playerid] = 1;
}
else
{
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Account Login", "Password doesn't match your name!nPlease reenter your password below to login your account.", "Login", "Quit");
}
return 1;
}

Imagini / Video (optional):-
Ati incercat sa rezolvati singur?:Da, am bagat o linie da la incarcare date.

Edited by Blade

3 answers to this question

Recommended Posts

  • 0
Posted

Inseamna ca nu ai facut corect conectarea cu baza de date, mai incearca o data, sterge si importa baza de date din nou . :D Verifica in gamemode sa fie datele trecute cum trebuie .

  • 0
Posted

Incearca asa

forward WhenPlayerLogin(playerid);
public WhenPlayerLogin(playerid)
{
new query[128];
new string[128];
new rows, fields;
cache_get_data(rows, fields);
if(rows)
{
 cache_get_field_content(0, "ID", temp); PlayerInfo[playerid][pID] = strval(temp);
 cache_get_field_content(0, "Nick", temp); PlayerInfo[playerid][pNick] = strval(temp);
 cache_get_field_content(0, "password", temp),  format(PlayerInfo[playerid][pPassword], 32, temp);
 cache_get_field_content(0, "AdminLevel", temp); PlayerInfo[playerid][pAdmin] = strval(temp);
 cache_get_field_content(0, "HelperLevel", temp); PlayerInfo[playerid][pHelper] = strval(temp);
 cache_get_field_content(0, "PremiumAccount", temp); PlayerInfo[playerid][pPremiumAccount] = strval(temp);
 cache_get_field_content(0, "Registered", temp); PlayerInfo[playerid][pRegistered] = strval(temp);
 cache_get_field_content(0, "Tutorial", temp); PlayerInfo[playerid][pTutorial] = strval(temp);
 cache_get_field_content(0, "Language", temp); PlayerInfo[playerid][pLanguage] = strval(temp);
 cache_get_field_content(0, "Email", temp),  format(PlayerInfo[playerid][pEmail], 255, temp);
 cache_get_field_content(0, "Referral", temp); PlayerInfo[playerid][pReferral] = strval(temp);
 cache_get_field_content(0, "Sex", temp); PlayerInfo[playerid][pSex] = strval(temp);
 cache_get_field_content(0, "Skin", temp); PlayerInfo[playerid][pSkin] = strval(temp);
 cache_get_field_content(0, "RegisterDate", temp); PlayerInfo[playerid][pRegisterDate] = strval(temp);
 cache_get_field_content(0, "LastLogin", temp); PlayerInfo[playerid][pLastLogin] = strval(temp);
 cache_get_field_content(0, "IP", temp); PlayerInfo[playerid][pIP] = strval(temp);
 
 new Year, Month, Day, Hour, Minute, Second;
 getdate(Year, Month, Day);
 gettime(Hour, Minute, Second);
 
 if(PlayerInfo[playerid][pRegistered] == 0)
{
 format(string,sizeof(string), "%02d.%02d.%02d %02d:%02d", Day, Month, Year, Hour, Minute);
strmid(PlayerInfo[playerid][pRegisterDate], string, 0, strlen(string), 255);
Update(playerid, pRegisterDatex);
 
 PlayerInfo[playerid][pRegistered] = 1;
 Update(playerid, pRegisteredx);
}
 
format(string,sizeof(string), "%02d.%02d.%02d %02d:%02d", Day, Month, Year, Hour, Minute);
strmid(PlayerInfo[playerid][pLastLogin], string, 0, strlen(string), 255);
Update(playerid, pLastLoginx);
 
strmid(PlayerInfo[playerid][pIP], GetIP(playerid), 0, 100, 255);
Update(playerid, pIPx);
 
mysql_format(sqldb, query, sizeof(query) ,"INSERT INTO `playerlogs` (`ID`,`Nick`,`Time`,`IP`,`Type`) VALUES ('','%e','%02d.%02d.%02d %02d:%02d','%e','1')", GetName(playerid), Day, Month, Year, Hour, Minute, GetIP(playerid));
mysql_query(sqldb, query);
 
if (PlayerInfo[playerid][pAdmin] >= 1)
{
format(string, sizeof(string), "SERVER: You're logged in as a level %d admin.", PlayerInfo[playerid][pAdmin]);
SendClientMessage(playerid, COLOR_WHITE, string);
}
 
if (PlayerInfo[playerid][pHelper] >= 1)
{
format(string, sizeof(string), "SERVER: You're logged in as a level %d helper.", PlayerInfo[playerid][pHelper]);
SendClientMessage(playerid, COLOR_WHITE, string);
}
 
if (PlayerInfo[playerid][pPremiumAccount] >= 1)
{
SendClientMessage(playerid, COLOR_WHITE,"SERVER: You are a Premium Account user.");
}
 
StopAudioStreamForPlayer(playerid);
TogglePlayerSpectating(playerid, 0);
 
SetSpawnInfo(playerid, PlayerInfo[playerid][pSkin], 0, 1642.3352, -2240.9292, 13.4945, 180.0000, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
 
KillTimer(logintimer);
printf("[INFO]: %s has logged in !", GetName(playerid));
gLogged[playerid] = 1;
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Account Login", "Password doesn't match your name!nPlease reenter your password below to login your account.", "Login", "Quit");
}
return 1;
}

Sau daca nu cum a zis si @NoNamed verifica conexiunea la baza de date,

  • 0
Posted

Conexiune este la baza de date, mam uitat si in mysql_log datele din baza de date vine incarcate dar nu vine setate pe PlayerInfo[playerid][pXXX];

 

Asta este unica problema.

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.