/setrank command
#2

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!
Reply


Messages In This Thread
/setrank command - by RaptorX72 - 22.01.2013, 16:13
Re: /setrank command - by Da_Noob - 22.01.2013, 16:48
Re: /setrank command - by RaptorX72 - 23.01.2013, 13:25
Re: /setrank command - by Madzior_ - 23.01.2013, 13:51
Re: /setrank command - by RaptorX72 - 25.01.2013, 20:33

Forum Jump:


Users browsing this thread: 1 Guest(s)