Dialog Stats (ladmin)
#1

Hello , today i've tryed to make stats show in a dialog (ladmin) but didn't work , please if you have time help me to do it , this is the code from ladmin
Код:
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!");
}
How can i make that to show in a dialog ?

Sorry for bad english , hope you understand what i mean.
Reply
#2

Not tested but should work:
pawn Код:
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 \nDeaths: %d \nRatio: %0.2f \nMoney: $%d \nTime: %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 ShowPlayerDialog(playerid, 758, DIALOG_STYLE_LIST, string, "Ok", "");
    } else return SendClientMessage(playerid, red, "Player Not Connected!");
}
Reply
#3

No errors but when i go in game and type /stats ....

Reply
#4

That's my bad.
pawn Код:
return ShowPlayerDialog(playerid, 758, DIALOG_STYLE_LIST, "Commands", string, "Ok", "");
Reply
#5

Same problem ...
Reply
#6

How can that possibly return the same?
Reply
#7

No , sorry that was my bad it works , sorry again and thanks .
Reply
#8

No problem
Reply
#9

I was wondering if you can help me again to make that dialog looks like this


I've tryed something but ... didn't work...
Код:
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), "| {FC0303}%s{00FF19}'s Stats \n{00FF19}Player Kills: {00CEFC}%d \n{00FF19}Player Deaths: {00CEFC}%d \n{00FF19}Player Ratio: %0.2f \n{00FF19}Player Money: {00CEFC}$%d \n{00FF19}Player Time: \n{00CEFC}%d{FC0303}*{00FF19}hrs \n{00CEFC}%d{FC0303}*{00FF19}mins \n{00CEFC}%d{FC0303}*{00FF19}secs |",PlayerName2(player1), PlayerInfo[player1][Kills], PlayerInfo[player1][Deaths], Float:PlayerInfo[player1][Kills]/Float:pDeaths,GetPlayerMoney(player1), h, m, s);
        return ShowPlayerDialog(playerid, 758, DIALOG_STYLE_MSGBOX, "Player Stats", string, "Ok", "");
    } else return SendClientMessage(playerid, red, "Player Not Connected!");
}
Reply
#10

pawn Код:
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), "| {FC0303}%s{00FF19}'s Stats \n{00FF19}Player Kills: {00CEFC}%d \n{00FF19}Player Deaths: {00CEFC}%d \n{00FF19}Player Ratio: %0.2f \n{00FF19}Player Money: {00CEFC}$%d \n{00FF19}Player Time: \n{00CEFC}%d{FC0303}*{00FF19}hrs \n{00CEFC}%d{FC0303}*{00FF19}mins \n{00CEFC}%d{FC0303}*{00FF19}secs |",PlayerName2(player1), PlayerInfo[player1][Kills], PlayerInfo[player1][Deaths], Float:PlayerInfo[player1][Kills]/Float:pDeaths,GetPlayerMoney(player1), h, m, s);
        return ShowPlayerDialog(playerid, 758, 0, "Player Stats", string, "Ok", "");
    } else return SendClientMessage(playerid, red, "Player Not Connected!");
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)