Jump to content
  • 0

Problema player text


BRAGA03

Question

Problema intalnita (descriere):Tot incerc sa fac sa imi apara textul playerului pe 2 randuri daca e prea lung, dar nu imi iese cum vreau eu. Prima data mi l-a impartit in doua parti egale, si eu nu vreau asa, iar acum, am incercat altceva, si nu merge deloc.
Ero(area / rile) / warning-(ul / urile): -
Liniile de cod / sursa / script-ul(obligatoriu):

stock SendSplitMessageEx(playerid, color,const final[])
{
    new buffer[EX_SPLITLENGTH+5];
    new len = strlen(final);
    if(len>EX_SPLITLENGTH)
    {
        new times = (len/EX_SPLITLENGTH);
        for(new i = 0; i < times+1; i++)
        {
            strdel(buffer, 0, EX_SPLITLENGTH+5);
            if(len-(i*EX_SPLITLENGTH)>EX_SPLITLENGTH)
            {
                strmid(buffer, final, EX_SPLITLENGTH*i, EX_SPLITLENGTH*(i+1));
                format(buffer, sizeof(buffer), "%s ...", buffer);
            }
            else
            {
                strmid(buffer, final, EX_SPLITLENGTH*i, len);
            }
            //SendClientMessage(playerid, color, buffer);
            ProxDetector(20.0, playerid, buffer,COLOR_GRAD1,COLOR_GRAD2,COLOR_GRAD3,COLOR_GRAD4,COLOR_GRAD5);
        }
    }
    else
    {
        //SendClientMessage(playerid, color, final);
        ProxDetector(20.0, playerid, final,COLOR_GRAD1,COLOR_GRAD2,COLOR_GRAD3,COLOR_GRAD4,COLOR_GRAD5);
    }
}
//OnPlayerText
SendSplitMessageEx(playerid, -1,text)


Imagini / Video (optional):-
Ati incercat sa rezolvati singur?: Da, de foarte multe ori.

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

Nu ai inteles ....

Deci asta e functia respectiva:

 

PUBLIC: ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
	{
	    if(IsPlayerConnectedEx(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(IsPlayerConnectedEx(i))
	            {
	                if(GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(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;
	}

In aceasta functie trebuie sa inlocuiesti functia SendClientMessage() cu SendSplitMessage() si apoi poti folosi functia Proxdetector cum o folosesti nde obicei si o sa-ti arate mesajul inpartit in 2 randuri daca e lung.

Edited by Jamal Alin

Cea mai sigura sursa de facut bani de buzunar in mediul virtual. Inregistreaza-te si pune-te pe treaba !!!

http://www.viespar.ro/?reff=ab8e9d8086304d6136eac03c710238d7

Link to comment
Share on other sites

  • 0

Lasa cu SendClientmessage pentru ca sa poti folosi in mai multe locuri aceasta functie care imparte mesajul.

Vezi ca trebuie sa ai #define EX_SPLITLENGTH si trebuie sa mai fie ceva, Modifica valorea in functie de cum vrei sa-ti afiseze textul. Acea valoarea reprezinta numarul de caractere afisate intr-un rand, cred ca 115 e cel mai bn.

Cea mai sigura sursa de facut bani de buzunar in mediul virtual. Inregistreaza-te si pune-te pe treaba !!!

http://www.viespar.ro/?reff=ab8e9d8086304d6136eac03c710238d7

Link to comment
Share on other sites

  • 0

Boss gandeste un pic si tu. ProxDetector tot pe SendClientMessage se bazeaza, deci poti modifica acea funcie si in loc de SendClientMessage sa folosesti SendSplitMessage in interiorul functiei ma refer.

Edited by Jamal Alin

Cea mai sigura sursa de facut bani de buzunar in mediul virtual. Inregistreaza-te si pune-te pe treaba !!!

http://www.viespar.ro/?reff=ab8e9d8086304d6136eac03c710238d7

Link to comment
Share on other sites

  • 0

Inteleg ce vrei sa spui. Incerc imediat.

EDIT

Deci tu zici sa o folosesc asa:

ProxDetector(30.0,  playerid, SendSplitMessageEx(playerid, -1, string), COLOR_GRAD1, COLOR_GRAD2, COLOR_GRAD3, COLOR_GRAD4, COLOR_GRAD5);

Imi da eroare la compilare. "argument type mistach(argument 3)", deci nu pot sa folosesc SendSplitMessageEx acolo :(

Edited by BRAGA03
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.