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

Can you add a pastebin link? or create an account in github?

"Server not found"

EDIT:
Thanks

Good
Handy Include for Lazy ones and newbies
Reply
#3

Pastebin like has been added into the main topic. sorry for the inconvenience.
Reply
#4

Simple.! good job ! looks interesting thought.!
Reply
#5

Quote:
Originally Posted by Alex Magaсa
Посмотреть сообщение
Simple.! good job ! looks interesting thought.!
Thanks
Reply
#6

Simple but nice. Appreciated. Thanks for contributing something to community, thanks!
Reply
#7

Thats really nice mate!

I appreciate your took off your time to release something for all of us.


+rep for you
Reply
#8

is like GameTextForPlayer, buy little small thanks
Reply
#9

Quote:
Originally Posted by Kapersky™
Посмотреть сообщение
Simple but nice. Appreciated. Thanks for contributing something to community, thanks!
Quote:
Originally Posted by [ND]xXZeusXx.
Посмотреть сообщение
Thats really nice mate!

I appreciate your took off your time to release something for all of us.


+rep for you
Thanks i appreciate the nice comments you guys. and thanks for the rep, if you want more of my work visit my blogger link in my signature. Thanks again guys.

[QUOTE]is like GameTextForPlayer, buy little small thanks[QUOTE]
No this is all textdraws. Thanks.
Reply
#10

Wouldn't making it in the center is better?
Good job anyway
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)