Converted from strcmp to zcmd
#1

strcmp
Код:
if(strcmp(cmd, "/poisondart", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
		{
			tmp = strtok(cmdtext, idx);
            new para1 = ReturnUser(tmp);
			if (PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pLeader] == 8)
			{
				if (PlayerInfo[playerid][pRank] >= 5)
  			{
  			  if(PlayerInfo[para1][pMember] == 8||PlayerInfo[para1][pLeader] == 8)
  			  {
  			    SendClientMessage(playerid,COLOR_LIGHTBLUE,"Don't poison dart your team-mates!");
  			    return 1;
					}
				  if(playerid == para1)
					{
						SendClientMessage(playerid,COLOR_LIGHTBLUE,"I don't think you want to poison yourself!");
						return 1;
					}
  				else if(!strlen(tmp))
					{
						SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /poisondart [playerid/PartOfName]");
						return 1;
					}
				  if(IsPlayerConnected(para1))
				  {
				    if(para1 != INVALID_PLAYER_ID)
		    			{
    						if (!(ProxDetectorS(10.0, playerid, giveplayerid)))
							{
								SendClientMessage(playerid, COLOR_WHITE, "Your target is too far.");
							}
							else
							{
								GetPlayerName(para1, sendername, sizeof(sendername));
								format(string, sizeof(string), "You have shot a poison dart into %s's neck",sendername);
								SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
								SetTimer("Target",6000,0);
							}
						}
						else
						{
							format(string, sizeof(string), "That person isn't online!");
							SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						}
					}
				}
				else
  				{
					SendClientMessage(playerid, COLOR_GRAD1, "You are not allowed to use that command!");
				}
			}
			return 1;
		}
		return 1;
	}
zcmd
Код:
CMD:poisondart(playerid, params[])
	{
	  if(IsPlayerConnected(playerid))
		{
			tmp = strtok(cmdtext, idx);
            new para1 = ReturnUser(tmp);
			if (PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pLeader] == 8)
			{
				if (PlayerInfo[playerid][pRank] >= 5)
  			{
  			  if(PlayerInfo[para1][pMember] == 8||PlayerInfo[para1][pLeader] == 8)
  			  {
  			    SendClientMessage(playerid,COLOR_LIGHTBLUE,"Don't poison dart your team-mates!");
  			    return 1;
					}
				  if(playerid == para1)
					{
						SendClientMessage(playerid,COLOR_LIGHTBLUE,"I don't think you want to poison yourself!");
						return 1;
					}
  				else if(!strlen(tmp))
					{
						SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /poisondart [playerid/PartOfName]");
						return 1;
					}
				  if(IsPlayerConnected(para1))
				  {
				    if(para1 != INVALID_PLAYER_ID)
		    			{
    						if (!(ProxDetectorS(10.0, playerid, giveplayerid)))
							{
								SendClientMessage(playerid, COLOR_WHITE, "Your target is too far.");
							}
							else
							{
								GetPlayerName(para1, sendername, sizeof(sendername));
								format(string, sizeof(string), "You have shot a poison dart into %s's neck",sendername);
								SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
								SetTimer("Target",6000,0);
							}
						}
						else
						{
							format(string, sizeof(string), "That person isn't online!");
							SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						}
					}
				}
				else
  				{
					SendClientMessage(playerid, COLOR_GRAD1, "You are not allowed to use that command!");
				}
			}
			return 1;
		}
		return 1;
	}
Would this seem right? Also if i want the command to only be used by the faction hitman agency what would i change it too? thanks
Reply
#2

replace tmp = strtok(cmdtext, idx); to tmp = strtok(params, idx);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)