[POMOC] Chat


Započeo MaX91, Maj 16, 2011, 14:34:04 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Skripta koju koristim: Mod od 0.
Detaljan opis problema: Ovako, sve mi je radilo dobro, kad odjednom uÄ'em u igricu, sve sam pokrenuo, server itd, uÄ'em u igricu, sve komande hoće, ali mi neće CHAT. Chat: Kao ono na Stunt/DM - Svi vide. Molim vas pomozite!
Dio skripte: /
Neke slike/video za lakse dobivanje pomoci(neobavezno): /
Poslednja Izmena: Maj 16, 2011, 14:34:21 POSLE PODNE od Reddy

Objasni malo vise, daj nam OnPlayerText

Prazno mi je OnPlayerText, tj:
public OnPlayerText(playerid, text[])
{
    return 0;
}

Šta misliš sad?

Napravis nesto kao ProxDetector (jednostavnije i bolje) i onda tu u onplayertext dodas:
Kod: c
   new
    string[128],
    sendername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string, sizeof(string), "IC ~ %s ~ %s ", sendername, text[0]);
    ProxDetector(30, playerid, string, 0xFFFFFFFF, 0xEFEFEFFF, 0xDFDFDFFF, 0xCFCFCFFF, 0xBFBFBFFF);//naprimer ako budes radio sa prox detectorom



NPR pogledaj ovo:
Citat: [AG] BloodMaster poslato April 13, 2011, 20:20:47 POSLE PODNE
Evo nesto kao /me komanda

Prvo morate imati ovo:

stock SendClientMessageInRangeOfPoint(str[],boja,radius,Float:x,Float:y,Float:z)
{
	//by BloodMaster
	new players = GetMaxPlayers();
	for(new i=0; i<players i++)
	{
	if(IsPlayerInRangeOfPoint(i,radius,x,y,z) SendClientMessage(i,boja,str);
 	}
	return 1;
}



A zatim ovo:

stock PlayerDoing(playerid,text[]/*Pusa eXtreme*/)
{
 //by BloodMaster
 if(!IsPlayerConnected(playerid)) return 1;
 new ime[20],string[128],Float:x,Float:y,Float:z;
 GetPlayerName(playerid,ime,20);
 format(string,sizeof string,"* %s %s",ime,text);
 GetPlayerPos(playerid,x,y,z);
 SendClientMessageInRangeOfPoint(string,C623CF,15,x,y,z);
 return 1;
}


Evo jedan primjer:


PlayerDoing(playerid,"ulazi u vozilo.");  //To npr dodate u OnPlayerEnterVehicle

i u igri ce pisati ovako:

*Netko_Netkic ulazi u vozilo.

Nece naravno pisati netko netkic vec ime koje taj igrac koristi... Kul, ha?

Poslednja Izmena: Maj 16, 2011, 16:57:15 POSLE PODNE od eXtreme

Ne, ja neću za IC chat, nisi me shvatio, ja hoću za običan chat.
Sada ću to da isprobam.
EDIT: Ne pomaže ni to.
Poslednja Izmena: Maj 16, 2011, 17:04:41 POSLE PODNE od Reddy

Kod: c
public OnPlayerText(playerid, text[])
{
    return 1;
}

Mislis  na lokalan chat ? To bi mogao uradit sa ProxDetectorom ili IfIsPlayerInRangeOfPoint..

Evo ti ProxDetector 

Prvo ga najavi gore iznad Main ..

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


A ovo dodaj ispod  OnPlayerText(playerid,text[])

     new pname[24], str[128];
    GetPlayerName(playerid, pname, 24);
    format(str, sizeof(str), "%s zboruva: %s", pname, text);
    ProxDetector(10.0, playerid, str, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);

Citat: #InphiniteGamer poslato Maj 16, 2011, 17:16:07 POSLE PODNE
Mislis  na lokalan chat ? To bi mogao uradit sa ProxDetectorom ili IfIsPlayerInRangeOfPoint..

Evo ti ProxDetector 

Prvo ga najavi gore iznad Main ..

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


A ovo dodaj ispod  OnPlayerText(playerid,text[])

     new pname[24], str[128];
    GetPlayerName(playerid, pname, 24);
    format(str, sizeof(str), "%s zboruva: %s", pname, text);
    ProxDetector(10.0, playerid, str, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);

Nema potrebe da ponovis isto...
Kao ono na Stunt/DM - Svi vide
Ima return 0; a treba biti return 1; ili return true;


Citat: Reddy poslato Maj 16, 2011, 17:20:58 POSLE PODNE
Hvala ti Extreme kralju. ;)
Može LOCK.
Na Nebu i zemlji vlada Bog, na ovom forumu Correlli(sad ja nastavljam) a na ovom PDF ja xD


Nema problema, pitaj ukoliko jos nesto nije jasno!
Poslednja Izmena: Maj 16, 2011, 17:24:53 POSLE PODNE od eXtreme