PDA

View Full Version : [Include] [INC] Easy Local Chat!


goudewup
30/01/2010, 02:16 PM
Easy Local Chat
By Goudewup

What is it?
Easy Local Chat is a include that makes it easy to make a local chat like in most RP servers.
Feel free to use it, but don't remove the credits!
It ads the following functions:
GetDistanceBetweenPlayers(playerid, playerid2)
SendLocalMessage(playerid, color, radius ,string[]);

Examples:

public OnPlayerText(playerid,text[])
{
new name[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s: %s", name, text);
SendLocalMessage(playerid, COLOR_WHITE, 7,string);// Send the message
return 0; // Makes sure the original message isn't send
}

This code will make all chat messages send local.


if(strcmp(cmdtext, "/me", true, 3) == 0)
{
if(!cmdtext[3])return SendClientMessage(playerid, COLOR_RED, "USAGE: /me [text]");
new str[128];
GetPlayerName(playerid, str, sizeof(str));
format(str, sizeof(str), "*%s %s", str, cmdtext[4]);
SendLocalMessage(playerid, COLOR_PURPLE, 7, str);
return 1;
}

This is a working /me command.

Installation:
All you have to do is put this under #include <a_samp>:
#include <LocalChat>

Changelog

Version 2
Added a paramater to declare the radius of the chat.


Download:
V2
Pastebin (http://pawn.pastebin.com/f12af5060) (save as LocalChat.inc)
Updo (http://updo.nl/file/b54f68a0.inc) (Hotlink)


V1
Pastebin (http://pawn.pastebin.com/f6ef1d6a3) (save as LocalChat.inc)
Updo (http://updo.nl/file/4ad3af40.inc) (Hotlink)
2Shared (http://www.2shared.com/file/11006681/a51f10af/LocalChat.html)

goudewup
30/01/2010, 02:58 PM
Hmm, good idea for the next version. :)

NiiRV4N4
25/03/2010, 06:56 PM
I get this error when I try to use your local snippet for my RP server.

C:\Users\Sarin\Desktop\GM From Scratch\gamemodes\GM.pwn(370) : error 035: argument type mismatch (argument 3)


SetPlayerChatBubble(playerid, text, WHITE, 10.0, 5000);
new lname[MAX_PLAYER_NAME], lstring[128];
GetPlayerName(playerid, lname, sizeof(lname));
format(lstring, sizeof(lstring), "%s says: %s", lname, text);
SendLocalMessage(playerid, WHITE, 7,lstring);
return 0;



This is fake. It doesn't have anything about a radius in the second version. I checked.