[Include] Message
#1

Hey this is my first include, im sorry if anyone thinks this is useless, but i had the idea to prevent the chat in game being spammed by unwanted messages, and usage messages so i made them as a textdraw to show near the map and disappear after 5 seconds.

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

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).
  • 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
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;
}
Download:
Message.inc (solidfiles)
Message.inc (pastebin)

Message2.inc (solidfiles)
Message2.inc (pastebin)

ChangeLog 20/06/2015
  • Rewrote code to make it more user friendly.
  • Removed textdraws that was not needed.
  • Fixed timer bug.
  • Recolored some of the message titles.
  • Removed some timers.
  • Added Message Styles.
  • Removed SendErrorMessage.
  • Removed SendInfoMessage.
  • Removed SendUsageMessage.
  • Added new Function SendServerMessage.
  • Added checks to see if there is already a TD timer running.
  • New command to change the position of the textdraw so its in your ideal place.
  • New default position command to place your textdraw back to the default position.
  • Added checks to the X, Y positions.
ScreenShot:
http://i60.tinypic.com/o8ib60.jpg
http://i62.tinypic.com/2ug2ow9.jpg
http://i59.tinypic.com/2cp9e1e.jpg
http://i61.tinypic.com/ei9yxs.jpg
http://i57.tinypic.com/fz2emp.jpg
http://i62.tinypic.com/6sf0nk.jpg
http://i59.tinypic.com/34rzjax.jpg

Note: All comments are welcomed but please instead of posting bad comments, please tell me how i can improve the preformance.

Thanks for taking time to look at my work!
Reply


Messages In This Thread
Message2.inc (Removes unwanted spam from chat!) - by Jakwob - 16.06.2015, 11:18
Re: Message - by Yashas - 16.06.2015, 14:37
Re: Message - by Jakwob - 16.06.2015, 14:40
Re: Message - by Alex Magaсa - 16.06.2015, 14:41
Re: Message - by Jakwob - 16.06.2015, 14:42
Re: Message - by Kapersky™ - 16.06.2015, 15:19
Re: Message - by Ritzy2K - 16.06.2015, 15:22
Re: Message - by [RO]Five - 16.06.2015, 15:31
Re: Message - by Jakwob - 16.06.2015, 15:34
Re: Message - by Stanford - 16.06.2015, 16:03

Forum Jump:


Users browsing this thread: 1 Guest(s)