Skripta koju koristim: od 0
Detaljan opis problema: kako da nemstim da se poruke mogu videti u odredjenom rangeu?
Dio skripte: /
Neke slike/video za lakse dobivanje pomoci(neobavezno): /
?
Kakve poruke u chatu ili nesto drugo?
Jap u chatu poruke da se mogu videti u nekom rangeu (krugu)
[pawn]
if( IsPlayerInRangeOfPoint( playerid, range, X, Y, Z )) {
//ovde trebas da stavis sta se dogadja ako je u odredjenom radiusu
}
[/pawn]
Mislim da to nije to. Ja znam sta sa tim mogu da dobijem ali to nije ovo sto ja hocu il ja bar tako mislim
Onda daj detaljan opis tvog problema.
Kada kuca neko poruku u cet ja necu da tu poruku vide svi igraci na serveru nego samo oni u nekom krugu tj rangeu
To je to sto sam ti poslao, samo postavi foreach da proveri sve igrace..
[pawn]if( IsPlayerInRangeOfPoint( playerid, range, X, Y, Z )) //ovdje postavis koridnante gde oces da to uradis primer 222.222,32333.2333,23334.2233 , imas i da dodas regiunu primer: las vegas - park centar
{
// dodaj teksta u sta se dogadja u tom regionu
}
else SCM(playerid, WHITE, "Niste u regiunu gde treba to da se radi TEXT ukucaj");/// to mozes postaviti ako se radi u komandama][/pawn]
Citat: Ilcev321 poslato Mart 13, 2016, 16:42:05 POSLE PODNE
[pawn]if( IsPlayerInRangeOfPoint( playerid, range, X, Y, Z )) //ovdje postavis koridnante gde oces da to uradis primer 222.222,32333.2333,23334.2233 , imas i da dodas regiunu primer: las vegas - park centar
{
// dodaj teksta u sta se dogadja u tom regionu
}
else SCM(playerid, WHITE, "Niste u regiunu gde treba to da se radi TEXT ukucaj");/// to mozes postaviti ako se radi u komandama][/pawn]
Nekontam sto pises kad neznas. Procitaj sta hocu. Hocu da napravim da se poruka moze prenositi u odredjenom rangeu a ne da mi neko sad npr iz SF cuje poruke u LS
Ovako nesto napravis
[pawn]GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
foreach(Player, i)
{
if(IsPlayerInRangeOfPoint(i, 20.0, Pos[0], Pos[1], Pos[2]))
{
format(string, sizeof string, "%s : ", playerid, text);
SendClientMessage(i, COLOR_WHITE, string);
}
}[/pawn]
Ovo bi msm trebali pod Onplayertext
aaa svatio sam te kad pises sa nekom u chatu da ne se posajle ono niz celom gradu tuku u regiunui gde sajles poruke
Da probas sa ProxDetector?
Bas niko nezna? Svaki mod to ima
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);
foreach(Player,i)
{
if(IsPlayerConnected(i))
{
if(GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(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;
}
Ako ti treba pod OnplayerText
#define BELA 0xFFFFFFAA
new tekst1 = strlen(text),string[256];
new ime[MAX_PLAYER_NAME];
GetPlayerName(playerid, ime, sizeof(ime));
for(new i = 0; i<tekst1; i++) { if(IsNumeric(text[i])) text[i] = '*' ; }
format(string, sizeof(string), "%s kaze: %s", ime, text);
SetPlayerChatBubble(playerid, text, 0x44FF00AA, 20.0, 15000);
ProxDetector(20.0, playerid, string,BELA,BELA,BELA,BELA,BELA);
Mozes i u komandi koristit, primer
Boja ljubicasta ona
#define PROX 0xC2A2DAAA
YCMD:me(playerid, params[], help)
{
#pragma unused help
new result[1024];
if(sscanf(params, "s[80]", result)) return SCM(playerid, BELA, "Koristite: /me [tekst]");
new tekst1 = strlen(result);
for(new i = 0; i<tekst1; i++) { if(IsNumeric(result[i])) result[i] = '*' ; }
new string[256];
format(string, sizeof string, "* %s %s",GetName(playerid),result);
ProxDetector(30.0, playerid, string, PROX,PROX,PROX,PROX,PROX);
return 1;
}
IsNumeric(const string[])
{
for (new i = 0, j = strlen(string); i < j; i++)
{
if (string[i] > '9' || string[i] < '0') return 0;
}
return 1;
}
stock GetName(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
return name;
}
ProxDetector(radius, playerid, string, BOJA1,BOJA2,BOJA3,BOJA4,BOJA5);
Dobio si odgovor, tema ide pod lock.