[Include] Message3.inc (prevent chat spam and keep chat clean)
#1

This include was created to help people keep their chat box on the server clean and only for chat. i have made all other messages that are not to do with players chatting to other players into textdraws so the chat is only for chat purposes, with the include you can send Usage, Error, Info, Adverts and Admin messages. Everyone has there own way they play so i added so each player can position their own messages to their own desire.

At the top of your code use #include <message3>

Features:
  • Creates an indiviual textdraw for cetian messages
  • prevents chat spam of unwanted messages
Requirements:
  • zcmd.inc // #include this into your gamemode before the Message2.inc (without this the include will not function).
  • sscanf2.inc // #include this into your gamemode before the Message2.inc (without this the include will not function).
  • foreach.inc // #include this into your gamemode before the Message2.inc (without this the include will not function).
  • sscanf.dll/.so // Dont forget to put this in your plugin folder and write on the line "plugins" on your server.cfg.
Message Styles:
Код:
MSG_STYLE_ERROR    1
MSG_STYLE_INFO     2
MSG_STYLE_USAGE    3
MSG_STYLE_ADVERT   4
MSG_STYLE_ADMIN    5
Functions:
pawn Код:
SendServerMessage(playerid, msgstyle, const message[]);
CreateMessageTextDraw(playerid); // Place under OnPlayerConnect(playerid) Otherwise the textdraws will not show
DestroyMessageTextDraw(playerid); // Place Under OnPlayerDisconnect(playerid, reason) Otherwise the textdraws will not show
Commands:
  • /msgpos - Usage /msgpos [Custom X] [Custom Y].
  • /defaultmsg
Example:
pawn Код:
CMD:goto(playerid, params[])
{
    new pID,Float:Pos[3], string[50];
    if(pInfo[playerid][Adminlvl] < 3) return SendServerMessage(playerid, MSG_STYLE_ERROR ,"You are not high enough admin level!");  // New Code!!
    if(sscanf(params, "u", pID)) return SendServerMessage(playerid, MSG_STYLE_USAGE,"Usage: /goto [ID]");  // New Code!!
    if(pID == IPI) return SendServerMessage(playerid, MSG_STYLE_ERROR,"Player is not connected!"); // New Code!!
    GetPlayerPos(pID,Pos[0],Pos[1],Pos[2]);
    SetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
    SetPlayerInterior(playerid,GetPlayerInterior(pID));
    format(string,sizeof(string),"Admin %s has teleported to you",GetName(playerid));
    SendServerMessage(playerid, MSG_STYLE_INFO, str);  // New Code!!
    return 1;
}
MSG_STYLE_ADMIN Example
pawn Код:
CMD:atalk(playerid, params[])
{
    new text[128];
    if(sscanf(params, "s[128]", text)) return SendServerMessage(playerid, MSG_STYLE_USAGE, "/atalk [text]");
    SendServerMessage(playerid, MSG_STYLE_ADMIN, text);
    return 1;
}
ScreenShot:






Please post your views on this include, the good, the bad and Suggestions are all welcomed.

Thanks for taking time to look at my work!
Reply


Messages In This Thread
Message3.inc (prevent chat spam and keep chat clean) - by Jakwob - 06.07.2015, 09:37
Re: Message3.inc (prevent chat spam and keep chat clean) - by simo0000 - 14.07.2015, 15:39
Re: Message3.inc (prevent chat spam and keep chat clean) - by iTakelot - 14.07.2015, 20:05
Re: Message3.inc (prevent chat spam and keep chat clean) - by ExTaZZ69 - 14.07.2015, 21:16
Re: Message3.inc (prevent chat spam and keep chat clean) - by Crayder - 14.07.2015, 21:33
Re: Message3.inc (prevent chat spam and keep chat clean) - by Jakwob - 15.07.2015, 07:17
Re: Message3.inc (prevent chat spam and keep chat clean) - by Crayder - 15.07.2015, 10:04
Re: Message3.inc (prevent chat spam and keep chat clean) - by Jakwob - 15.07.2015, 14:57
Re: Message3.inc (prevent chat spam and keep chat clean) - by AchievementMaster360 - 15.07.2015, 15:34
Re: Message3.inc (prevent chat spam and keep chat clean) - by SickAttack - 15.07.2015, 15:43
Re: Message3.inc (prevent chat spam and keep chat clean) - by BladeFire - 15.07.2015, 15:46
Re: Message3.inc (prevent chat spam and keep chat clean) - by Jakwob - 17.07.2015, 10:16
Re: Message3.inc (prevent chat spam and keep chat clean) - by Juliusz - 17.07.2015, 20:27
Re: Message3.inc (prevent chat spam and keep chat clean) - by LeXuZ - 18.07.2015, 15:19
Re: Message3.inc (prevent chat spam and keep chat clean) - by zT KiNgKoNg - 27.07.2015, 17:05
Re: Message3.inc (prevent chat spam and keep chat clean) - by n0minal - 27.07.2015, 17:29
Re: Message3.inc (prevent chat spam and keep chat clean) - by Jakwob - 08.08.2015, 22:05

Forum Jump:


Users browsing this thread: 2 Guest(s)