SA-MP Forums Archive
stats in dialog needed - 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)
+--- Thread: stats in dialog needed (/showthread.php?tid=516228)



stats in dialog needed - ScripteRNaBEEL - 30.05.2014

hello guyz can any one help me with stats in dialog
this is my stats code i want to make it in dialog pls help.
Код:
#if defined USE_STATS
CMD:stats(playerid,params[]) {
	new string[128], pDeaths, player1, h, m, s;
	if(isnull(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:  Level: %d | Kills: %d | Deaths: %d | Ratio: %0.2f | Money: $%d | Bank: $%d | Time: %d hrs %d mins %d secs |",PlayerName2(player1), PlayerInfo[player1][Level],PlayerInfo[player1][Kills], PlayerInfo[player1][Deaths], Float:PlayerInfo[player1][Kills]/Float:pDeaths,GetPlayerMoney(player1),PlayerInfo[player1][bank], h, m, s);
		return SendClientMessage(playerid, green, string);
	} else return SendClientMessage(playerid, red, "Player Not Connected!");
}
#endif



Re: stats in dialog needed - biker122 - 30.05.2014

Below the includes
pawn Код:
#define StatsDialog 1245
and command:
pawn Код:
#if defined USE_STATS
CMD:stats(playerid,params[]) {
    new string[500], pDeaths, player1, h, m, s;
    if(isnull(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];
        new string2[128];
        format(string2,sizeof(string2),"%s's statistics",PlayerName2(player1));
        strcat(string,"Level: %d");
        strcat(string,"Kills: %d");
        strcat(string,"Deaths: %d");
        strcat(string,"Ratio: %0.2f");
        strcat(string,"Money: $%d");
        strcat(string,"Bank: $%d");
        strcat(string,"Time: %d hrs %dmins %d secs");
        format(string,sizeof(string),string,
        PlayerInfo[player1][Level],PlayerInfo[player1][Kills],PlayerInfo[player1][Deaths],Float:PlayerInfo[player1][Kills]/Float:pDeaths,GetPlayerMoney(playerid1),PlayerInfo[player1][bank],h,m,s);
        ShowPlayerDialog(playerid, StatsDialog, DIALOG_STYLE_MSGBOX, string2, string, "Close", "");
        format(string,sizeof(string),"");
    } else return SendClientMessage(playerid, red, "Player Not Connected!");
}
#endif



Re: stats in dialog needed - ScripteRNaBEEL - 30.05.2014

Quote:

F:\Program Files\RBCluBxB v6.5\Gamemodes\SATDM.pwn(32933 -- 32934) : error 017: undefined symbol "playerid1"
F:\Program Files\RBCluBxB v6.5\Gamemodes\SATDM.pwn(3293 : warning 209: function "cmd_stats" should return a value
Pawn compiler 3.2.3664 Copyright (coffee) 1997-2006, ITB CompuPhase


1 Error.

this is coming


Re: stats in dialog needed - Faisal_khan - 30.05.2014

pawn Код:
#if defined USE_STATS
CMD:stats(playerid,params[]) {
    new string[500], pDeaths, player1, h, m, s;
    if(isnull(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];
        new string2[128];
        format(string2,sizeof(string2),"%s's statistics",PlayerName2(player1));
        strcat(string,"Level: %d");
        strcat(string,"Kills: %d");
        strcat(string,"Deaths: %d");
        strcat(string,"Ratio: %0.2f");
        strcat(string,"Money: $%d");
        strcat(string,"Bank: $%d");
        strcat(string,"Time: %d hrs %dmins %d secs");
        format(string,sizeof(string),string,
        PlayerInfo[player1][Level],PlayerInfo[player1][Kills],PlayerInfo[player1][Deaths],Float:PlayerInfo[player1][Kills]/Float:pDeaths,GetPlayerMoney(player1),PlayerInfo[player1][bank],h,m,s);
        ShowPlayerDialog(playerid, StatsDialog, DIALOG_STYLE_MSGBOX, string2, string, "Close", "");
        format(string,sizeof(string),"");
    } else
return SendClientMessage(playerid, red, "Player Not Connected!");
}
#endif



Re: stats in dialog needed - ScripteRNaBEEL - 30.05.2014

thanks faisal