Setting Rank Name via CMD -
Abreezy - 10.01.2012
I'm having issues making this command work, and I can't figure out why..
pawn Код:
CMD:setrankname(playerid, params[])
{
new
pID,
rankname[255],
string[104];
if(sscanf(params, "us[255]", pID, rankname)) return SendClientMessage(playerid, COLOR_RED, "Server: Use the command like this: /setrankname playerid rankname");
if(PlayerInfo[playerid][pRank] == 7)
{
if(PlayerInfo[playerid][pMember] == PlayerInfo[pID][pMember])
{
PlayerInfo[pID][pRank] = rankname;
format( string, sizeof( string ), "Your rank name has been changed to: %s", rankname);
SendClientMessage(pID, COLOR_ORANGE, string);
}
}
return 1;
}
The SendClientMessage never shows up either, so im guessing
PHP код:
if(PlayerInfo[playerid][pMember] == PlayerInfo[pID][pMember])
Is the issue, how could i fix this? Thanks in advance cookies to all
Re: Setting Rank Name via CMD -
Mean - 10.01.2012
pawn Код:
if(PlayerInfo[playerid][pMember] == PlayerInfo[pID][pMember])
That basically checks if playerid's and id's pMember's are the same. If they aren't, it won't get called. Is that what you want to do? I see no logic in doing that, and you haven't explained us the system, so I can't really tell what's the problem.
In order to find out which line is causing the problem, debug. Add "print" lines after
pawn Код:
if(PlayerInfo[playerid][pRank] == 7)
and after
pawn Код:
if(PlayerInfo[playerid][pMember] == PlayerInfo[pID][pMember])
to see which one is causing the issue.
Re: Setting Rank Name via CMD -
Abreezy - 10.01.2012
Basically, it's checking if playerid, the person doing the command, and pID, the person command being done to, are in the same group/faction, therefore if they are, then the command should work, if not, it shouldn't.
I want the command so say I'm the chief of police, your my cadet, i decided to promote you, so i /setrankname yourid Officer I, now your rank is Officer I for stats. Understand?