Jump to content

Ajutor cu ProxDetector


Xtrem_Maddox

Recommended Posts

Salut, banuiesc ca multi dintre voi sunteti familiarizati cu ProxDetector.

As vrea sa stiu si eu cum pot sa fac urmatorul lucru intr-un chat:

John says: Hello!

 

Mai pe scurt, vreau ca NUMAI NUMELE jucatorului sa isi pastreze culoarea pe care o are, dar restul sa fie influentat de ProxDetector. De exemplu, sa zicem ca exemplul de mai sus s-a intamplat cand erai foarte aproape de player si el a spus "Hello!". Urmatorul exemplu se intampla atunci cand esti la cativa metri distanta de el:

John says: Hello!

Adica ProxDetectorul sa faca restul mai inchis la culoare, dar numele jucatorului sa ramana cu exact aceeasi culoare pe care o are jucatorul respectiv.

Link to comment
Share on other sites

Salut @Xtrem_Maddox,

Pune functia ProxDetector pe pastebin, ca nu stiu cum functioneaza, si poate te pot ajuta.

Deci daca jucatorul e la 5m spre ex fata de alt jucator, sa apara in chat: John says: Hello!, iar daca e la 15m, sa-i apara in chat: John says: Hello! (Ca un exemplu)

Daca te-am ajutat =>

spacer.png

Link to comment
Share on other sites

49 minutes ago, shane said:

Salut @Xtrem_Maddox,

Pune functia ProxDetector pe pastebin, ca nu stiu cum functioneaza, si poate te pot ajuta.

Deci daca jucatorul e la 5m spre ex fata de alt jucator, sa apara in chat: John says: Hello!, iar daca e la 15m, sa-i apara in chat: John says: Hello! (Ca un exemplu)

Salut! Da, exact cum ai spus tu. Culoarea playerului sa ramana aceeasi, in timp ce culoarea de la restul stringului (incepand de la "says: ....") sa fie influentata de ProxDetector.

Uite: https://pastebin.com/wUCPitfY

Link to comment
Share on other sites

Foloseste aceasta functie, care ar trebui sa-ti functioneaze (teoretic):

stock SendCloseMessage(playerid, color, const message[], Float:range = 5.0)
{
	new 
		virtualid = GetPlayerVirtualWorld(playerid),
		String[124],
		Float: X,
		Float: Y,
		Float: Z;

	GetPlayerPos(playerid, X, Y, Z);

	foreach(new i : Player)
	{
		if(IsPlayerConnected(i))
		{
			if(IsPlayerInRangeOfPoint(i, range, X, Y, Z) && GetPlayerVirtualWorld(i) == virtualid)
			{
				format(String, sizeof String, "%s {ffff00}says: %s", GetName(playerid), message);
				SendClientMessage(i, color, String);
			}
			else if(IsPlayerInRangeOfPoint(i, range - 5.0, X, Y, Z) && GetPlayerVirtualWorld(i) == virtualid)
			{
				format(String, sizeof String, "%s {ff0000}says: %s", GetName(playerid), message);
				SendClientMessage(i, color, String);
			}
		}
	}

	return true;
}

Practic, daca tu pui range 10.0 (10m), jucatorii vor primi o culoarea anume, pe care o setezi din format (ex, eu am pus: {ffff00}), iar daca e la -5.0 fata de rangeul setat, va fi alta culoare. Lucrurile astea le modifici tu, dupa bunul plac.

Exemplu folosire:

SendCloseMessage(playerid, COLOR_ORANGE, "Salut!", 10.0);
RESULT: "shane (culoare portocaliu)" "says: Salut! (culoare rosie)

Cam atat, daca sunt probleme, ma anunti, daca nu, succes!

Edited by shane
  • Like 1

Daca te-am ajutat =>

spacer.png

Link to comment
Share on other sites

1 hour ago, shane said:

Foloseste aceasta functie, care ar trebui sa-ti functioneaze (teoretic):

stock SendCloseMessage(playerid, color, const message[], Float:range = 5.0)
{
	new 
		virtualid = GetPlayerVirtualWorld(playerid),
		String[124],
		Float: X,
		Float: Y,
		Float: Z;

	GetPlayerPos(playerid, X, Y, Z);

	foreach(new i : Player)
	{
		if(IsPlayerConnected(i))
		{
			if(IsPlayerInRangeOfPoint(i, range, X, Y, Z) && GetPlayerVirtualWorld(i) == virtualid)
			{
				format(String, sizeof String, "%s {ffff00}says: %s", GetName(playerid), message);
				SendClientMessage(i, color, String);
			}
			else if(IsPlayerInRangeOfPoint(i, range - 5.0, X, Y, Z) && GetPlayerVirtualWorld(i) == virtualid)
			{
				format(String, sizeof String, "%s {ff0000}says: %s", GetName(playerid), message);
				SendClientMessage(i, color, String);
			}
		}
	}

	return true;
}

Practic, daca tu pui range 10.0 (10m), jucatorii vor primi o culoarea anume, pe care o setezi din format (ex, eu am pus: {ffff00}), iar daca e la -5.0 fata de rangeul setat, va fi alta culoare. Lucrurile astea le modifici tu, dupa bunul plac.

Exemplu folosire:

SendCloseMessage(playerid, COLOR_ORANGE, "Salut!", 10.0);
RESULT: "shane (culoare portocaliu)" "says: Salut! (culoare rosie)

Cam atat, daca sunt probleme, ma anunti, daca nu, succes!

Am modificat prin functia ta si am obtinut rezultatul pe care-l voiam in final.

Multumesc frumos!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.