[POMOĆ] Range Chat

Započeo MiljanM, Mart 13, 2012, 00:22:45 PRE PODNE

prethodna tema - sledeća tema

0 članova i 2 gostiju pregledaju ovu temu.

Skripta koju koristim: Moja.
Detaljan opis problema: Znači ceo dan se mučim da napravim range chat tj. chat koji vide ljudi samo kad si blizu njih. Probao sam sa filterskriptama, probao sam kopirati iz drugog moda i sve radim i neće -.-
Dio skripte: /
Neke slike/video za lakse dobivanje pomoci(neobavezno): /

evo ovo sam sad sklepao


stock SendRangeMessage(playerid, Float:range, color, text[])
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
for(new i; i < MAX_PLAYERS; i++)
{
    if(IsPlayerConnected(i))
    {
        if(IsPlayerInRangeOfPoint(i, range, x, y, z))
        {
            SendClientMessage(i, color, text);
}
    }
}
return 1;
}


Mislim da ce raditi...

koristis ovako recimo:


new ex_string[128];
format(ex_string, sizeof(ex_string), "Pisem nesto bla bla bla");
SendRangeMessage(playerid, 20.0, 0xffffffff, ex_string);


ili


SendRangeMessage(playerid, 20.0, 0xffffffff, "Pisem nesto aaaaaaaaaaaaaaa");


A evo ti i ProxDetector iz GFa ako ti on vise koristi...


forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
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);
}
}
}
}//not connected
return 1;
}
Poslednja Izmena: Mart 13, 2012, 00:33:37 PRE PODNE od dock

Ne radi...
Poslednja Izmena: Mart 13, 2012, 00:43:27 PRE PODNE od ...Frank...

hmm neznam u cemu bi mogao biti problem :S

Probaj sa ProxDetectorom on sigurno radi ... nez stv u cemu moze biti problem sa ovim stockom sto sam napisao al ko zna hehe :D

Citat: dock poslato Mart 13, 2012, 00:45:07 PRE PODNE
hmm neznam u cemu bi mogao biti problem :S

Probaj sa ProxDetectorom on sigurno radi ... nez stv u cemu moze biti problem sa ovim stockom sto sam napisao al ko zna hehe :D
probao sam, ubacio sam i ovo tvoje pod onplayertext i svaki komandu koju ukucam ona ispadne u chat...

Ubaci ovo moje i pod onplayertext stavi ovo:

if(IsPlayerConnected(playerid))
{
new str[256];
new ime[MAX_PLAYER_NAME];
GetPlayerName(playerid, ime, sizeof(ime));
format(str, sizeof(str), "%s kaze: %s", ime, text);
SendRangeMessage(playerid, 20.0, 0xffffffff, str);
return 0;
}


Upravo sam testirao i radi... :/

Sutra ću probati idem spavati moram ujutro u školu.

EDIT: Ćale mi zapso ko jagnje i ja nabrzaka uradio i radi, sutra ću probati na lap top da vidim jel je dobro skroz.

Hvala ti u svakom slučaju.
Poslednja Izmena: Mart 13, 2012, 01:00:58 PRE PODNE od Frank.