/stats id and /ostats
#1

when i write /stats (id) its just showing my stats,can't show another player's stats
and how to make cmd /ostats its mean you can check another player's stats when his offline

Code:
CMD:stats(playerid, params[])
{
	if ( !BUD::IsNameRegistered( PlayerName2(playerid) ) )
		return SendError(playerid, "You must have an account to view your stats!");

    if( P_DATA[ playerid ][ P_Logged ] == 0)
		return SendError(playerid, "You must be logged in to view your stats!!");

    new
    	H,
  		M,
  		S,
  		pMon,
	    pScor,
	    pReg[ 30 ],
	   	pLastOn[ 30 ],
	   	pTOS[ 30 ],
		OB_TString[ 120 ],
		pSpreeDate[ 30 ],
  		StatsString[ 2048 ]
	;

	GetPVarString(playerid, "TimeOnline", 	pTOS,		30	);
	GetPVarString(playerid, "RegDate", 		pReg, 		30	);
    GetPVarString(playerid, "LastConn",  	pLastOn, 	30	);
    GetPVarString(playerid, "BestSpree",  	pSpreeDate, 30	);


	pMon = GetPlayerMoney( playerid );
	pScor = GetPlayerScore( playerid );

	TotalGameTime( playerid, H, M, S );
	format( OB_TString, sizeof( OB_TString ), "%d{FFDF75}:{FFFFFF}%d{FFDF75}:{FFFFFF}%d", H, M, S );

 	#define P2 PlayerName2( playerid )

	format( StatsString, sizeof( StatsString ),  ""COL_LIGHTBLUE"[ {FFFFFF}Stats"COL_LIGHTBLUE" ]\n\n\n");
	format( StatsString, sizeof( StatsString ),  "%s\
														 {FFFFFF}VIP\t\t{FFDF75}[{FFFFFF}%d{FFDF75}] \n\
														 {FFFFFF}Admin\t\t{FFDF75}[{FFFFFF}%d{FFDF75}] \n\
														 {FFFFFF}Kills\t\t{FFDF75}[{FFFFFF}%d{FFDF75}] \n\
														 {FFFFFF}Deaths\t\t{FFDF75}[{FFFFFF}%d{FFDF75}] \n",
														 StatsString, P_DATA[ playerid ][ P_Vip ], P_DATA[ playerid ][ P_Level ],P_DATA[playerid][P_Kills],P_DATA[playerid][P_Deaths]);

	format( StatsString, sizeof( StatsString ),  "%s\
                                                         {FFFFFF}Killing Spree\t{FFDF75}[{FFFFFF}%d{FFDF75}] \n\
                                                         {FFFFFF}KS Set On\t{FFDF75}[{FFFFFF}%s{FFDF75}] \n\
		                                                 {FFFFFF}Messages\t{FFDF75}[{FFFFFF}%d{FFDF75}] \n\
		    											 {FFFFFF}Commands\t{FFDF75}[{FFFFFF}%d{FFDF75}] \n\
		                                                 {FFFFFF}PMS\t\t{FFDF75}[{FFFFFF}%d{FFDF75}] \n\
		                                                 {FFFFFF}Cookies\t{FFDF75}[{FFFFFF}%d{FFDF75}] \n",
														 StatsString, P_DATA[playerid][P_bkSpree], pSpreeDate, P_DATA[playerid][P_MSGS],P_DATA[playerid][P_CMDS],P_DATA[playerid][P_PMS],P_DATA[playerid][P_Cookies],pMon);

	format( StatsString, sizeof( StatsString ),  "%s\
														 {FFFFFF}Money\t\t{FFDF75}[{FFFFFF}%d{FFDF75}] \n\
														 {FFFFFF}Score\t\t{FFDF75}[{FFFFFF}%d{FFDF75}] \n\
		                                                 {FFFFFF}Online\t\t{FFDF75}[{FFFFFF}%s{FFDF75}] \n\
		                                                 {FFFFFF}Joined\t\t{FFDF75}[{FFFFFF}%s{FFDF75}] \n\
		                                                 {FFFFFF}Last On\t{FFDF75}[{FFFFFF}%s{FFDF75}] \n\
		                                                 {FFFFFF}Connections\t{FFDF75}[{FFFFFF}%d{FFDF75}] \n",
														 StatsString, pMon, pScor,OB_TString,pReg,pLastOn,P_DATA[ playerid ][ P_TOS ]);

    format( StatsString, sizeof( StatsString ),  "%s\
														 {FFFFFF}Math Pts.\t{FFDF75}[{FFFFFF}%d{FFDF75}] \n\
                                                         {FFFFFF}Reaction Pts.\t{FFDF75}[{FFFFFF}%d{FFDF75}] \n\
                                                         {FFFFFF}IQ\t\t{FFDF75}[{FFFFFF}%d{FFDF75}] \n\
					   					  				 {FFFFFF}ABP\t\t{FFDF75}[{FFFFFF}%d{FFDF75}] \n",
			 											 StatsString,P_DATA[playerid][P_MathPoints],P_DATA[playerid][P_ReactPoints],P_DATA[playerid][P_IQ],P_DATA[playerid][P_BiebPoints]);

	ShowDialog( playerid, pStats, BOX, "Your Information", StatsString, "Send", "Exit");
    return 1;
}
Reply
#2

pawn Code:
command(stats, playerid, params[])
{
    if(isnull(params))
    {
        //Show Stats playerid - vars(playerid)-
    }
    else
    {
        if(sscanf(params, "u", params[0])) return SendClientMessage(playerid, -1, "/stats playerid/name");
        if(IsPlayerConnected(params[0]) && params[0] != INVALID_PLAYER_ID)
        {
            // Show stats id - vars(params[0]) -
        }
        else
        {
            SendClientMessage(playerid, -1, "Player not connected.");
        }
    }
    return true;
}
Reply
#3

Quote:
Originally Posted by JuanStone
View Post
pawn Code:
command(stats, playerid, params[])
{
    if(isnull(params))
    {
        //Show Stats playerid - vars(playerid)-
    }
    else
    {
        if(sscanf(params, "u", params[0])) return SendClientMessage(playerid, -1, "/stats playerid/name");
        if(IsPlayerConnected(params[0]) && params[0] != INVALID_PLAYER_ID)
        {
            // Show stats id - vars(params[0]) -
        }
        else
        {
            SendClientMessage(playerid, -1, "Player not connected.");
        }
    }
    return true;
}
what? that code is not same
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)