GetFactionRank - 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: GetFactionRank (
/showthread.php?tid=502195)
GetFactionRank -
Zeppo - 22.03.2014
I'm using this stock to get a certain faction's rank but it's not working(nothing is shown):
pawn Код:
GetFactionRank(playerid)
{
new facrank[24];
new string[24];
if(PlayerInfo[playerid][pFactionRank] == 1)
{
format(string, sizeof(string), "%s", FacInfo[PlayerInfo[playerid][pFaction]][fRank1]);
}
else if(PlayerInfo[playerid][pFactionRank] == 2)
{
format(string, sizeof(string), "%s", FacInfo[PlayerInfo[playerid][pFaction]][fRank2]);
}
else if(PlayerInfo[playerid][pFactionRank] == 3)
{
format(string, sizeof(string), "%s", FacInfo[PlayerInfo[playerid][pFaction]][fRank3]);
}
else if(PlayerInfo[playerid][pFactionRank] == 4)
{
format(string, sizeof(string), "%s", FacInfo[PlayerInfo[playerid][pFaction]][fRank4]);
}
else if(PlayerInfo[playerid][pFactionRank] == 5)
{
format(string, sizeof(string), "%s", FacInfo[PlayerInfo[playerid][pFaction]][fRank5]);
}
else if(PlayerInfo[playerid][pFactionRank] == 6)
{
format(string, sizeof(string), "%s", FacInfo[PlayerInfo[playerid][pFaction]][fRank6]);
}// hmm
switch(PlayerInfo[playerid][pFactionRank])
{
case 1:
facrank = string;
case 2:
facrank = string;
case 3:
facrank = string;
case 4:
facrank = string;
case 5:
facrank = string;
case 6:
facrank = string;
default:
facrank = "None";
}
return facrank;
}
Re: GetFactionRank -
Matess - 22.03.2014
Try:
pawn Код:
GetFactionRank(playerid)
{
new string[24];
switch(PlayerInfo[playerid][pFactionRank])
{
case 1: format(string, sizeof(string), "%s", FacInfo[PlayerInfo[playerid][pFaction]][fRank1]);
case 2: format(string, sizeof(string), "%s", FacInfo[PlayerInfo[playerid][pFaction]][fRank2]);
case 3: format(string, sizeof(string), "%s", FacInfo[PlayerInfo[playerid][pFaction]][fRank3]);
case 4: format(string, sizeof(string), "%s", FacInfo[PlayerInfo[playerid][pFaction]][fRank4]);
case 5: format(string, sizeof(string), "%s", FacInfo[PlayerInfo[playerid][pFaction]][fRank5]);
case 6: format(string, sizeof(string), "%s", FacInfo[PlayerInfo[playerid][pFaction]][fRank6]);
default: string = "None";
}
return string;
}
Re: GetFactionRank -
Zeppo - 22.03.2014
Nope. Still don't work!
(When you type /radio IG it comes up: ** NAME: TEXT)
No rank name.
Re: GetFactionRank -
MP2 - 22.03.2014
You should really learn to use arrays instead of doing things like this:
pawn Код:
new var1;
new var2;
new var3;
new var4;
new var5;
// ->
new var[5];
Re: GetFactionRank -
iFarbod - 22.03.2014
how u use it in your GM or FS?
Re: GetFactionRank -
Zeppo - 23.03.2014
pawn Код:
CMD:r(playerid, params[])
{
if(PlayerInfo[playerid][pFaction] == 1 || PlayerInfo[playerid][pFaction] == 2)
{
new string[128], text[70];
if(sscanf(params, "s[70]", text)) return ShowInfoForPlayer(playerid, "~r~Error:~w~ /r [text]", 5000);
format(string, sizeof(string), "(Radio) ** %s %s: %s", GetFactionRank(playerid), GetPlayerNameEx(playerid), text);
SendClientMessageToLSPD(COLOR_BLUE, string);
}
else ShowInfoForPlayer(playerid, "~r~Error:~w~ You're not in a Law Enforcement Faction.", 5000);
return 1;
}