/stats help
#1

well i was making my register system... and from my code i wanted it to also have /stats [playerid] but i dont know anything about sscanf which i am reasearching about


here is the cmd:

CMDtats(playerid, params[])
{
new string[256], string2[256], PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
format(string, sizeof(string), "%s's Statistics", PlayerName);
format(string2, sizeof(string2), "Vip Level: %d\nKills: %d\nDeaths: %d\nRatio: %0.2f\nMoney: %d", PlayerInfo[playerid][pVip], PlayerInfo[playerid][pKills], PlayerInfo[playerid][pDeaths], PlayerInfo[playerid][pCash] );
ShowPlayerDialog(playerid, DIALOG_STATS, DIALOG_STYLE_MSGBOX, string, string2, "Ok", "Cancel");
return 1;
}


i wish to make somethin like /stats [playerid/name] to that other players can view their friends stats
Reply
#2

pawn Код:
CMD:stats(playerid, params[])
{
    new string[40]/*40 is enough*/, string2[100]/*100 is enough*/, PlayerName[MAX_PLAYER_NAME], ID;
    if(sscanf(params,"u",ID)) return SendClientMessage(playerid,-1,"Usage: /Stats [Part Of Name/PlayerID]"
    GetPlayerName(ID, PlayerName, sizeof(PlayerName));
    format(string, sizeof(string), "%s's Statistics", PlayerName);
    format(string2, sizeof(string2), "Vip Level: %d\nKills: %d\nDeaths: %d\nRatio: %0.2f\nMoney: %d", PlayerInfo[ID][pVip], PlayerInfo[ID][pKills], PlayerInfo[ID][pDeaths], PlayerInfo[ID][pCash] );
    ShowPlayerDialog(playerid, DIALOG_STATS, DIALOG_STYLE_MSGBOX, string, string2, "Ok", "Cancel");
    return 1;
}

//EDITED
Reply
#3

THX +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)