Commands are being skipped.
#1

I've been trying to write some commands and see how it goes as its been a while so I opened a new PAWNO file and started working on it, I wrote four commands and went in game to test them

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new giveplayerid;
	new cmd[128], idx;
	if(strcmp(cmd, "/kick", true) == 0)
	{
		new kicker[128];
		new tmp[128];
		tmp = strtok(cmdtext, idx);
		{
  			if(!strlen(tmp))
			{
				SendClientMessage(playerid, 0xFFFFFFFF, "Use /kick [playerid]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if(IsPlayerConnected(giveplayerid))
			{
			format(kicker, sizeof(kicker), "You have kicked Player ID : %d from the server.", giveplayerid);
			SendClientMessage(playerid, 0xFFFFFFFF, kicker);
			Kick(strval(tmp));
			return 1;
			}
		}
	}
 	if(strcmp(cmd, "/ban", true) == 0)
	{
	    new tmp[128];
	    tmp = strtok(cmdtext, idx);
		{
		    if(!strlen(tmp))
			{
				SendClientMessage(playerid, 0xFFFFFFFF, "Use /ban [playerid]");
				return 1;
			}
		    Ban(strval(tmp));
		    return 1;
	  }
	}
	if(strcmp(cmd, "/afk", true) == 0)
	{
		GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
		strins(pName, "[AFK]", 0);
		SetPlayerName(playerid, pName);
		return 1;
	}
	if(strcmp(cmd, "/giveplayergun", true) == 0)
	{
	    new tmp[128];
	    tmp = strtok(cmdtext, idx);
    	if(!strlen(tmp))
			{
				SendClientMessage(playerid, 0xFFFFFFFF, "Use /giveplayergun [playerid] [gun-id]");
				return 1;
			}
	    new gunidstring[128];
		new gunget;
		new gun;
		gunget = ReturnUser(tmp);
		gun = strvalEx(tmp);
		tmp = strtok(cmdtext, idx);
		if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "You know the guns.");
		if(IsPlayerConnected(gunget))
		{
		GivePlayerWeapon(gunget, gun, 99999);
		format(gunidstring, sizeof(gunidstring), "Admin %s has give you the weapon ID : %d", playerid, gun);
		SendClientMessage(gunget, 0xFFFFFFFF, gunidstring);
		}
		else    { SendClientMessage(playerid, 0xFFFFFFFF, "That player is offline!"); }
		return 1;
	}
	return 0;
}
However, every time I try to type any command, it would just return this message "/ban playerid", doesnt matter what I write, that message would appear unless I type /ban "id" then I would lose connection.

Its been so long and I cant really figure out the problem, help would be greatly appreciated, thanks!
Reply


Messages In This Thread
Commands are being skipped. - by Black Axe - 10.01.2016, 03:54
Re: Commands are being skipped. - by Trucido - 10.01.2016, 04:55
Re: Commands are being skipped. - by Black Axe - 10.01.2016, 05:23
Re: Commands are being skipped. - by JaKe Elite - 10.01.2016, 05:54
Re: Commands are being skipped. - by RoboN1X - 10.01.2016, 05:56

Forum Jump:


Users browsing this thread: 1 Guest(s)