/setrank command - 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: /setrank command (
/showthread.php?tid=409694)
/setrank command -
RaptorX72 - 22.01.2013
Hello all. I am asking,can someone make me a command please?
If I type /setrank [id] [rank] (rank can be anything you type)
Then infront of the palyer,the rank whould appear.
For an example:
RaptorX72(0): asd
>
/setrank 0 Owner
>
<Owner>RaptorX72(0):asd
Re: /setrank command -
Da_Noob - 22.01.2013
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!
Re: /setrank command -
RaptorX72 - 23.01.2013
Thanks! But how can I get ZCMD & SSCANF files?
Re: /setrank command -
Madzior_ - 23.01.2013
sscanf:
https://sampforum.blast.hk/showthread.php?tid=120356
zcmd:
https://sampforum.blast.hk/showthread.php?tid=91354
Re: /setrank command -
RaptorX72 - 25.01.2013
Ok,thankyou for the help!