/stats | Question: is this possible - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /stats | Question: is this possible (
/showthread.php?tid=264100)
/stats | Question: is this possible -
DaRealz - 24.06.2011
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?
Re: /stats | Question: is this possible -
Calgon - 24.06.2011
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.
Re: /stats | Question: is this possible -
GangsTa_ - 24.06.2011
Show your ENUM with PlayerInfo or Player, whatever you got to save there.
I'll try to make you something.
Re: /stats | Question: is this possible -
=WoR=Varth - 24.06.2011
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
Re: /stats | Question: is this possible -
iPLEOMAX - 24.06.2011
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.
Re: /stats | Question: is this possible -
=WoR=Varth - 24.06.2011
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;
}
Re: /stats | Question: is this possible -
iPLEOMAX - 24.06.2011
@varthshenon
Yeah, your one is easier once its added to the script.