This can be done with ZCMD & SSCANF. It's recommend that you have a save system
Here's an example of your code should look like.
Код:
CMD:setrank(playerid, params[])
{
new targetid, rank[50];
if(sscanf(params, "us", targetid, rank)) return SendClientMessage(playerid, -1, "USAGE: /setrank [id] [rank]");
{
if(!strcmp(rank, "Owner", true))
{
new s[180];
PlayerInfo[playerid][pOwner] = 1; // You can use some kind of saving system to save this
}
if(!strcmp(rank, "AnotherRankHere", true))
{
new s[180];
PlayerInfo[playerid][pAnotherRankHere] = 1; // You can use some kind of saving system to save this
}
}
return 1;
}
After you've edited it to your likings, you should go to OnPlayerText.
Код:
public OnPlayerText(playerid, text[])
{
if(PlayerInfo[playerid][pOwner] == 1) // Checks to see if the rank of the user is set to "Owner"
{
new s[180];
format(s,sizeof(s), "<OWNER> %s: %s", GetName(playerid), text)
/* GetName is probably not defined in your script, look it up*/
SendClientMessageToAll(-1, s);
}
else
{
new s2[180];
format(s2,sizeof(s2),"%s: %s", GetName(playerid), text)
}
return 0; // It should always return 0 if you make changes in OnPlayerText
}
I'm still a newbie myself at scripting, so it could be it won't work. Also please note that I've not tested these commands at all.
I hope I helped you!