26.03.2018, 09:16
Getting information, n other stuff.
In this part i'm showing the list of the players in the work/faction, it's ok in this part.
It might sound weird, but spName[playerid] I'm writing from that script upper, till the first ",", it's much easier for me like that. And it works, so problem not here, I can see the online players information, but if player offline - "GetPlayeridMid(spName[playerid]) == INVALID_PLAYER_ID", this part doesn't even want to work. Not even giving a single print, the only print I get is printf("ERROR - - - Haven't found information ");, and the log about that:
In this part i'm showing the list of the players in the work/faction, it's ok in this part.
PHP код:
format( g_szBuffer, 500, "SELECT * FROM `users` WHERE WorkId > '-1'");
new Cache:Data = mysql_query( dbHandle, g_szBuffer );
new num = cache_num_rows();
new wName[MAX_PLAYER_NAME], jobId, wWarns, wContract, str[220], fstr[500], dStatus[20];
format(str, sizeof(str),"Ћaidėjas\tStatusas\tĮspėjimų sk.\tKontrakto pabaiga\n", wName, dStatus, wWarns, likusdata(wContract));
strcat(fstr, str);
for( new i; i < num; i++ ){
jobId = cache_get_field_content_int( i, "WorkId" );
wWarns = cache_get_field_content_int( i, "WorkWarns" );
wContract = cache_get_field_content_int( i, "WorkContract" );
cache_get_field_content( i, "pName", wName );
if(player[playerid][pWorkLeader] == jobId)
{
if(GetPlayeridMid(wName) != INVALID_PLAYER_ID) { dStatus = "prisijungęs"; } else { dStatus = "atsijunges"; }
format(str, sizeof(str),"%s,\t(%s),\t%i,\t%s\n", wName, dStatus, wWarns, likusdata(wContract));
strcat(fstr, str);
}
}
if(!num){
SendError(playerid, "jūsų frakcijoje nėra darbuotojų !");
cache_delete( Data );
return 1;
}
PHP код:
[09:48:39] [DEBUG] mysql_query - connection: 1, query: "SELECT * FROM `users` WHERE WorkId > '-1'", use_cache: true
[09:48:39] [DEBUG] CMySQLQuery::Execute - starting query execution
[09:48:39] [DEBUG] CMySQLQuery::Execute - query was successfully executed within 0.601 milliseconds
[09:48:39] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[09:48:39] [DEBUG] CMySQLHandle::SaveActiveResult - cache saved (id: 13)
[09:48:39] [DEBUG] cache_get_row_count - connection: 1
[09:48:39] [DEBUG] cache_get_field_content_int - row: 0, field_name: "WorkId", connection: 1
[09:48:39] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "WorkId", data: "3"
[09:48:39] [DEBUG] cache_get_field_content_int - row: 0, field_name: "WorkWarns", connection: 1
[09:48:39] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "WorkWarns", data: "0"
[09:48:39] [DEBUG] cache_get_field_content_int - row: 0, field_name: "WorkContract", connection: 1
[09:48:39] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "WorkContract", data: "1522636574"
[09:48:39] [DEBUG] cache_get_field_content - row: 0, field_name: "pName", connection: 1, max_len: 24
[09:48:39] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "pName", data: "Snaky_Snakess"
[09:48:39] [DEBUG] cache_get_field_content_int - row: 1, field_name: "WorkId", connection: 1
[09:48:39] [DEBUG] CMySQLResult::GetRowDataByName - row: '1', field: "WorkId", data: "3"
[09:48:39] [DEBUG] cache_get_field_content_int - row: 1, field_name: "WorkWarns", connection: 1
[09:48:39] [DEBUG] CMySQLResult::GetRowDataByName - row: '1', field: "WorkWarns", data: "0"
[09:48:39] [DEBUG] cache_get_field_content_int - row: 1, field_name: "WorkContract", connection: 1
[09:48:39] [DEBUG] CMySQLResult::GetRowDataByName - row: '1', field: "WorkContract", data: "1522060574"
[09:48:39] [DEBUG] cache_get_field_content - row: 1, field_name: "pName", connection: 1, max_len: 24
[09:48:39] [DEBUG] CMySQLResult::GetRowDataByName - row: '1', field: "pName", data: "Blatant_Snake"
[09:48:39] [DEBUG] cache_delete - cache_id: 13, connection: 1
[09:48:40] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[09:48:40] [DEBUG] CMySQLHandle::DeleteSavedResult - result deleted
PHP код:
[09:48:41] [DEBUG] mysql_query - connection: 1, query: "SELECT * FROM `users` WHERE WorkId > '-1'", use_cache: true
[09:48:41] [DEBUG] CMySQLQuery::Execute - starting query execution
[09:48:41] [DEBUG] CMySQLQuery::Execute - query was successfully executed within 0.360 milliseconds
[09:48:41] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[09:48:41] [DEBUG] CMySQLHandle::SaveActiveResult - cache saved (id: 13)
[09:48:41] [DEBUG] cache_get_row_count - connection: 1
[09:48:41] [DEBUG] cache_delete - cache_id: 13, connection: 1
[09:48:41] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[09:48:41] [DEBUG] CMySQLHandle::DeleteSavedResult - result deleted
PHP код:
if(GetPlayeridMid(spName[playerid]) == INVALID_PLAYER_ID){
new jobId, wWarns, wContract,workRank, dStatus[20], str[450];
if(GetPlayeridMid(spName[playerid]) != INVALID_PLAYER_ID) { dStatus = "prisijungęs"; } else { dStatus = "atsijungęs"; }
printf("loading information 1");
format( g_szBuffer, 500, g_szBuffer, "SELECT * FROM `users` WHERE `pName` = '%s'", spName[playerid]);
printf("loading information 2");
new Cache:Data = mysql_query( dbHandle, g_szBuffer );
printf("loading information 3");
new num = cache_num_rows();
printf("loading information 3");
if(num == 1)
{
printf("loading information 4");
jobId = cache_get_field_content_int( 0, "WorkId" );
wWarns = cache_get_field_content_int( 0, "WorkWarns" );
wContract = cache_get_field_content_int( 0, "WorkContract" );
workRank = cache_get_field_content_int( 0, "WorkRank" );
format(str, 350, "{ffffff}Informacija apie darbuotoją:\n \n{d8a9ff}•{ffffff} %s darbuotojas ( {d8a9ff}%s{ffffff} ),\n{d8a9ff}•{ffffff} darbuotojo turimi įsp. {d8a9ff}%i{ffffff},\n{d8a9ff}•{ffffff} Kontraktas baigiasi {d8a9ff}%s{ffffff},\n{d8a9ff}•{ffffff} ћaidėjo būsena {d8a9ff}%s{ffffff}",spName[playerid],getPlayerRank(jobId, workRank),wWarns, likusdata(wContract), dStatus);
ShowPlayerDialog(playerid, 872, DIALOG_STYLE_MSGBOX ,"Informacija apie darbuotoją", str, "Atgal", "");
cache_delete(Data);
printf("loading information 5");
}
else
{
SendError(playerid, "duomenys neaptikti duomenų bazėje.");
printf("ERROR - - - Haven't found information "); // љita iљprintina
cache_delete(Data);
}