Show clan name on /stats
#1

Yes, how do i make the /stats command show the clan name.

If you are in clan 1 it should say Pokemon and if you are in clan 2 you are in the clan group random?

This is what i got for the stats already:
pawn Код:
CMD:stats(playerid,params[])
{
    new name[MAX_PLAYER_NAME+1], string[24+MAX_PLAYER_NAME+1];
    GetPlayerName(playerid, name, sizeof(name));
    SendClientMessage(playerid, 0xFFFFFF, "***********************************");
    format(string,sizeof(string),"%s's stats!",name);
    SendClientMessage(playerid,0xFFFFFFAA,string);
    SendClientMessage(playerid, 0xFFFFFF, "***********************************");
    format(outp, sizeof(outp), "Playtime: %d hours %d mins %d secs.", hours[playerid], mins[playerid], secs[playerid]);
    SendClientMessage(playerid, COLOR_YELLOW, outp);
    format(outp, sizeof(outp), "Score: %d || Money: $%d ", GetPlayerScore(playerid), GetPlayerMoney(playerid));
    SendClientMessage(playerid, COLOR_GREEN, outp);
    format(outp, sizeof(outp), "Clan:? ", ??????????????????????);
    SendClientMessage(playerid, COLOR_BROWN, outp);
    return true;
}
Reply
#2

What you could do is create a static global variable that has all of the clan names.
pawn Код:
static clanNames[3][32] =
{
    "Pokйmon",
    "Clan #2",
    "Clan #3"
};
And in your stats, use clanNames[clanid] to show the name.
Reply
#3

You think you can explain more? An example on how i shold do it in the stats? When clan[playerid] = 1 ? I dont understand
Reply
#4

Try this:

Код:
CMD:stats(playerid,params[])
{
    new name[MAX_PLAYER_NAME+1], string[24+MAX_PLAYER_NAME+1];
    GetPlayerName(playerid, name, sizeof(name));
    SendClientMessage(playerid, 0xFFFFFF, "***********************************");
    format(string,sizeof(string),"%s's stats!",name);
    SendClientMessage(playerid,0xFFFFFFAA,string);
    SendClientMessage(playerid, 0xFFFFFF, "***********************************");
    format(outp, sizeof(outp), "Playtime: %d hours %d mins %d secs.", hours[playerid], mins[playerid], secs[playerid]);
    SendClientMessage(playerid, COLOR_YELLOW, outp);
    format(outp, sizeof(outp), "Score: %d || Money: $%d ", GetPlayerScore(playerid), GetPlayerMoney(playerid));
    SendClientMessage(playerid, COLOR_GREEN, outp);
    format(outp, sizeof(outp), "Clan: %s ", GetClanName(playerid));
    SendClientMessage(playerid, COLOR_BROWN, outp);
    return true;
}

stock GetClanName(playerid)
{
	new string[56];
	if(clan[playerid] == 1)
	{
		string = "Clan#1";
	}
	if(clan[playerid] == 2)
	{
		string = "Clan#2";
	}	
	return string;
}
Let me know if it works for you
Reply
#5

Quote:
Originally Posted by Qaiis
Посмотреть сообщение
You think you can explain more? An example on how i shold do it in the stats? When clan[playerid] = 1 ? I dont understand
pawn Код:
format(outp, sizeof(outp), "Clan: %s", clanNames[clan[playerid]-1];
    SendClientMessage(playerid, COLOR_BROWN, outp);
Reply
#6

That works fine! Thank you

Both works, thanks!
Reply
#7

sorry for bumping an old topic, but i need it.
Quote:

If you are in clan 1 itll showing Clan: F1 and if you are in clan 2 itll showing Clan: F2, etc. And If you are in 2 clans or more itll showing Clan: F1, F2 or Clan: F1, F2, F3
is that possible? if so, here is my stats command

Код:
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 Statistics -|",PlayerName2(player1));
		SendClientMessage(playerid, green, string);
 		format(string, sizeof(string), "|- Level: [%d] | VIP: [%d] | Kills: [%d] | Deaths: [%d] | Ratio: [%0.2f] | Money: [$%d] | Bank: [$%d] | Time: [%d] hrs [%d] mins [%d] secs -|",PlayerInfo[player1][Level],PlayerInfo[player1][VIP],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 Is Not Connected!");
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)