27.08.2017, 05:41
My problem is in ostats , /ostats <player name>
which i type player it doesn't show the dialog box of the offline player stats.!(means no respond)
here is my code!
LoadStats2 here
which i type player it doesn't show the dialog box of the offline player stats.!(means no respond)
here is my code!
Код:
CMD:offlinestats(playerid, params[]) return cmd_ostats(playerid, params); CMD:ostats(playerid, params[]) { if(pLogged[playerid] == false) { Error(playerid, "You must be logged in to check statistics!"); return true; } if(sscanf(params, "s[24]", tmp)) { Usage(playerid, "/ostats <player name>"); return true; } foreach(Player, ii) { GetPlayerName(ii, PlayerName, MAX_PLAYER_NAME); if(!strcmp(PlayerName, tmp, true)) { Error(playerid, "Player is online, you can use /stats on them."); return true; } } // Load User Data new cVar[500]; new cQuery[600]; strcat(cVar, "adminlevel,helper,hours,minutes,seconds,kills,deaths,money,score,premium,saveskin,cookies,events_won,races_won,MB_found,reg_time,last_time,"); strcat(cVar, "bmoney,rtests,arrests,killstreak,description,duels_won,fallouts,group_id,group_rank,derby_wins,cookiejars,spawnplace,maths,report_points"); new escaped_name[24]; mysql_real_escape_string(tmp, escaped_name); format(cQuery, sizeof(cQuery), "SELECT %s FROM players WHERE name='%s' LIMIT 1", cVar, escaped_name); MySQL_query(cQuery, true, "LoadStats2", "is", playerid, escaped_name); return true; }
Код:
function LoadStats2(playerid, PlayersName[]) { // Main Statistics if(MySQL_rowCount()) { cache_get_row(0, 0, pGroupName[p3]); } new line4[700]; new line3[2000]; new str3[80], str4[80], str7[80], str11[140]; switch(pAdmin[p3]) { case 0: { if(pPremium[p3] > 0) { if(pPremium[p3] == 3) { if(premiumExpired[p3] != 0) str3 = ""WHITE_E"Status: "WHITE_E"VIP (Temporary)"; else str3 = ""WHITE_E"Status: "WHITE_E"VIP"; } else { if(premiumExpired[p3] != 0) format(str3, sizeof(str3), ""WHITE_E"Status: "WHITE_E"VIP Member (Level: %d) (Temp)", pPremium[p3]); else format(str3, sizeof(str3), ""WHITE_E"Status: "WHITE_E"VIP Member (Level: %d)", pPremium[p3]); } } else str3 = ""LB2_E"Status: "WHITE_E"Regular Player"; } case 1: str3 = ""WHITE_E"Status: "WHITE_E"Moderator"; case 2: str3 = ""WHITE_E"Status: "WHITE_E"Administrator"; case 3: str3 = ""WHITE_E"Status: "WHITE_E"Lead Administrator"; case 4: str3 = ""WHITE_E"Status: "WHITE_E"Head Administrator"; case 5: str3 = ""WHITE_E"Status: "WHITE_E"Executive Administrator"; } if(pHidden[p3] != 0) str3 = ""WHITE_E"Status: "WHITE_E"Regular Player"; //new pCity[28]; /*if(pGroupID[p3] != -1) { format(str11, sizeof(str11), ""WHITE_E"Group: "WHITE_E"%s "RED_E"|| "WHITE_E"Rank: "WHITE_E"%s", pGroupName[p3], GangPositions[pGroupRank[p3]][E_gang_pos_name]); } else format(str11, sizeof(str11), ""WHITE_E"Group: "WHITE_E"None "RED_E"|| "WHITE_E"Rank: "WHITE_E"None");*/ /*GetPlayerCity(p3, pCity, sizeof(pCity)); format(str9, sizeof(str9), ""LB2_E"> Country: "WHITE_E"%s "RED_E"|| "LB2_E"City: "WHITE_E"%s "RED_E"|| "LB2_E"GMT: "WHITE_E"%d", pCountry[p3], pCity, GetPlayerGMT(p3));*/ //format(str9, sizeof(str9), ""LB2_E"> Country: "WHITE_E"- "RED_E"|| "LB2_E"City: "WHITE_E"- "RED_E"|| "LB2_E"GMT: "WHITE_E"-"); format(line4, sizeof(line4), ""WHITEP_E"%s's stats:\n\n%s\n\ "WHITE_E"Account ID: "WHITE_E"%d\n"WHITE_E"Score: "WHITE_E"%d\n"WHITE_E"Cookies: "WHITE_E"%d\n"WHITE_E"Money: "LG_E"$"WHITE_E"%s\n"LB2_E"Bank: "LG_E"$"WHITE_E"%s\n%s\n\n", PlayersName, str3, pRegID[p3], pScore[p3], pCookies[p3], ToCurrency(pCash[p3]), ToCurrency(BankMoney[p3]), str11); strcat(line3, line4); /// General Statistics if(pTotalHours[p3] == 0) { if(pTotalMinutes[p3] == 0) { format(str4, sizeof(str4), ""WHITE_E"Total Online Time: "WHITE_E"%d seconds", pTotalSeconds[p3]); } else format(str4, sizeof(str4), ""WHITE_E"Total Online Time: "WHITE_E"%d minutes and %d seconds", pTotalMinutes[p3], pTotalSeconds[p3]); } else format(str4, sizeof(str4), ""WHITE_E"Total Online Time: "WHITE_E"%d hours, %d minutes and %d seconds", pTotalHours[p3], pTotalMinutes[p3], pTotalSeconds[p3]); format(line4, sizeof(line4), ""WHITE_E"Register Date: "WHITE_E"%s\n"WHITE_E"Last Online: "WHITE_E"%s\n%s\n", pRegDate[p3], pLastDate[p3], str4); strcat(line3, line4); format(line4, sizeof(line4), ""WHITE_E"Kills: "WHITE_E"%d / "WHITE_E"Deaths: "WHITE_E"%d "RED_E"|| "WHITE_E"KDR: "WHITE_E"%0.2f\n"WHITE_E"Highest Killstreak: "WHITE_E"%d\n\ \n", pInfo[p3][pKills], pInfo[p3][pDeaths], Float:pInfo[p3][pKills]/Float:pInfo[p3][pDeaths], TotalKillStreak[p3]); strcat(line3, line4); // Other Statistics switch(pSpawnPlace[p3]) { case -1: str7 = ""WHITE_E"Spawn Place: "WHITE_E"Random."; case 0: str7 = ""WHITE_E"Spawn Place: "WHITE_E"San Fierro"; case 1: str7 = ""WHITE_E"Spawn Place: "WHITE_E"Bayside"; case 2: str7 = ""WHITE_E"Spawn Place: "WHITE_E"Abandoned Airport"; case 3: str7 = ""WHITE_E"Spawn Place: "WHITE_E"Las Venturas Airport"; case 4: str7 = ""WHITE_E"Spawn Place: "WHITE_E"HalfPipe"; case 5: str7 = ""WHITE_E"Spawn Place: "WHITE_E"San Fierro Airport"; case 6: str7 = ""WHITE_E"Spawn Place: "WHITE_E"Own House."; } format(line4, sizeof(line4), "%s\n"WHITE_E"Skin ID: "WHITE_E"%d\n"WHITE_E"Duels Won: "WHITE_E"%d\n"WHITE_E"Events Won: "WHITE_E"%d\n"WHITE_E"Arrests: "WHITE_E"%d\n\ "WHITE_E"Races Won: "WHITE_E"%d\n"WHITE_E"Moneybags Found: "WHITE_E"%d\n"WHITE_E"Cookie Jars Found: "WHITE_E"%d\n", str7, GetPlayerSkin(p3), pDuelsWon[p3], pInfo[p3][pEventsWon], pArrests[p3], pInfo[p3][pRacesWon], pInfo[p3][pMBFound], pCookieJars[p3]); strcat(line3, line4); format(line4, sizeof(line4), ""WHITE_E"Reactions Won: "WHITE_E"%d\n"WHITE_E"Math Quiz's Won: "WHITE_E"%d\n"WHITE_E"Fallouts Won: "WHITE_E"%d\n"WHITE_E"Derbys Won: "WHITE_E"%d\n"WHITE_E"Report Points: "WHITE_E"%d\ \n\n"WHITE_E"Description:\n "WHITEP_E"%s\n", reactionsWon[p3], mathsWon[p3], pFallouts[p3], pDerbys[p3], pReportPoints[p3], pDescription[p3]); strcat(line3, line4); ShowPlayerDialog(playerid, NO_DIALOG, DIALOG_STYLE_MSGBOX, ""BLUE_E"xDD: "WHITE_E"Offline Statistics", line3, "Close", ""); }