[Pomoc] Prox Detector


Započeo |LOB| Robi.pwn, April 07, 2013, 18:28:11 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Skripta koju koristim:Moj gm od 0
Detaljan opis problema:Htio bih da napravim prox detector dali moze ovako?
Dio skripte:

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;
}

Neke slike/video za lakse dobivanje pomoci(neobavezno):
Citat: [RS]panameR. poslato Novembar 24, 2012, 13:50:32 POSLE PODNE
Citat: [FG] Tixa Mukic poslato Novembar 24, 2012, 11:12:07 PRE PODNE
Jel mi moze netko objasnit kako popuni i to sve opću uplatnicu :'(
kemijskom

Blaeks RESPECT!
joXy_ BIG RESPECT!
CkusaColeCM RESPECT!
Ivan_Ino.pwn BIG RESPECT!

Ovako to napravi:

i onda korsiti:


ProxDetector(30.0, playerid, string, LJUBICASTA,LJUBICASTA,LJUBICASTA,LJUBICASTA,LJUBICASTA);


function ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
	if(IsPlayerConnected(playerid))
	{
		new Float:posx, Float:posy, Float:posz;
		new BigEar[MAX_PLAYERS];
		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)))
			{
				if(!BigEar[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);
					}
				}
				else
				{
					SendClientMessage(i, col1, string);
				}
			}
		}
	}
	return 1;
}
BIG RESPEKT: Blaeks,  [CRP] Joey_, David (Sabljak) A.k.A SABO(T), joXy_, Dimi, Sexserghy ♥, TerminuS, H1TM4N

za onu funkciju radim forward ili?


Citat: [RS]panameR. poslato Novembar 24, 2012, 13:50:32 POSLE PODNE
Citat: [FG] Tixa Mukic poslato Novembar 24, 2012, 11:12:07 PRE PODNE
Jel mi moze netko objasnit kako popuni i to sve opću uplatnicu :'(
kemijskom

Blaeks RESPECT!
joXy_ BIG RESPECT!
CkusaColeCM RESPECT!
Ivan_Ino.pwn BIG RESPECT!

[]Flynâ„¢

*

Never look down on anybody unless you're helping them up.

Jednostavnije ovako

stock ProxDetector(Float:radi, playerid, string[],color)
{
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);
    foreach(Player,i)
    {
        if(IsPlayerInRangeOfPoint(i,radi,x,y,z))
        {
            SendClientMessage(i,color,string);
        }
    }
}


I onda:
ProxDetector(RADIUS, playerid, STRING, BOJA);



Primer:
YCMD:b(playerid, params[], help)
{
	#pragma unused help
	new
	    tekst[64],
		poruka;
        if(sscanf(params,"s[64]", poruka)) return SCM(playerid, -1, "[Koristi]: /b [Tekst]");
	format(tekst, sizeof(tekst), "(([OOC]%s kaže: %s))", ImeIgraca(playerid), poruka);
	ProxDetector(30, playerid, tekst, LJUBICASTA);
  	return 1;
}

Brate daj strcmp nista ovo nerazumijem aaaaaaaaaaaaa:Sž

EDIT:Sori hahaha Nisam cito:P

EDIT:2 Jel to isto i na /t?
Poslednja Izmena: April 07, 2013, 18:59:11 POSLE PODNE od Robi031
Citat: [RS]panameR. poslato Novembar 24, 2012, 13:50:32 POSLE PODNE
Citat: [FG] Tixa Mukic poslato Novembar 24, 2012, 11:12:07 PRE PODNE
Jel mi moze netko objasnit kako popuni i to sve opću uplatnicu :'(
kemijskom

Blaeks RESPECT!
joXy_ BIG RESPECT!
CkusaColeCM RESPECT!
Ivan_Ino.pwn BIG RESPECT!