09.08.2011, 16:46
Ey guys !
So i've been working on a code for OnPlayerText :
public OnPlayerText(playerid, text[])
{
new string[256];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
for(new i = 0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerNearPlayer(i, playerid, 20.0))
{
format(string,sizeof(string),"%s : %s",name,text);
ProxDetector(20.0,playerid,string,GetPlayerColor(p layerid),GetPlayerColor(playerid),GetPlayerColor(p layerid),GetPlayerColor(playerid),GetPlayerColor(p layerid));
return 0;
} else {
SendClientMessage(playerid, COLOR_WHITE, "[INFO] You are too far, no one hear you ! ");
return 0;
}
}
}
return 0;
}
So basically, when the player is around other players, they will hear what he said, otherwise, if he's too far, no one will get what he said, and he will receive a msg '[INFO] You are too far, no one hear you !'
That works with a player ( ID : 1 ) who tested it with me !
but for me ( ID : 0 ), I always can send the msg, no matter if i'm near or far other players !
Would be cool to get some help, and thanks
So i've been working on a code for OnPlayerText :
public OnPlayerText(playerid, text[])
{
new string[256];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
for(new i = 0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerNearPlayer(i, playerid, 20.0))
{
format(string,sizeof(string),"%s : %s",name,text);
ProxDetector(20.0,playerid,string,GetPlayerColor(p layerid),GetPlayerColor(playerid),GetPlayerColor(p layerid),GetPlayerColor(playerid),GetPlayerColor(p layerid));
return 0;
} else {
SendClientMessage(playerid, COLOR_WHITE, "[INFO] You are too far, no one hear you ! ");
return 0;
}
}
}
return 0;
}
So basically, when the player is around other players, they will hear what he said, otherwise, if he's too far, no one will get what he said, and he will receive a msg '[INFO] You are too far, no one hear you !'
That works with a player ( ID : 1 ) who tested it with me !
but for me ( ID : 0 ), I always can send the msg, no matter if i'm near or far other players !
Would be cool to get some help, and thanks
