Skripta koju koristim : moj mod od 0
Opis problema : poksavao sam da napravim chat u igri koji vide igraci samo u blizini igraca koji prica, ne onaj chat sto vec postoji igrac sa jednog djela mape kaze nesto i to vidi igrac sa drugog djela mape, vec kako da napravim da to vidi samo igrac u blizini
Dio skripte : //
Slika/Video : //
[POMOC] Oko chata
280
pregleda
6
postova
4. Maj 2014.
4. Maj 2014.
new realchat = 1;
new textuchatu; // OnPlayerText
if (realchat)
{
if(gPlayerLogged == 0)
{
return 0;
}
format(textuchatu, sizeof(textuchatu), "%s kaze: %s",GetName(playerid),text);
HPROX(playerid, textuchatu,0xFFFFFFAA, 15.0);
return 0;
}
HPROX(id,const iString[],color = 0xFFFFF, Float:Distance)
{
new
Float:Pos;
foreach(Player, i)
{
GetPlayerPos(id, Float:Pos, Float:Pos, Float:Pos);
if(IsPlayerInRangeOfPoint(i, Float:Distance, Float:Pos, Float:Pos, Float:Pos))
{
SendClientMessage(i,color,iString);
}
else return false;
}
return true;
}
stock GetName(playerid)
{
new pName, usPos;
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
usPos = strfind(pName, "_");
if (usPos != -1) pName = ' ';
return pName;
}Tako ti je u mom modu.. ako nešto ne razumiješ napiši šta te zanima
4. Maj 2014.
public OnPlayerText(playerid, text[])
{
new string;
format(string, sizeof(string), "%s kaze: %s", GetName(playerid), text);
ProxDetector(20.0, playerid, string, -1, -1, -1, -1, -1);
return 0;
}
i stock getname, ukoliko nemaš
stock GetName(playerid)
{
new ime;
GetPlayerName(playerid, ime, MAX_PLAYER_NAME);
return ime;
}
edit: proxdetector ako nemaš
stock ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
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);
for(new i= (0), slotovi = GetMaxPlayers(); i!= slotovi; ++ i)
{
if(IsPlayerConnected(i))
{
GetPlayerPos(i, posx, posy, posz);
tempposx = (oldposx -posx);
tempposy = (oldposy -posy);
tempposz = (oldposz -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);
}
}
}
return 1;
}
4. Maj 2014.
Hitman wrote on May 4, 2014, 12:42 pm:
public OnPlayerText(playerid, text[])
{
new string;
format(string, sizeof(string), "%s kaze: %s", GetName(playerid), text);
ProxDetector(20.0, playerid, string, -1, -1, -1, -1, -1);
return 0;
}
i stock getname, ukoliko nemaš
stock GetName(playerid)
{
new ime;
GetPlayerName(playerid, ime, MAX_PLAYER_NAME);
return ime;
}
edit: proxdetector ako nemaš
stock ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
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);
for(new i= (0), slotovi = GetMaxPlayers(); i!= slotovi; ++ i)
{
if(IsPlayerConnected(i))
{
GetPlayerPos(i, posx, posy, posz);
tempposx = (oldposx -posx);
tempposy = (oldposy -posy);
tempposz = (oldposz -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);
}
}
}
return 1;
}
AlenTheBest kaze: aaaa
AlenTheBest:aaaa
tako mi izadje
Morate biti prijavljeni da biste odgovorili na ovu temu.
Prijava