[HELP] /sellgun with dcmd
#1

Hello! Thanks for taking a peek at my post.

I've search far and wide through the forums for some relevant information on my problem, but to no avail. All of the posts I seen pertained to strcmp commands.

I am attempt to make a /sellgun command. The syntax I am aiming for is "/sellgun (target ID) (gun name)", but when typed without the last 2 parameters, gives a list of guns you can make. I am not sure how to get my code to check for those extra parameters, or even recognize them.

I have tons of commands in my script that are already dcmd, so I would prefer to keep them dcmd. I do not use sscanf or zcmd.

Here is my code:

Код:
dcmd_sellgun(playerid, params[])
{
 	new string[64], PlayerName[24];
	new tmp[256], tmp2[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
	new number;
	new StringLength;
	new id;
	GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
 	format(string, sizeof(string),"xadmin/Users/%s.ini", udb_encode(PlayerName));
	number = dini_Int(string, "Job");
  	StringLength = strlen(params);
  	id = ReturnPlayerID(tmp);
	
	if(number == 6)
	{
	    if(StringLength == 7)
		{
		    SendClientMessage(playerid, CHAT_COLOR_RED, "Works");
		}
		else if(id == INVALID_PLAYER_ID)
		{
		    SendClientMessage(playerid, CHAT_COLOR_RED, "Invalid Player ID!");
		}
		else
		{
		    SendClientMessage(playerid, CHAT_COLOR_RED, "Test");
		}
	}
	else if(number != 6)
	{
	    SendClientMessage(playerid, CHAT_COLOR_RED, "You are not a Arms Dealer!");
	}

	return 1;
}
Any help is much appreciated!

- Haegon
Reply


Messages In This Thread
[SOLVED] /sellgun with dcmd - by Haegon - 26.11.2010, 22:12
Re: [HELP] /sellgun with dcmd - by Faraday - 26.11.2010, 22:31
Re: [HELP] /sellgun with dcmd - by Haegon - 26.11.2010, 23:30
Re: [HELP] /sellgun with dcmd - by Haegon - 27.11.2010, 00:08
Re: [HELP] /sellgun with dcmd - by Fj0rtizFredde - 27.11.2010, 00:32
Re: [HELP] /sellgun with dcmd - by Haegon - 27.11.2010, 01:36
Re: [HELP] /sellgun with dcmd - by Haegon - 28.11.2010, 21:03
Re: [HELP] /sellgun with dcmd - by Fj0rtizFredde - 28.11.2010, 22:17
Re: [HELP] /sellgun with dcmd - by Haegon - 28.11.2010, 22:36
Re: [HELP] /sellgun with dcmd - by Richard Steinheimer - 12.08.2012, 03:06

Forum Jump:


Users browsing this thread: 1 Guest(s)