SA-MP Forums Archive
/Stats (LAdmin) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /Stats (LAdmin) (/showthread.php?tid=195746)



/Stats (LAdmin) - Mr.Jvxmc - 03.12.2010

Hey, i'm noob on dialogs, so i need help how i can do this, that player type's /stats then
appears a dialog box where is he/she's Kill score death score time spend on server etc oh i can do this please help

//Code
Код:
#if defined USE_STATS
dcmd_stats(playerid,params[]) {
	new string[128], pDeaths, player1, h, m, s;
	if(!strlen(params)) player1 = playerid;
	else player1 = strval(params);

	if(IsPlayerConnected(player1)) {
	    TotalGameTime(player1, h, m, s);
 		if(PlayerInfo[player1][Deaths] == 0) pDeaths = 1; else pDeaths = PlayerInfo[player1][Deaths];
 		format(string, sizeof(string), "| %s's Stats:  Kills: %d | Deaths: %d | Ratio: %0.2f | Money: $%d | Time: %d hrs %d mins %d secs |",PlayerName2(player1), PlayerInfo[player1][Kills], PlayerInfo[player1][Deaths], Float:PlayerInfo[player1][Kills]/Float:pDeaths,GetPlayerMoney(player1), h, m, s);
		return SendClientMessage(playerid, green, string);
	} else return SendClientMessage(playerid, red, "Player Not Connected!");
}
#endif



Re: /Stats (LAdmin) - Shurik01 - 03.12.2010

I did so.
Sorry, do not know much English

PHP код:
dcmd_stats(playerid,params[]) {
    new 
string[128], pDeathsplayer1hms;
    new 
string1[128];
    if(!
strlen(params)) player1 playerid;
    else 
player1 strval(params);
    if(
IsPlayerConnected(player1)) {
        
TotalGameTime(player1hms);
         if(
GetPVarInt(player1"Deaths") == 0pDeaths 1; else pDeaths GetPVarInt(player1"Deaths");
        
format(string1sizeof(string1), " Stats %s  ",PlayerName2(player1)); 
        
format(stringsizeof(string), " Kills: %d \n Deaths: %d \n Ratio: %0.2f \n Money: $%d \n Time: %d hrs %d mins %d secs "GetPVarInt(player1,"Kills"), GetPVarInt(player1,"Deaths"), Float:GetPVarInt(player1,"Kills")/Float:pDeaths,GetPlayerMoney(player1), hms); 
        return 
ShowPlayerDialog(playerid,991,DIALOG_STYLE_MSGBOXstring1string,"Ok","Close"); 
    } else return 
ShowPlayerDialog(playerid,990,DIALOG_STYLE_MSGBOX"Message server""Player Not Connected","Ok","Close");