SA-MP Forums Archive
How to make a command to 2 things. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to make a command to 2 things. (/showthread.php?tid=194967)



How to make a command to 2 things. - Haydz - 01.12.2010

Could sombody teach me how to make one command, do two things.
e.g, a player types /viptag to set there tag, then they do /viptag again to take it off.
This is my command, and i would like to learn how to make /viptag set the tag back to there normal name, and remove [PHD], also sets viptag[playerid] = 0; back to viptag[playerid] = 1;

Never really learnt anything like this, so if you could explain what everything does that would be much appreciated.
Код:
COMMAND:viptag(playerid, params[])
{
    if(Pinfo[playerid][Vip_Level])
    {
     	if(viptag[playerid] == 1)
     	{
       		new pname[24];
 		new string[100];
   		GetPlayerName(playerid,pname,24);
     		format(string,sizeof(string), "[PHD]%s",pname);
      		SetPlayerName(playerid,string);
      		viptag[playerid] = 0;
      	}
     	 else
      	{
       		SendClientMessage(playerid,COLOR_WHITE,"You have already used this command or you need to be a donater.");
      	}
   }
   return 1;
}



Re: How to make a command to 2 things. - Haegon - 01.12.2010

Код:
COMMAND:viptag(playerid, params[])
{
    if(Pinfo[playerid][Vip_Level])
    {
     	if(viptag[playerid] == 1)
     	{
       		new pname[24];
 		new string[100];
   		GetPlayerName(playerid,pname,24);
     		format(string,sizeof(string), "[PHD]%s",pname);
      		SetPlayerName(playerid,string);
      		viptag[playerid] = 0;
      	}
     	 else if(viptag[playerid] == 0)
         {
             // Do your stuff here
         }
         else
      	{
       		SendClientMessage(playerid,COLOR_WHITE,"You have already used this command or you need to be a donater.");
      	}
   }
   return 1;
}
Is that what you're looking for, perhaps?


Re: How to make a command to 2 things. - Haydz - 01.12.2010

Yeh, thats what i was looking for, thanks alot man.


Re: How to make a command to 2 things. - Haegon - 01.12.2010

You're welcome, enjoy.

If anything goes wrong, PM me.