[Need Help]Chat Bubbles
#1

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
Reply
#2

Explain this more
Reply
#3

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

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

Reply
#5

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

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.
Reply
#7

Help please.
Reply
#8

Quote:
Originally Posted by Second
Help please.
Reply
#9

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
}

//------------------------------------------------
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)