PDA

View Full Version : BubbleChat


HondaCBR
29/12/2011, 05:12 PM
I posted topic on this before, I know. But it hasnt been helpful and the heading doesnt match the problem so I edited the command as much as I could and Im posting again, sorry if its double posint.

Still doesnt work. I want: IF you type in the chat:
"Yo" - It will come up as Name says: Yo [this works]
".Yo" - It will come up in a bubble above your head for like 5s [Doesnt work]


public OnPlayerText(playerid, text[])
{
if(!strcmp(text[0], ".", true))
{
SetPlayerChatBubble(playerid, text[1], 0xFF0000FF, 100.0, 10000);
return 1;
}
else
{
new string[256];
new sendername[MAX_PLAYER_NAME];
if(gPlayerLogged[playerid] == 0)
{
return 0;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "%s says: %s", sendername, text);
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_F ADE4,COLOR_FADE5);
ApplyAnimation(playerid,"PED","IDLE_CHAT",4.0,0,0,0,4,4);
return 0;
}
}

James Coral
29/12/2011, 05:17 PM
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_F ADE4,COLOR_FADE5);


wtf is that???? i have seen the code but i dont get the function
btw show us your Error from Pawno

HondaCBR
29/12/2011, 08:25 PM
That is real chat, chat within 20, and closer you are to that guy the colour change. So at closest its white then it goes kind of gray.

There are no erros, its just that it doesnt work, the bubble doesnt pop up, you typee .yo or yo, and it will come up with that in the normal name says: text, chat.

thimo
29/12/2011, 08:42 PM
Use

if( text [ 0 ] == '.')

instead of:

if(!strcmp(text[0], ".", true))

Edit: OnPlayerText should also return in a value

HondaCBR
29/12/2011, 10:43 PM
Thx, it works, it comes in a bubble but it also comes in the chat, how can I get rid of that? Im up to there:
if(text[0]=='.')
{
SetPlayerChatBubble(playerid, ((text[1])), COLOR_LIGHTLIGHTBLUE, 15.0, 7000);
return 1;
}
else
{
new string[256];
new sendername[MAX_PLAYER_NAME];
if(gPlayerLogged[playerid] == 0)
{
return 0;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "%s mówi: %s", sendername, text);
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_F ADE4,COLOR_FADE5);
ApplyAnimation(playerid,"PED","IDLE_CHAT",4.0,0,0,0,4,4);
return 0;
}

And how can I edit that '.' bit so now it also gives a bubble when you put "!!" after the text?

Azzeto
29/12/2011, 10:53 PM
OnPlayerText return 0 mabye?

HondaCBR
29/12/2011, 11:36 PM
Yeah i changed that after I posted this, I still need to know how to do text!!, to come in a bubble too.

And how can I but the bubble text in bracket? I tried : SetPlayerChatBubble(playerid, ((text[1])), COLOR_LIGHTLIGHTBLUE, 15.0, 7000);

but it doesnt work

HondaCBR
30/12/2011, 02:06 AM
Ok I sorted everything out now.public OnPlayerText(playerid, text[])
{
if(text[0]=='.')
{
new string[256];
format(string, sizeof(string), "((%s))",text[1]);
SetPlayerChatBubble(playerid, string, COLOR_LIGHTLIGHTBLUE, 15.0, 7000);

new string2[256];
format(string2, sizeof(string2), "[ID:%d][OOC]Oscar Gonzalez: %s",playerid,text[1]);
SendClientMessage(playerid, COLOR_WHITE, string2);

return 0;
}
if(text[1]=='!')
{
new string[256];
new sendername[MAX_PLAYER_NAME];
if(gPlayerLogged[playerid] == 0)
{
return 0;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "%s krzyczy: %s!!", sendername, text);
ProxDetector(40.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_F ADE4,COLOR_FADE5);
return 0;
}
else
{
new string[256];
new sendername[MAX_PLAYER_NAME];
if(gPlayerLogged[playerid] == 0)
{
return 0;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "%s mówi: %s", sendername, text);
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_F ADE4,COLOR_FADE5);
ApplyAnimation(playerid,"PED","IDLE_CHAT",4.0,0,0,0,4,4);
return 0;
}
return 1;
}

All i need now, is in the second part:

if(text[1]=='!')
{
new string[256];
new sendername[MAX_PLAYER_NAME];
if(gPlayerLogged[playerid] == 0)
{
return 0;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "%s krzyczy: %s!!", sendername, text);
ProxDetector(40.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_F ADE4,COLOR_FADE5);
return 0;
}

So when you type "wtf is this!" it will work, because currently it only works if "!" is the 2nd character, and ideas? ! needs to be in somewhere but not first, it would be best if you could use it last.