CMD:stats closing the server
#3

Quote:
Originally Posted by Ultraz
Посмотреть сообщение
Hello sa-mp forum today in a new command of /stats after created it , if anyone use it it is closing the whole server
Код:
#if defined USE_STATS
CMD:stats(playerid,params[]) {
	new pDeaths, player1, h, m, s;
	new Query[256], pname[24], i[128];
	new rdate[32], rtime[32], lodate[32], lotime[32];
	new string[1250], lvlstring[256];
	new rankdon[50], rankdon2[50], playeruserid;
	if(isnull(params)) player1 = playerid;
	else player1 = strval(params);
	if(IsPlayerConnected(player1)) {
	    TotalGameTime(player1, h, m, s);
	    GetPlayerName(playerid, pname, 24);
 		if(PlayerInfo[player1][Deaths] == 0) pDeaths = 1; else pDeaths = PlayerInfo[player1][Deaths];
            if(PlayerInfo[player1][Level] > 3)
			{
			    format(lvlstring, sizeof(lvlstring), ""ccwhite"Admin level: "ccgreen"%d"ccwhite", VIP level: "ccgreen"0",PlayerInfo[player1][Level]); // Since max vip level is 3...
			}
			else
			{
			    format(lvlstring, sizeof(lvlstring), ""ccwhite"Admin level: "ccgreen"0"ccwhite", VIP level: "ccgreen"%d",PlayerInfo[player1][Level]);

		 	}
			switch(PlayerInfo[player1][YG])
			{
			    case 0: rankdon = "No";
			    case 1: rankdon = "Yes";
			}
			switch(PlayerInfo[player1][TP])
			{
			    case 0: rankdon2 = "No";
			    case 1: rankdon2 = "Yes";
			}
			format(Query, sizeof(Query), "SELECT RegisteredDate, RegisteredTime, LastOnlineDate, LastOnlineTime, id FROM `playerdata` WHERE `user` = '%s' LIMIT 1", pName(player1));
			mysql_query(Query);
			mysql_store_result();
			if(mysql_num_rows() != 0)
			{
				while(mysql_fetch_row_format(Query, "|"))
			    {
					mysql_fetch_field_row(i, "RegisteredDate"); format(rdate, sizeof(rdate), i);
					mysql_fetch_field_row(i, "RegisteredTime"); format(rtime, sizeof(rtime), i);
					mysql_fetch_field_row(i, "LastOnlineDate"); format(lodate, sizeof(lodate), i);
					mysql_fetch_field_row(i, "LastOnlineTime"); format(lotime, sizeof(lotime), i);
					mysql_fetch_field_row(i, "id"); playeruserid = strval(i);
				}

                    format(string, sizeof(string),"\t\t\t\t"ccorange"StuntX Stats for %s (ID:%d)...", PlayerName2(player1), player1);
					format(string, sizeof(string), "%s\n\n"ccwhite"Kills: "ccgreen"%d"ccwhite", Deaths: "ccgreen"%d "ccwhite"--> Ratio of "ccgreen"%0.2f "ccwhite"kills per death, Admin kills: "ccgreen"%d",string, PlayerInfo[player1][Kills], PlayerInfo[player1][Deaths], Float:PlayerInfo[player1][Kills]/Float:pDeaths, PlayerInfo[player1][AdminKills]);
					format(string, sizeof(string), "%s\n"ccwhite"YG Status: "ccgreen"%s"ccwhite", TP Status: "ccgreen"%s"ccwhite", Skin: "ccgreen"%d"ccwhite", Maths Quiz won: "ccgreen"%d",string, rankdon, rankdon2, GetPlayerSkin(player1),PlayerInfo[player1][ReactionTestWon]);
					format(string, sizeof(string), "%s\n"ccwhite"Cookies: "ccgreen"%d"ccwhite", Cakes: "ccgreen"%d"ccwhite", Biscuits: "ccgreen"%d"ccwhite", Ice Creames: "ccgreen"%d"ccwhite", Race Won: "ccgreen"%d",string, PlayerInfo[player1][Cookies],PlayerInfo[player1][Cakes],PlayerInfo[player1][Biscuits],PlayerInfo[player1][IceCreams], PlayerInfo[player1][RaceWon]);
					format(string, sizeof(string), "%s\n"ccwhite"Money/Cash: "ccgreen"$%d "ccwhite"~ Banked Money/Cash: "ccgreen"$%d"ccwhite", Total Commands Used: "ccgreen"%d"ccwhite", Total Complaints: "ccgreen"%d",string, GetPlayerMoney(player1),PlayerInfo[player1][bank],PlayerInfo[player1][Totcmdsused],PlayerInfo[player1][pReports]);
					format(string, sizeof(string), "%s\n"ccwhite"Total Logins: "ccgreen"%d"ccwhite", Total Kicks: "ccgreen"%d"ccwhite", Total Bans: "ccgreen"%d"ccwhite", Total Warnings: "ccgreen"%d, %s",string, PlayerInfo[player1][Totallogins],PlayerInfo[player1][Totalkicks], PlayerInfo[player1][Totalbans], PlayerInfo[player1][Totalwarnings], lvlstring);
					format(string, sizeof(string), "%s\n"ccwhite"Played "ccgreen"%d "ccwhite"hours, "ccgreen"%d "ccwhite"minutes, "ccgreen"%d "ccwhite"seconds ~ User ID: "ccgreen"%d",string, PlayerInfo[player1][pHour],PlayerInfo[player1][pMin], PlayerInfo[player1][pSec], playeruserid);
					format(string, sizeof(string), "%s\n"ccwhite"Playing since "ccgreen"%d "ccwhite"hours, "ccgreen"%d "ccwhite"minutes, "ccgreen"%d "ccwhite"seconds ~ Wanted Level: "ccgreen"%d ",string, h, m, s,GetPlayerWantedLevel(player1));
		            format(string, sizeof(string), "%s\n"ccwhite"RegisteredDate: "ccgreen"%s "ccwhite"~ RegisteredTime: "ccgreen"%s "ccwhite"~ LastOnlineDate: "ccgreen"%s "ccwhite"~ LastOnlineTime: "ccgreen"%s",string, rdate, rtime, lodate, lotime);
					ShowPlayerDialog(playerid, 2343, DIALOG_STYLE_MSGBOX, "Player Status", string, "OK", "");
   			}
   			else {
   			        format(string, sizeof(string),"\t\t\t\t"ccorange"StuntX Stats for %s (ID:%d)...", PlayerName2(player1), player1);
					format(string, sizeof(string), "%s\n\n"ccwhite"Kills: "ccgreen"%d"ccwhite", Deaths: "ccgreen"%d "ccwhite"--> Ratio of "ccgreen"%0.2f "ccwhite"kills per death, Admin kills: "ccgreen"%d",string, PlayerInfo[player1][Kills], PlayerInfo[player1][Deaths], Float:PlayerInfo[player1][Kills]/Float:pDeaths, PlayerInfo[player1][AdminKills]);
					format(string, sizeof(string), "%s\n"ccwhite"YG Status: "ccgreen"%s"ccwhite", TP Status: "ccgreen"%s"ccwhite", Skin: "ccgreen"%d"ccwhite", Maths Quiz won: "ccgreen"%d",string, rankdon, rankdon2, GetPlayerSkin(player1),PlayerInfo[player1][ReactionTestWon]);
					format(string, sizeof(string), "%s\n"ccwhite"Cookies: "ccgreen"%d"ccwhite", Cakes: "ccgreen"%d"ccwhite", Biscuits: "ccgreen"%d"ccwhite", Ice Creames: "ccgreen"%d"ccwhite", Race Won: "ccgreen"%d",string, PlayerInfo[player1][Cookies],PlayerInfo[player1][Cakes],PlayerInfo[player1][Biscuits],PlayerInfo[player1][IceCreams], PlayerInfo[player1][RaceWon]);
					format(string, sizeof(string), "%s\n"ccwhite"Money/Cash: "ccgreen"$%d "ccwhite"~ Banked Money/Cash: "ccgreen"$%d"ccwhite", Total Commands Used: "ccgreen"%d"ccwhite", Total Complaints: "ccgreen"%d",string, GetPlayerMoney(player1),PlayerInfo[player1][bank],PlayerInfo[player1][Totcmdsused],PlayerInfo[player1][pReports]);
					format(string, sizeof(string), "%s\n"ccwhite"Total Logins: "ccgreen"%d"ccwhite", Total Kicks: "ccgreen"%d"ccwhite", Total Bans: "ccgreen"%d"ccwhite", Total Warnings: "ccgreen"%d, %s",string, PlayerInfo[player1][Totallogins],PlayerInfo[player1][Totalkicks], PlayerInfo[player1][Totalbans], PlayerInfo[player1][Totalwarnings], lvlstring);
					format(string, sizeof(string), "%s\n"ccwhite"Played "ccgreen"%d "ccwhite"hours, "ccgreen"%d "ccwhite"minutes, "ccgreen"%d "ccwhite"seconds",string, PlayerInfo[player1][pHour],PlayerInfo[player1][pMin], PlayerInfo[player1][pSec]);
					format(string, sizeof(string), "%s\n"ccwhite"Playing since "ccgreen"%d "ccwhite"hours, "ccgreen"%d "ccwhite"minutes, "ccgreen"%d "ccwhite"seconds ~ Wanted Level: "ccgreen"%d ",string, h, m, s,GetPlayerWantedLevel(player1));
		            format(string, sizeof(string), "%s\n"ccred_"Player account is not registered.",string);
					ShowPlayerDialog(playerid, 2343, DIALOG_STYLE_MSGBOX, "Player Status", string, "OK", "");}
   			return mysql_free_result();
	} else return SendClientMessage(playerid, red, "Player Not Connected!");}
This is the code , i am using the MySQl , Solution = Rep.
I have the same gamemode , but that problem doesn't crash the server but it down the server

Note: try to test it in a host
Reply


Messages In This Thread
CMD:stats closing the server - by Ultraz - 23.09.2016, 14:27
Re: CMD:stats closing the server - by Quinncell - 23.09.2016, 14:40
Re: CMD:stats closing the server - by Loinal - 23.09.2016, 19:27

Forum Jump:


Users browsing this thread: 1 Guest(s)