SA-MP Forums Archive
telephone problem - 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: telephone problem (/showthread.php?tid=118746)



telephone problem - blax - 04.01.2010

i have a problem with GF telephone script.
if each phone. All People can see what you write

is it true or false?

under OnplayerText

if(Mobile[playerid] != 255)
{
new idx;
tmp = strtok(text, idx);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "%s Sagt (Handy): %s", sendername, text);
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_F ADE4,COLOR_FADE5);
// printf("callers line %d called %d caller %d",Mobile[Mobile[playerid]],Mobile[playerid],playerid);
return 0;
}




Re: telephone problem - blax - 04.01.2010

Quote:
Originally Posted by blax
i have a problem with GF telephone script.
if each phone. All People can see what you write

is it true or false?

under OnplayerText

Код:
if(Mobile[playerid] != 255)
			{
				new idx;
				tmp = strtok(text, idx);
				GetPlayerName(playerid, sendername, sizeof(sendername));
				format(string, sizeof(string), "%s Sagt (Handy): %s", sendername, text);
				ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
			//	printf("callers line %d called %d caller %d",Mobile[Mobile[playerid]],Mobile[playerid],playerid);
      return 0;
   		}



Re: telephone problem - MadeMan - 04.01.2010

What is the problem?


Re: telephone problem - blax - 04.01.2010

the problem is all players can read the Message
if two people call each other


Re: telephone problem - MadeMan - 04.01.2010

Show your ProxDetector function.

Should be something like this:

pawn Код:
public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
    if(IsPlayerConnected(playerid))
    {
...



Re: telephone problem - blax - 04.01.2010

is that right?


Код:
public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
	if(IsPlayerConnected(playerid))
	{
		new Float:posx, Float:posy, Float:posz;
		new Float:oldposx, Float:oldposy, Float:oldposz;
		new Float:tempposx, Float:tempposy, Float:tempposz;
		GetPlayerPos(playerid, oldposx, oldposy, oldposz);
		//radi = 2.0; //Trigger Radius
		for(new i = 0; i < MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				GetPlayerPos(i, posx, posy, posz);
				tempposx = (oldposx -posx);
				tempposy = (oldposy -posy);
				tempposz = (oldposz -posz);
				//printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
				if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
				{
					SendClientMessage(i, col1, string);
				}
				else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
				{
					SendClientMessage(i, col2, string);
				}
				else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
				{
					SendClientMessage(i, col3, string);
				}
				else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
				{
					SendClientMessage(i, col4, string);
				}
				else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
				{
					SendClientMessage(i, col5, string);
				}
			}
			else
			{
				SendClientMessage(i, col1, string);
			}
		}


	}	//not connected
	return 1;
}



Re: telephone problem - MadeMan - 04.01.2010

You mean all people in the server or only players who are near the talking player?


Re: telephone problem - blax - 04.01.2010

only players who are near the talking player
can read the Message
if two people call each other, can the third player is near in the read message


Re: telephone problem - MadeMan - 04.01.2010

If you want that only talking players can hear what they say then:

pawn Код:
if(Mobile[playerid] != 255)
{
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string, sizeof(string), "%s Sagt (Handy): %s", sendername, text);
    SendClientMessage(playerid, COLOR_FADE1, string);
    SendClientMessage(Mobile[playerid], COLOR_FADE1, string);
    //  printf("callers line %d called %d caller %d",Mobile[Mobile[playerid]],Mobile[playerid],playerid);
    return 0;
}



Re: telephone problem - blax - 04.01.2010

that is right tank you
now the problem of the players cann see what i read before it goes off