SA-MP Forums Archive
Quick question - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Quick question (/showthread.php?tid=130022)



Quick question - Daan de Vries - 24.02.2010

Alright I got this whisper command

Код:
if(strcmp("/w", cmdtext, true, 2)==0)
	{
  if(strlen(cmdtext) <= 3) {
  SendClientMessage(playerid,COLOR_RED,"USAGE: /w (msg)");
  return 1;
  }
  new output[150];
	new pname[24];
	new string[128];
	GetPlayerName(playerid, pname, 24);
  strmid(output,cmdtext,2,strlen(cmdtext));
  format(string, sizeof(string), "(WHISPER): %s(%d) %s",pname,playerid,output);
  printf("%s", string);
  for(new i=0;i<MAX_PLAYERS;i++)
	{
  if(IsPlayerConnected(i) && GetDistanceBetweenPlayers(playerid,i) < 10) {
	{
  format(string, sizeof(string), "(WHISPER): %s(%d) %s",pname,playerid,output);
  format(string, sizeof(string),
  SendClientMessage(i,COLOR_YELLOW,string);
  }
  }
  }
  return 1;
  }
		
	}
	return 0;
}

Now, how am I going to show the string (message typed by player) above the players character?


Re: Quick question - dclaw - 24.02.2010

i think with textdraw or something :P
je bent nl he. "De" "Vries"


Re: Quick question - Daan de Vries - 24.02.2010

Quote:
Originally Posted by dclaw
i think with textdraw or something :P
je bent nl he. "De" "Vries"
Textdraw? Don't think so.

En ja.


Re: Quick question - Joe Staff - 24.02.2010

SetPlayerChatBubble


Re: Quick question - Daan de Vries - 24.02.2010

Thank you.


Re: Quick question - Daan de Vries - 24.02.2010

I got another question, I'm kinda noob in scripting so..

Now I got this:

Код:
if(strcmp("/w", cmdtext, true, 2)==0)
	{
  if(strlen(cmdtext) <= 3) {
  SendClientMessage(playerid,COLOR_RED,"USAGE: /w (msg)");
  return 1;
  }
  new output[150];
	new pname[24];
	new string[128];
	GetPlayerName(playerid, pname, 24);
  strmid(output,cmdtext,2,strlen(cmdtext));
  format(string, sizeof(string), "(WHISPER): %s(%d) %s",pname,playerid,output);
  SetPlayerChatBubble(playerid, string, COLOR_WHITE, 150.0, 10000);
  printf("%s", string);
  for(new i=0;i<MAX_PLAYERS;i++)
	{
  if(IsPlayerConnected(i) && GetDistanceBetweenPlayers(playerid,i) < 10) {
	{
  format(string, sizeof(string), "(WHISPER): %s(%d) %s",pname,playerid,output);
  SetPlayerChatBubble(playerid, string, COLOR_WHITE, 150.0, 10000);
  SendClientMessage(i,COLOR_YELLOW,string);
  }
  }
  }
  return 1;
  }
		
	}
	return 0;
}
[img width=1024 height=640]http://i46.tinypic.com/j8kx0w.png[/img]

Text above head.. but now in the chat I want to keep (WHISPER): Name(ID) text

and in chatbubble I only want the text, how am I going to do that?

EDIT: Sorry for double post.


Re: Quick question - Daan de Vries - 25.02.2010

bump. I really need help


Re: Quick question - VonLeeuwen - 25.02.2010

I think this should work:

Код:
if(strcmp("/w", cmdtext, true, 2)==0)
	{
	  if(strlen(cmdtext) <= 3)
		{
	    SendClientMessage(playerid,COLOR_RED,"USAGE: /w (msg)");
	    return 1;
	  }
	  new output[150];
	  new pname[24];
	  new string[128];
	  GetPlayerName(playerid, pname, 24);
	  strmid(output,cmdtext,2,strlen(cmdtext));
	  format(string, sizeof(string), "(WHISPER): %s(%d) %s",pname,playerid,output);
	  SetPlayerChatBubble(playerid, output, COLOR_WHITE, 150.0, 10000);
	  printf("%s", string);
	  for(new i=0;i<MAX_PLAYERS;i++)
		{
	    if(IsPlayerConnected(i) && GetDistanceBetweenPlayers(playerid,i) < 10)
			{
				format(string, sizeof(string), "(WHISPER): %s(%d) %s",pname,playerid,output);
	      SetPlayerChatBubble(playerid, output, COLOR_WHITE, 150.0, 10000);
	      SendClientMessage(i,COLOR_YELLOW,string);
	    }
  	}
  	return 1;
  	}



Re: Quick question - Daan de Vries - 25.02.2010

It works now, thanks.


Re: Quick question - VonLeeuwen - 25.02.2010

No problems, if you have any more questions, just ask them