Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void SQL_StatsMe2Callback(Handle owner, Handle hndl, const char[] error, any hDatapack){
- if(hndl == INVALID_HANDLE)
- {
- LogError("[RankMe] Query Fail: %s", error);
- return;
- }
- ResetPack(hDatapack);
- int client = ReadPackCell(hDatapack);
- if(client == 0 || !IsClientInGame(client))
- return;
- int type = ReadPackCell(hDatapack);
- int i;
- char auth[64];
- char name[MAX_NAME_LENGTH];
- int target;
- if(type == 0){
- target = ReadPackCell(hDatapack);
- GetClientAuthId(target,AuthId_Steam2,auth,sizeof(auth));
- GetClientName(target,name,sizeof(name));
- } else if (type == 1) {
- i = ReadPackCell(hDatapack);
- } else if(type == 2) {
- ReadPackString(hDatapack,auth,sizeof(auth));
- }
- CloseHandle(hDatapack);
- char Auth_receive[64];
- char Name_receive[MAX_NAME_LENGTH];
- if(type != 1){
- while(SQL_HasResultSet(hndl) && SQL_FetchRow(hndl))
- {
- i++;
- SQL_FetchString(hndl,1,Auth_receive,64);
- SQL_FetchString(hndl,2,Name_receive,MAX_NAME_LENGTH);
- if((g_RankBy == 1 && StrEqual(name,Name_receive)) || (g_RankBy == 0 && StrEqual(Auth_receive,auth,false)))
- break;
- }
- } else if (SQL_HasResultSet(hndl)){
- SQL_FetchRow(hndl);
- SQL_FetchString(hndl,1,Auth_receive,64);
- SQL_FetchString(hndl,2,Name_receive,MAX_NAME_LENGTH);
- } else {
- return;
- }
- Menu panel = CreateMenuEx(_,MenuHandler_DoNothing,MENU_ACTIONS_ALL);
- panel.SetTitle(Name_receive);
- char text[255];
- panel.Pagination = 3;
- int ikills = SQL_FetchInt(hndl,5);
- int ideaths= SQL_FetchInt(hndl,6);
- int deaths;
- if(ideaths == 0)
- deaths = 1;
- else
- deaths=ideaths;
- float kills = IntToFloat(ikills);
- int shots = SQL_FetchInt(hndl,10);
- if(shots == 0)
- shots = 1;
- int rounds = SQL_FetchInt(hndl,14) + SQL_FetchInt(hndl,15);
- if((SQL_FetchInt(hndl,14) == 0) && (SQL_FetchInt(hndl,15) == 0))
- {
- rounds = 1;
- }
- int idamage = SQL_FetchInt(hndl,74);
- float damage = IntToFloat(idamage);
- int hits = SQL_FetchInt(hndl,11);
- char temp[255];
- Format(temp,sizeof(temp),"- %T\n","BasicStats",client);
- StrCat(text,255,temp);
- if(i == 0)
- Format(temp,sizeof(temp),"%T: %i\n","Points",client,SQL_FetchInt(hndl,4));
- else
- Format(temp,sizeof(temp),"Rank: %i/%i %T: %i\n",i,g_TotalPlayers,"Points",client,SQL_FetchInt(hndl,4));
- StrCat(text,255,temp);
- Format(temp,255,"%T KDR: %.2f\n","KillsDeathsAssists",client,ikills,ideaths,SQL_FetchInt(hndl,7),kills/deaths);
- StrCat(text,255,temp);
- Format(temp,255,"%T: %d %T: %d %T: %d\n","Headshots", client, SQL_FetchInt(hndl,12),"Suicides",client,SQL_FetchInt(hndl,8),"TKs",client,SQL_FetchInt(hndl,9));
- StrCat(text,255,temp);
- Format(temp,255,"%T: %d %T: %.2f %T: %.2f\n ","Damage", client, idamage,"KPR", client, kills/rounds, "DPR", client, damage/rounds);
- StrCat(text,255,temp);
- panel.AddItem("",text);
- text="";
- Format(temp,sizeof(temp),"- %T\n","RoundStats",client);
- StrCat(text,255,temp);
- Format(temp,255,"%T: %d/%d %T: %d/%d %T: %d\n%T: %d %T: %d %T: %d\n","TRWins",client,SQL_FetchInt(hndl,68),SQL_FetchInt(hndl,14),"CTWins",client,SQL_FetchInt(hndl,67),SQL_FetchInt(hndl,15),"MVPs",client,SQL_FetchInt(hndl,73), "MatchWins", client, SQL_FetchInt(hndl, 75), "MatchDraws", client, SQL_FetchInt(hndl, 76), "MatchLosses", client, SQL_FetchInt(hndl, 77));
- StrCat(text,255,temp);
- panel.AddItem("",text);
- text="";
- Format(temp,sizeof(temp),"- %T\n","HitStats",client);
- StrCat(text,255,temp);
- Format(temp,255,"%T: %d %T: %d %T: %.2f%%\n ","Shots",client,shots,"Hits",client,hits,"Accuracy",client,IntToFloat(hits)/shots*100);
- StrCat(text,255,temp);
- panel.AddItem("",text);
- text="";
- Format(temp,sizeof(temp),"- %T\n","BombHostagesStats",client);
- StrCat(text,255,temp);
- Format(temp,255,"%T: %d %T: %d %T: %d\n","PlantedBombs",client,SQL_FetchInt(hndl,64),"ExplodedBombs",client,SQL_FetchInt(hndl,65),"DefusedBombs",client,SQL_FetchInt(hndl,66));
- StrCat(text,255,temp);
- Format(temp,255,"%T: %d","RescuedHostages",client,SQL_FetchInt(hndl,69));
- StrCat(text,255,temp);
- panel.AddItem("",text);
- text="";
- if(g_bVipEnabled){
- Format(temp,sizeof(temp),"- %T\n","VIPStats",client);
- StrCat(text,255,temp);
- Format(temp,255,"%T: %d/%d %T: %d\n ","VIPEscapes",client,SQL_FetchInt(hndl,71),SQL_FetchInt(hndl,72),"VIPsKilled",client,SQL_FetchInt(hndl,70));
- StrCat(text,255,temp);
- panel.AddItem("",text);
- text="";
- }
- Format(temp,sizeof(temp),"- %T\n","OtherStats",client);
- StrCat(text,255,temp);
- int time = SQL_FetchInt(hndl,13);
- if(target != 0 && IsClientInGame(target))
- time += GetTime()-g_aSession[client][CONNECTED];
- int hours = RoundToFloor(time/3600.0);
- time = time-(hours*3600);
- int minutes = RoundToFloor(time/60.0);
- time = time-(minutes*60);
- Format(temp,255,"%T","TimeConnected",client,hours,minutes,time);
- StrCat(text,255,temp);
- panel.AddItem("",text);
- text="";
- panel.Display(client,MENU_TIME_FOREVER);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement