/stats | Question: is this possible
#1

Ok, my question is: is this possible.

I have a /stats command, but i wanna make it so like, if my my faction is one (i got faction system) it will show up as LSPD instead of 1 in /stats...

Any ideas?
Reply
#2

Yes, that's possible. You can perform an if statement to check if the faction is 1, and then send a client message saying "LSPD" if the statement is correct.
Reply
#3

Show your ENUM with PlayerInfo or Player, whatever you got to save there.
I'll try to make you something.
Reply
#4

pawn Код:
new factionname[2][] = {
    {"Civilian"},{"RCSD"}
};
This is for example

EDIT:
Forgot this one
pawn Код:
GetFactionName(playerid)
{
    new GFN[20];
    format(GFN,sizeof(GFN),factionname[P_Data[playerid][Faction]]);
    return GFN;
}
EDITED: Miss copas
Reply
#5

Hmm.. Modify this code according to yours.

add this in /stats cmd:

pawn Код:
new factiontype[20], message[50];
factiontype = "None";
if(PlayerInfo[playerid][pMemberF] == 1) factiontype = "LSPD";
if(PlayerInfo[playerid][pMemberF] == 2) factiontype = "SFPD";
//and so on...
format(message,sizeof(message),"Faction: %s",factiontype);
In your string format, replace the faction enum with "factiontype" and change the %i to %s.

EDITED.
Reply
#6

Quote:
Originally Posted by iPLEOMAX
Посмотреть сообщение
Hmm.. Modify this code according to yours.

add this in /stats cmd:

pawn Код:
new factiontype[20];
if(PlayerInfo[playerid][faction] == 1) factiontype = "LSPD";
if(PlayerInfo[playerid][faction] == 2) factiontype = "SFPD";
And then when you format the string for stats, replace the faction enum with "factiontype".
No need for that. Just:
pawn Код:
format(string,sizeof(string),"Faction: %s",GetFactionName(playerid));
So the whole code:
pawn Код:
new factionname[2][] = {//On top of your script
    {"Civilian"},{"RCSD"}
};

format(string,sizeof(string),"Faction: %s",GetFactionName(playerid));//On your /stats

GetFactionName(playerid)//On bottom of your Script
{
    new GFN[20];
    format(GFN,sizeof(GFN),factionname[P_Data[playerid][Faction]]);
    return GFN;
}
Reply
#7

@varthshenon
Yeah, your one is easier once its added to the script.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)