How to make a command to 2 things.
#1

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;
}
Reply
#2

Код:
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?
Reply
#3

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

You're welcome, enjoy.

If anything goes wrong, PM me.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)