SA-MP Forums Archive
/stats help - 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 help (/showthread.php?tid=423978)



/stats help - Ryan_Obeles - 20.03.2013

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


Re: /stats help - newbienoob - 20.03.2013

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


Re: /stats help - Ryan_Obeles - 20.03.2013

THX +rep