Convert to Zcmd.
#1

Hi, I need your help, I have command /shake and /shake accept (1-7) need to redo commands ZCMD, and I'm confused, not helped by someone to do it? Thank you in advance.



Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	new tmp[256];
	new cmd[256];
	new idx;
	cmd = strtok(cmdtext, idx);
	new giveplayer[MAX_PLAYER_NAME];
	new sendername[MAX_PLAYER_NAME];
	new number[256];

    if(strcmp(cmd,"/shake",true)==0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_WHITE, "USAGE: /shake [playerid/PartOfName]");
				return 1;
			}
			new giveplayerid;
			giveplayerid = strval(tmp);
			if (IsPlayerConnected(giveplayerid))
			{
			    if(giveplayerid != INVALID_PLAYER_ID)
			    {
			       if (ProxDetectorS(8.0, playerid, giveplayerid))
					   {
					       if(giveplayerid == playerid)
					       {
					            SendClientMessage(playerid, COLOR_GREY, "   You can't handshake yourself");
					            return 1;
					       }
					       new string[256];
					       GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
						   GetPlayerName(playerid, sendername, sizeof(sendername));
					       format(string, sizeof(string), "* You offered %s a handshake .", giveplayer);
						   SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						   format(string, sizeof(string), "* %s is offering you a handshake, (type /accept shake[1-7]).", sendername);
						   SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
						   ShakeOffer[giveplayerid] = playerid;
					    }
					    else
					    {
					            SendClientMessage(playerid, COLOR_GREY, "   That player is not near you!");
					    }
				 }
    		}
			else
			{
			    SendClientMessage(playerid, COLOR_GREY, "   Invalid ID/Name!");
			    return 1;
			}
	    }
		return 1;
	}
	
 	if(strcmp(cmd,"/accept",true)==0)
	{
	
	number = strtok(cmdtext, idx);

	if(!strlen(number)) {
	SendClientMessage(playerid, COLOR_WHITE, "USAGE: /accept [name]");
	SendClientMessage(playerid, COLOR_GREY, "Available names: Shake(1-7)");
	return 1;
	}
	if(strcmp(number,"shake",true) == 0)
	{
 	if(ShakeOffer[playerid] < TOUR_SHAKE)
	{
 		if(IsPlayerConnected(ShakeOffer[playerid]))
   		{
   		new string[256];
		GetPlayerName(ShakeOffer[playerid], giveplayer, sizeof(giveplayer));
     	GetPlayerName(playerid, sendername, sizeof(sendername));
       format(string, sizeof(string), "* You have accepted the handshake.");
       SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
       format(string, sizeof(string), "* %s has accepted your handshake offer.",sendername);
       ApplyAnimation(playerid,"GANGS","hndshkfa_swt",4.0,0,0,0,0,0);
       ApplyAnimation(ShakeOffer[playerid],"GANGS","hndshkfa_swt",4.0,0,0,0,0,0);
       SendClientMessage(ShakeOffer[playerid], COLOR_LIGHTBLUE, string);
       ShakeOffer[playerid] = TOUR_SHAKE;
       	return 1;
        }
        	else
	        {
         SendClientMessage(playerid, COLOR_GREY, "   No-one has offered a handshake...");
         return 1;
         }
         }
        	}
        			else if(strcmp(number,"shake1",true) == 0)
			{
			    if(ShakeOffer[playerid] < TOUR_SHAKE)
			    {
			        if(IsPlayerConnected(ShakeOffer[playerid]))
			        {
			            new string[256];
                        GetPlayerName(ShakeOffer[playerid], giveplayer, sizeof(giveplayer));
			            GetPlayerName(playerid, sendername, sizeof(sendername));
                        format(string, sizeof(string), "* You have accepted the handshake.");
		            	SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
			            format(string, sizeof(string), "* %s has accepted your handshake offer.",sendername);
			            ApplyAnimation(playerid,"GANGS","hndshkaa",4.0,0,0,0,0,0);
			            ApplyAnimation(ShakeOffer[playerid],"GANGS","hndshkaa",4.0,0,0,0,0,0);
			            SendClientMessage(ShakeOffer[playerid], COLOR_LIGHTBLUE, string);
                        ShakeOffer[playerid] = TOUR_SHAKE;
                        return 1;
                    }
			        else
			        {
                        SendClientMessage(playerid, COLOR_GREY, "   No-one has offered a handshake...");
                        return 1;
                        }
                    }
          	}
			else if(strcmp(number,"shake2",true) == 0)
			{
			    if(ShakeOffer[playerid] < TOUR_SHAKE)
			    {
			        if(IsPlayerConnected(ShakeOffer[playerid]))
			        {
			            new string[256];
                        GetPlayerName(ShakeOffer[playerid], giveplayer, sizeof(giveplayer));
			            GetPlayerName(playerid, sendername, sizeof(sendername));
                        format(string, sizeof(string), "* You have accepted the handshake.");
		            	SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
			            format(string, sizeof(string), "* %s has accepted your handshake offer.",sendername);
			            ApplyAnimation(playerid,"GANGS","hndshkba",4.0,0,0,0,0,0);
			            ApplyAnimation(ShakeOffer[playerid],"GANGS","hndshkba",4.0,0,0,0,0,0);
			            SendClientMessage(ShakeOffer[playerid], COLOR_LIGHTBLUE, string);
                        ShakeOffer[playerid] = TOUR_SHAKE;
                        return 1;
                    }
			        else
			        {
                        SendClientMessage(playerid, COLOR_GREY, "   No-one has offered a handshake...");
                        return 1;
                        }
                    }
          	}
			else if(strcmp(number,"shake3",true) == 0)
			{
			    if(ShakeOffer[playerid] < TOUR_SHAKE)
			    {
			        if(IsPlayerConnected(ShakeOffer[playerid]))
			        {
  			            new string[256];
                        GetPlayerName(ShakeOffer[playerid], giveplayer, sizeof(giveplayer));
			            GetPlayerName(playerid, sendername, sizeof(sendername));
                        format(string, sizeof(string), "* You have accepted the handshake.");
		            	SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
			            format(string, sizeof(string), "* %s has accepted your handshake offer.",sendername);
			            ApplyAnimation(playerid,"GANGS","hndshkca",4.0,0,0,0,0,0);
			            ApplyAnimation(ShakeOffer[playerid],"GANGS","hndshkca",4.0,0,0,0,0,0);
			            SendClientMessage(ShakeOffer[playerid], COLOR_LIGHTBLUE, string);
                        ShakeOffer[playerid] = TOUR_SHAKE;
                        return 1;
                    }
			        else
			        {
                        SendClientMessage(playerid, COLOR_GREY, "   No-one has offered a handshake...");
                        return 1;
                        }
                    }
          	}
			else if(strcmp(number,"shake4",true) == 0)
			{
			    if(ShakeOffer[playerid] < TOUR_SHAKE)
			    {
			        if(IsPlayerConnected(ShakeOffer[playerid]))
			        {
  			            new string[256];
                        GetPlayerName(ShakeOffer[playerid], giveplayer, sizeof(giveplayer));
			            GetPlayerName(playerid, sendername, sizeof(sendername));
                        format(string, sizeof(string), "* You have accepted the handshake.");
		            	SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
			            format(string, sizeof(string), "* %s has accepted your handshake offer.",sendername);
			            ApplyAnimation(playerid,"GANGS","hndshkcb",4.0,0,0,0,0,0);
			            ApplyAnimation(ShakeOffer[playerid],"GANGS","hndshkcb",4.0,0,0,0,0,0);
			            SendClientMessage(ShakeOffer[playerid], COLOR_LIGHTBLUE, string);
                        ShakeOffer[playerid] = TOUR_SHAKE;
                        return 1;
                    }
			        else
			        {
                        SendClientMessage(playerid, COLOR_GREY, "   No-one has offered a handshake...");
                        return 1;
                        }
                    }
          	}
			else if(strcmp(number,"shake5",true) == 0)
			{
			    if(ShakeOffer[playerid] < TOUR_SHAKE)
			    {
			        if(IsPlayerConnected(ShakeOffer[playerid]))
			        {
  			            new string[256];
                        GetPlayerName(ShakeOffer[playerid], giveplayer, sizeof(giveplayer));
			            GetPlayerName(playerid, sendername, sizeof(sendername));
                        format(string, sizeof(string), "* You have accepted the handshake.");
		            	SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
			            format(string, sizeof(string), "* %s has accepted your handshake offer.",sendername);
			            ApplyAnimation(playerid,"GANGS","hndshkda",4.0,0,0,0,0,0);
			            ApplyAnimation(ShakeOffer[playerid],"GANGS","hndshkda",4.0,0,0,0,0,0);
			            SendClientMessage(ShakeOffer[playerid], COLOR_LIGHTBLUE, string);
                        ShakeOffer[playerid] = TOUR_SHAKE;
                        return 1;
                    }
			        else
			        {
                        SendClientMessage(playerid, COLOR_GREY, "   No-one has offered a handshake...");
                        return 1;
                        }
                    }
          	}
			else if(strcmp(number,"shake6",true) == 0)
			{
			    if(ShakeOffer[playerid] < TOUR_SHAKE)
			    {
			        if(IsPlayerConnected(ShakeOffer[playerid]))
			        {
  			            new string[256];
                        GetPlayerName(ShakeOffer[playerid], giveplayer, sizeof(giveplayer));
			            GetPlayerName(playerid, sendername, sizeof(sendername));
                        format(string, sizeof(string), "* You have accepted the handshake.");
		            	SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
			            format(string, sizeof(string), "* %s has accepted your handshake offer.",sendername);
			            ApplyAnimation(playerid,"GANGS","hndshkea",4.0,0,0,0,0,0);
			            ApplyAnimation(ShakeOffer[playerid],"GANGS","hndshkea",4.0,0,0,0,0,0);
			            SendClientMessage(ShakeOffer[playerid], COLOR_LIGHTBLUE, string);
                        ShakeOffer[playerid] = TOUR_SHAKE;
                        return 1;
                    }
			        else
			        {
                        SendClientMessage(playerid, COLOR_GREY, "   No-one has offered a handshake...");
                        return 1;
                        }
                    }
          	}
			else if(strcmp(number,"shake7",true) == 0)
			{
			    if(ShakeOffer[playerid] < TOUR_SHAKE)
			    {
			        if(IsPlayerConnected(ShakeOffer[playerid]))
			        {
  			            new string[256];
                        GetPlayerName(ShakeOffer[playerid], giveplayer, sizeof(giveplayer));
			            GetPlayerName(playerid, sendername, sizeof(sendername));
                        format(string, sizeof(string), "* You have accepted the handshake.");
		            	SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
			            format(string, sizeof(string), "* %s has accepted your handshake offer.",sendername);
			            ApplyAnimation(playerid,"GANGS","hndshkfa",4.0,0,0,0,0,0);
			            ApplyAnimation(ShakeOffer[playerid],"GANGS","hndshkfa",4.0,0,0,0,0,0);
			            SendClientMessage(ShakeOffer[playerid], COLOR_LIGHTBLUE, string);
                        ShakeOffer[playerid] = TOUR_SHAKE;
                        return 1;
                    }
			        else
			        {
                        SendClientMessage(playerid, COLOR_GREY, "   No-one has offered a handshake...");
                        return 1;
                        }
                    }
                    }
          	}
	return 0;
}
Pastebin verison: http://pastebin.com/Y5tnZNDE
Reply


Messages In This Thread
Convert to Zcmd. - by FinStar - 26.03.2016, 15:26
Re: Convert to Zcmd. - by FinStar - 26.03.2016, 20:38
Re: Convert to Zcmd. - by N0FeaR - 27.03.2016, 08:00
Re: Convert to Zcmd. - by FinStar - 27.03.2016, 08:25
Re: Convert to Zcmd. - by N0FeaR - 27.03.2016, 08:38
Re: Convert to Zcmd. - by FinStar - 27.03.2016, 13:47
Re: Convert to Zcmd. - by FinStar - 27.03.2016, 14:09
Re: Convert to Zcmd. - by Hellman92 - 27.03.2016, 15:58
Re: Convert to Zcmd. - by FinStar - 27.03.2016, 16:40

Forum Jump:


Users browsing this thread: 2 Guest(s)