SA-MP Forums Archive
[Need Help]Chat Bubbles - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Need Help]Chat Bubbles (/showthread.php?tid=129833)



[Need Help]Chat Bubbles - geerdinho8 - 23.02.2010

I have made this script:

Код:
#include <a_samp>
#include <a_players>
Код:
  	if(!strcmp("/say", cmdtext, true))
  {
  SetPlayerChatBubble(playerid, text, 0xFF0000FF, 100.0, 10000);
    return 1;
  }
And i get this error:

Код:
C:\Documents and Settings\Eigenaar\Bureaublad\LVRPG\gamemodes\lvrp.pwn(544) : error 017: undefined symbol "SetPlayerChatBubble"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Please help.

Regards,

Second



Re: [Need Help]Chat Bubbles - bajskorv123 - 23.02.2010

Explain this more


Re: [Need Help]Chat Bubbles - geerdinho8 - 23.02.2010

I want to make a new command: /say.
EXAMPLE: If someone types /say hello, i want that it shows hello in text bubbles.


Re: [Need Help]Chat Bubbles - bajskorv123 - 23.02.2010

Simplest to use strtok
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  new cmd[128], idx;
  cmd = strtok(cmdtext, idx);

  if(strcmp("/say", cmd, true)==0)
  {
    new tmp[128];
    new iText;
    tmp = strtok(cmdtext, idx);
    iText= strval(tmp);

    if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /say [Text]");

    SetPlayerChatBubble(playerid, iText, 0xFF0000FF, 100.0, 10000);
    return 1;
  }
  return 0;
}

//Somewhere in your script
stock strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }
 
    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}




Re: [Need Help]Chat Bubbles - GhoulSlayeR - 23.02.2010

Also, you don't have to include <a_players>, It's already included with <a_samp> so just use it.


Re: [Need Help]Chat Bubbles - geerdinho8 - 24.02.2010

Still i have the error:
Код:
C:\Documents and Settings\Eigenaar\Bureaublad\LVRPG\gamemodes\lvrp.pwn(553) : error 017: undefined symbol "SetPlayerChatBubble"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
How to define chatbubbles?:S


EDIT: If i put it in empty script i get this error:
Код:
C:\Documents and Settings\Eigenaar\Bureaublad\Roleplay\Kopie van gamemodes\test.pwn(107) : error 035: argument type mismatch (argument 2)
C:\Documents and Settings\Eigenaar\Bureaublad\Roleplay\Kopie van gamemodes\test.pwn(104) : warning 204: symbol is assigned a value that is never used: "iText"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.



Re: [Need Help]Chat Bubbles - geerdinho8 - 24.02.2010

Help please.


Re: [Need Help]Chat Bubbles - geerdinho8 - 24.02.2010

Quote:
Originally Posted by Second
Help please.



Re: [Need Help]Chat Bubbles - Thomas_Ahmey - 24.02.2010

pawn Код:
//
// Example use of chat above player's head
//

#include <a_samp>
#include "../include/gl_common.inc"

#define MESSAGE_COLOR        0xEEEEEEFF
#define ECHO_COLOR           0xEEEEEEFF
#define ACTION_COLOR     0xEE66EEFF

//------------------------------------------------

public OnFilterScriptInit()
{
    print("\n--Speech bubble example loaded.\n");
    return 1;
}

//------------------------------------------------

public OnPlayerText(playerid, text[])
{
     if(strlen(text) > 128) return 0;
     
     new to_others[MAX_CHATBUBBLE_LENGTH+1];
     new to_me[MAX_CHATBUBBLE_LENGTH+1];
     
     format(to_others,MAX_CHATBUBBLE_LENGTH,"Says: %s",text);
     format(to_me,MAX_CHATBUBBLE_LENGTH,">> %s",text);
     
   SetPlayerChatBubble(playerid,to_others,MESSAGE_COLOR,35.0,10000);
   SendClientMessage(playerid,ECHO_COLOR,to_me);
   
   return 0; // can't do normal chat with this loaded
}

//------------------------------------------------

public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[256];
    new Message[256];
    new idx;
    new actiontext[MAX_CHATBUBBLE_LENGTH+1];

    cmd = strtok(cmdtext, idx);

    // Action command
    if(strcmp("/say", cmd, true) == 0)
    {
      Message = strrest(cmdtext,idx);
      format(actiontext,MAX_CHATBUBBLE_LENGTH,"* %s",Message);
        SetPlayerChatBubble(playerid,actiontext,ACTION_COLOR,30.0,10000);
    SendClientMessage(playerid,ACTION_COLOR,actiontext);
        return 1;
    }
   
    return 0; // not handled by this script
}

//------------------------------------------------