[Pomoc]Prox Detector


Započeo [CH] Adzax', Januar 07, 2014, 12:58:03 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Skripta koju koristim: Moja od 0
Detaljan opis problema: Ubacio sam Proxdetector i kada udjem na server opet svi vide ono sto ja pisem,a fino u njemu pise na 16 metara tamo ono potamni boja sve al opet svi vide nista,treba li jos sta dodati osim tog Prox detectora?
Dio skripte:/
Neke slike/video za lakse dobivanje pomoci(neobavezno):/
[bold][/bold]

pa buraz zavisi koliku udaljenost postavljas pri koristenju prox-a
69

razbu ima vako evo ti cijeli

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);
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i) && (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))) // If the player is within 16 meters
                {
                    SendClientMessage(i, col1, string);
                }
                else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8))) // within 8 meters
                {
                    SendClientMessage(i, col2, string);
                }
                else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4))) //4 meters
                {
                    SendClientMessage(i, col3, string);
                }
                else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2))) //2 meters
                {
                    SendClientMessage(i, col4, string);
                }
                else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) //1 meter
                {
                    SendClientMessage(i, col5, string);
                }
            }
            else
            {
                SendClientMessage(i, col1, string);
            }
        }
    }
    return 1;
}
[bold][/bold]

pa sto mi ovo dajes daj mi da vidim kako ga koristis
u tome gdje salje svima poruku..
69

pa to bas i ne znam,to i treba napravit al ne znam kako  :'(
[bold][/bold]

primer
new string[70];
format(string,sizeof(string),"text");
ProxDetector(10.0, playerid, string,BOJA,BOJA,BOJA,BOJA,BOJA);
69

Ne mora biti 'javna' funkcija, jer ne koristis je u pomocu tajmera / ne pozivas preko CLC.

stock ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
	new Float:posx, Float:posy, Float:posz, Float:oldposx, Float:oldposy, Float:oldposz, Float:tempposx, Float:tempposy, Float:tempposz, invehicle[MAX_PLAYERS], virtualworld = GetPlayerVirtualWorld(playerid), interior = GetPlayerInterior(playerid), vehicleid = GetPlayerVehicleID(playerid), ivehicleid;
	if(vehicleid) { GetVehiclePos(vehicleid,oldposx,oldposy,oldposz); }
    else
	{
		GetPlayerPos(playerid, oldposx, oldposy, oldposz);
	    vehicleid = GetPlayerVehicleID(playerid);
	}
	foreach(Player, i) {
    if(GetPlayerVirtualWorld(i) == virtualworld) {
	if((GetPlayerInterior(i) == interior)) {
	if(vehicleid) {
	if(IsPlayerInVehicle(i,vehicleid)) invehicle[i] = 1; }
	if(!invehicle[i]) {
	if(IsPlayerInAnyVehicle(i)) {
	ivehicleid = GetPlayerVehicleID(i);
	GetVehiclePos(ivehicleid,posx,posy,posz); }
	else {
	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))) SCM(i, col1, string);
	else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8))) SCM(i, col2, string);
	else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4))) SCM(i, col3, string);
	else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2))) SCM(i, col4, string);
	else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) SCM(i, col5, string);
	}
	else SCM(i, col1, string);
	}
	}
	}
	return 1;
}



Primjer koristenja:

new f_Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, f_Name, MAX_PLAYER_NAME);
new f_String[20+MAX_PLAYER_NAME];
format(fString, sizeof fString, "%s pali motor vozila.", f_Name);
ProxDetector(30.0, playerid, fString, 123450, 678950, 1357940, 2468040, 1526370);

sve ja to kontam al kako cu napravit kad igrac pise jedan sa drugim na IC chat da ne vide svi to meni treba
[bold][/bold]

Ne kontam te ba, pojasni malo bolje, mislis kad napises nesto na IC da to posalje samo NAJBLIZOJ osobi?

new	realchat = 1;

ovo dodaj pod OnPlayertext.
if(realchat)
{
		new chattext = strlen(text),string[256];
		for(new i = 0; i<chattext; i++) { if(IsNumeric(text[i])) text[i] = '*' ; }
		format(string, sizeof(string), "{FFFF00}(({FFFFFF}[IC] | {FFFF00}%s: {FFFFFF}%s{FFFF00}))", GetName(playerid), text);
		ProxDetector(20.0, playerid, string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
		return 0;
}

stock GetName(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    return name;
}
69

Eh to rodjeni hvala ti mnogo radi,moze lock!
[bold][/bold]