[Problem With my Codes]
#1

Guys Why my Stats doesnt show other cookies,cakes ?
pawn Код:
CMD:stats(playerid,params[])
{
    new pDeaths, player1, h, m, s,playername[MAX_PLAYER_NAME];
    if(isnull(params)) player1 = playerid;
    else player1 = strval(params);

    if(IsPlayerConnected(player1)) {
        TotalGameTime(player1, h, m, s);
        GetPlayerName(player1, playername, sizeof(playername));
        if(PlayerInfo[player1][Deaths] == 0) pDeaths = 1; else pDeaths = PlayerInfo[player1][Deaths];
        new str[20][1000];
        format(str[0],1000,"                         YG Stats For %s's\n", PlayerName2(player1));
        strcat(str[1],str[0]);
        format(str[2],1000,"Scores: %d | Money: $%d | Kills: %d | Deaths: %d | K/D Ratio: %0.2f\n", GetPlayerScore(player1), GetPlayerMoney(player1), PlayerInfo[player1][Kills], PlayerInfo[player1][Deaths], Float:PlayerInfo[player1][Kills]/Float:pDeaths);
        strcat(str[1],str[2]);
        format(str[3],1000,"Admin Level: %d  | Skin: %d | Ping: %d | Bank: $%d | Wanted Level: %d\n", PlayerInfo[playerid][Level],GetPlayerSkin(player1),GetPlayerPing(playerid),PlayerInfo[playerid][bank],GetPlayerWantedLevel(playerid));
        strcat(str[1],str[3]);
        format(str[4],1000,"TimePlayed: [%d] hrs [%d] mins [%d] secs | Interior: %d | Country: %s\n", h, m, s, GetPlayerInterior(playerid),GetPlayerCountryName(playerid));
        strcat(str[1],str[4]);
        format(str[5],1000,"Cookies: %d, Cakes: %d\n", PlayerInfo[playerid][Cookies], PlayerInfo[playerid][Cakes]);
        strcat(str[1],str[5]);
        ShowPlayerDialog(playerid,DIALOG_STATS,DIALOG_STYLE_MSGBOX,"Player Stats",str[1],"OK","");
    } else return SendClientMessage(playerid, red, "Player Not Connected!");
    return 1;
}
Wenyt i make is only show my stats and i /stats 1 is show my cookies,cakes :\
Reply
#2

pawn Код:
CMD:stats(playerid,params[])
{
    new pDeaths, player1, h, m, s,playername[MAX_PLAYER_NAME];
    if(isnull(params)) player1 = playerid;
    else player1 = strval(params);

    if(IsPlayerConnected(player1)) {
        TotalGameTime(player1, h, m, s);
        GetPlayerName(player1, playername, sizeof(playername));
        if(PlayerInfo[player1][Deaths] == 0) pDeaths = 1; else pDeaths = PlayerInfo[player1][Deaths];
        new str[20][1000];
        format(str[0],1000,"                         YG Stats For %s's\n", PlayerName2(player1));
        strcat(str[1],str[0]);
        format(str[2],1000,"Scores: %d | Money: $%d | Kills: %d | Deaths: %d | K/D Ratio: %0.2f\n", GetPlayerScore(player1), GetPlayerMoney(player1), PlayerInfo[player1][Kills], PlayerInfo[player1][Deaths], Float:PlayerInfo[player1][Kills]/Float:pDeaths);
        strcat(str[1],str[2]);
        format(str[3],1000,"Admin Level: %d  | Skin: %d | Ping: %d | Bank: $%d | Wanted Level: %d\n", PlayerInfo[player1][Level],GetPlayerSkin(player1),GetPlayerPing(player1),PlayerInfo[player1][bank],GetPlayerWantedLevel(player1));
        strcat(str[1],str[3]);
        format(str[4],1000,"TimePlayed: [%d] hrs [%d] mins [%d] secs | Interior: %d | Country: %s\n", h, m, s, GetPlayerInterior(player1),GetPlayerCountryName(player1));
        strcat(str[1],str[4]);
        format(str[5],1000,"Cookies: %d, Cakes: %d\n", PlayerInfo[player1][Cookies], PlayerInfo[player1][Cakes]);
        strcat(str[1],str[5]);
        ShowPlayerDialog(playerid,DIALOG_STATS,DIALOG_STYLE_MSGBOX,"Player Stats",str[1],"OK","");
    } else return SendClientMessage(playerid, red, "Player Not Connected!");
    return 1;
}
You had playerid instead of player1.
Reply
#3

is will show both player ?
Reply
#4

Quote:
Originally Posted by donhu789
Посмотреть сообщение
is will show both player ?
I didn't get your point, but let me explain:
When you do /stats with no parameter or number after it, it will show your stats.
If you do /stats 2 it will show the stats of player ID 2, not the stats of the player who typed the command.

Edit for post below: Exactly, my above's post code does exactly what you requested.
Reply
#5

went i preass /stats my sellf is will show my self | and i /stats 1 is show another statS?
Reply
#6

went i preass /stats my sellf is will show my self | and i /stats 1 is show another statS? Right ?? If You SAy Yes Thanks
Reply
#7

Quote:
Originally Posted by Dragonsaurus
Посмотреть сообщение
I didn't get your point, but let me explain:
When you do /stats with no parameter or number after it, it will show your stats.
If you do /stats 2 it will show the stats of player ID 2, not the stats of the player who typed the command.

Edit for post below: Exactly, my above's post code does exactly what you requested.

Hey CAn You Help My Makes THat ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)