PM HELP
#6

Quote:
Originally Posted by RoneyRemington
Код:
if(strcmp("/pm", cmd, true) == 0)
		{
		tmp = strtok(cmdtext,idx);

		if(!strlen(tmp) || strlen(tmp) > 5) {
			SendClientMessage(playerid,COLOR_GREEN,"Usage: /pm [id] (Message)");
			return 1;
		}

 		id = strval(tmp);

		tmp = strtok(cmdtext,idx);
 		if(!strlen(tmp)) {
			SendClientMessage(playerid,COLOR_GREEN,"Usage: /pm [id] [Message]");
			return 1;
		}

		if(!IsPlayerConnected(id)) {
			SendClientMessage(playerid,COLOR_RED,"Bad player ID");
			return 1;
		}

		if(playerid != id) {
			GetPlayerName(id,iName,sizeof(iName));
			GetPlayerName(playerid,pName,sizeof(pName));
			format(Message,sizeof(Message),">> %s(%d): %s",iName,id,gMessage);
			SendClientMessage(playerid,COLOR_PURPLE,Message);
			format(Message,sizeof(Message),"** %s(%d): %s",pName,playerid,gMessage);
			SendClientMessage(id,COLOR_ORANGE,Message);
			PlayerPlaySound(id,1085,0.0,0.0,0.0);

			printf("PM: %s",Message);

		}
		else {
			SendClientMessage(playerid,YELLOW,"You cannot PM yourself");
		}
		return 1;
	}
  return 0;
}

strtok(const string[], &index)
{
	new length = strlen(string);
	while ((index < length) && (string[index] <= ' '))
	{
		index++;
	}

	new offset = index;
	new result[20];
	while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
	{
		result[index - offset] = string[index];
		index++;
	}
	result[index - offset] = EOS;
	return result;
}
k iahve that code and for some reason i get 10 errors saying that "id" is not defined??
Mybe stop stealing? :

Then it should work
Reply


Messages In This Thread
PM HELP - by RoneyRemington - 24.02.2010, 15:48
Re: PM HELP - by RoneyRemington - 24.02.2010, 15:51
Re: PM HELP - by [cA]Unforseen - 24.02.2010, 15:52
Re: PM HELP - by RoneyRemington - 24.02.2010, 15:54
Re: PM HELP - by VonLeeuwen - 24.02.2010, 15:55
Re: PM HELP - by GaGlets(R) - 24.02.2010, 16:40
Re: PM HELP - by gotenks918 - 24.02.2010, 16:41
Re: PM HELP - by GaGlets(R) - 24.02.2010, 16:43
Re: PM HELP - by Doppeyy - 24.02.2010, 16:44
Re: PM HELP - by Joe Staff - 24.02.2010, 17:00

Forum Jump:


Users browsing this thread: 1 Guest(s)