SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 20/02/2016, 04:57 AM   #1
illuminati2
Big Clucker
 
Join Date: Feb 2016
Posts: 77
Reputation: 21
Flowers (AdvancedChat.inc) - Fully Controllable Chat

Hello SA-MP Forums, today I gonna release my Advanced Chat include, this include will make you control chat in all ways with just some few call backs and functions. I've added two optional features in it, Flood Protection & Random Color. Gonna explain how to change them below. Firstly you've to type this at the top of your script.
PHP Code:
#include <AdvancedChat> 
Now you'll be able to use all the includes functions and callbacks on your script. I've made this include in the simplest way so beginners and newbies won't be facing any problems while using it.


Callbacks
PHP Code:
    forward OnChatInit();
    
forward OnChatEnabled();
    
forward OnChatDisabled();
    
forward OnPlayerMuted(playerid);
    
forward OnPlayerUnMuted(playerid); 

Functions
PHP Code:
    ToggleChat(boolToggle);
    
ClearChat();
    
ToggleChatID(boolToggle);
    
TogglePlayerChat(playeridboolToggle);
    
TempPlayerMute(playeridminutes);
    
SendPlayerMessageInPointToAll(playeridmsg[], distanceFloat:xFloat:yFloat:z); 
ToggleChat(bool: Toggle);
Description: Allow/Dis Allow players to use the chat feature.
Example:
PHP Code:
    ToggleChat(true); // this will allow players to use chat.
    //Put this somewhere 
ClearChat();
Description: Clear the chat like as it was when the server started.
Example:
PHP Code:
    ClearChat(); // This will clear the chat.
    //Put this somewhere 
ToggleChatID(bool: Toggle);
Description: Allow/Dis Allow Showing ID beside the player's name.
Example:
PHP Code:
    ToggleChatID(true); // this will allow showing ID beside player's name.
    //Put this somewhere 
TogglePlayerChat(playerid, bool: Toggle);
Description: Allow a specified player to chat or disallow him to.
Example:
PHP Code:
    TogglePlayerChat(playeridfalse); // This will make the player not able to chat.
    //Put this somewhere in a command 
TempPlayerMute(playerid, minutes);
Description: Mute a specified player for the minutes you set.
Example:
PHP Code:
    TempPlayerMute(playerid2); // This will mute the player for 2 minutes.
    //Put this somewhere in a command 
SendPlayerMessageInPointToAll(playerid, msg[], Float:distance, Float, Float:y, Float:z);
Description: Send a auto message from a player in a specified point to everyone.
Example:
PHP Code:
    SendPlayerMessageInPointToAll(playerid"Hello, I'm in 0.0, 0.0, 0.0 Coordinates!"50.00.00.0);
    
//Put this somewhere in a command 
I found it useful so I added it.

Settings
PHP Code:
#define RandColor // Comment This line if you want to disable the random colors.
#define FloodProtection 1 //Set it to 0 if you want to disable the anti Flood.
#define MAX_CHAT_LENGHT 128 //Max chat lenght that will appear (More words won't be seen) 
Example (Simple, Not Including All Finctions!)
PHP Code:
#include <a_samp>
#include <AdvancedChat>
#include <zcmd>

public OnGameModeInit()
{
    
ToggleChat(true); // This will allow players to chat, set it to false if you
    //don't want to use chat.
    
    
ToggleChatID(true); // This will allow players to chat with their ID beside
    //their name.
    
return 1;
}

CMD:muteme(playeridparams[])
{
    
TogglePlayerChat(playeridfalse); // Now the player won't be able to chat.
    
return 1;
}

CMD:unmuteme(playeridparams[])
{
    
TogglePlayerChat(playeridtrue); // Now the player will be able to chat.
    
return 1;

Pastebin Link
http://pastebin.com/13sHNQc7


This is a BETA version, if you found any bugs feel free to PM me or post it in here!
__________________

Last edited by illuminati2; 23/02/2016 at 09:59 AM.
illuminati2 is offline   Reply With Quote
Old 21/02/2016, 02:34 PM   #2
RogerCosta
Huge Clucker
 
RogerCosta's Avatar
 
Join Date: Aug 2014
Location: Santos, Brazil.
Posts: 315
Reputation: 92
Default Re: (AdvancedChat.inc) - Fully Controllable Chat

Use loop in ClearChat, more efficient, in you code, you used 10 SendClientMessageToAll... not clear total chat. Like this:

pawn Code:
stock ClearChat()
{
    for(new i = 0; i <= 50; i++)
        SendClientMessageToAll(0xFFFFFFFF, "");
}

And, attention to if and else if. You used if & if in boolean condition, use if and else if, is more efficient.
RogerCosta is online now   Reply With Quote
Old 21/02/2016, 02:51 PM   #3
illuminati2
Big Clucker
 
Join Date: Feb 2016
Posts: 77
Reputation: 21
Default Re: (AdvancedChat.inc) - Fully Controllable Chat

Quote:
Originally Posted by RogerCosta View Post
Use loop in ClearChat, more efficient, in you code, you used 10 SendClientMessageToAll... not clear total chat. Like this:

pawn Code:
stock ClearChat()
{
    for(new i = 0; i <= 50; i++)
        SendClientMessageToAll(0xFFFFFFFF, "");
}

And, attention to if and else if. You used if & if in boolean condition, use if and else if, is more efficient.
Was sleepy that time I was coding it , thanks for pointing them out, updated!

+REP
__________________
illuminati2 is offline   Reply With Quote
Old 21/02/2016, 02:55 PM   #4
DevinPatino
Big Clucker
 
DevinPatino's Avatar
 
Join Date: Dec 2013
Location: Compton
Posts: 79
Reputation: 1
Default Re: (AdvancedChat.inc) - Fully Controllable Chat

I suppose this could be useful great job
__________________
Herro
DevinPatino is offline   Reply With Quote
Old 23/02/2016, 09:42 AM   #5
vannesenn
Gangsta
 
vannesenn's Avatar
 
Join Date: Feb 2011
Posts: 658
Reputation: 15
Default Re: (AdvancedChat.inc) - Fully Controllable Chat

Something to note, distance must be float, not int!

SendPlayerMessageInPointToAll(playerid, msg[], Float:distance, Float, Float:y, Float:z);
vannesenn is offline   Reply With Quote
Old 23/02/2016, 10:00 AM   #6
illuminati2
Big Clucker
 
Join Date: Feb 2016
Posts: 77
Reputation: 21
Default Re: (AdvancedChat.inc) - Fully Controllable Chat

Quote:
Originally Posted by vannesenn View Post
Something to note, distance must be float, not int!

SendPlayerMessageInPointToAll(playerid, msg[], Float:distance, Float, Float:y, Float:z);
Thanks. It is anyways :P
__________________
illuminati2 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Plugin] FCNPC - Fully Controllable NPC sa-mp 0.3x R2 [LCK]Chris Plugin Development 82 16/05/2014 03:16 PM
Need help.... Mask system not working fully (shows to names on chat). Scrillex Scripting Help 10 15/03/2013 10:48 AM
[?]New SZR fully controllable NOS system Qeux Help Archive 3 17/03/2011 03:24 AM
Controllable NPC Hen_Kok Русский/Russian 11 03/10/2010 06:56 AM


All times are GMT. The time now is 06:18 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.