AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Screen origin... (https://forums.alliedmods.net/showthread.php?t=17197)

XunTric 08-27-2005 09:14

Screen origin...
 
I made a forum for my server some days ago, so I made a little plugin which is supposed to write some info in the top right corner of the players screen.
And if they want to remove it they only have to say /remove...

But I need to know what origin to put it to make it show up in the top right corner.
Right now I just took the code from a xp plugin which shows it in the down left corner.

Heres my plugin:
Code:
#include <amxmodx> #include <amxmisc> new bool:g_adversite[33] public plugin_init() {     register_plugin("www.xuntric.tk adversite", "1.0", "XunTric")     register_clcmd("say /remove", "removeadd")     register_clcmd("say_team /remove", "removeadd") } public client_putinserver(id) {     g_adversite[id] = true     set_task(15.0, "hud", id) } public hud(id)     {     new MSG_TEXT     new HUD[51]     format(HUD, 60, "----------------------------^nI only have 3 admins + me^nAnd I need more!!^nJoin xuntric.tk^nAnd be active on the server^nThen you might get admin!!^n----------------------------^nSay /remove to remove this message^n----------------------------")     // ----------------------------     // I only have admins + me     // And I need more!!     // Join xuntric.tk     // And be active on the server     // Then you might get admin!!     // ----------------------------     // Say /remove to remove this message     // ----------------------------     message_begin(MSG_ONE, MSG_TEXT, {0,0,0}, id)     write_byte(0)     write_string(HUD)     message_end()     if(g_adversite[id] == true) {          set_task(15.0, "hud", id)     }     return }     public removeadd(id) {     client_print(id, print_chat, "[Adversite Text Removed]")     g_adversite[id] = false     remove_task(id)     return PLUGIN_HANDLED } public client_disconnect(id) {     g_adversite[id] = false }

Zenith77 08-27-2005 10:54

COORDINATES : (1, 2)


hope that helps :)

XunTric 08-27-2005 11:34

So write_coord(1, 2)?

pdoubleopdawg 08-27-2005 11:37

Code:
#define TE_TEXTMESSAGE      29 // short 1.2.13 x (-1 = center) // short 1.2.13 y (-1 = center) // byte Effect 0 = fade in/fade out // 1 is flickery credits // 2 is write out (training room) // 4 bytes r,g,b,a color1   (text color) // 4 bytes r,g,b,a color2   (effect color) // ushort 8.8 fadein time // ushort 8.8  fadeout time // ushort 8.8 hold time // optional ushort 8.8 fxtime   (time the highlight lags behing the leading text in effect 2) // string text message      (512 chars max sz string)

I recommend you try to send this text message, I believe it supports quite a bit more customizing. (May be wrong)

Otherwise, you might want to try using a HUDMessage (Take a look at my easyinfo plugin, second page, unapproved) I believe EKS made a plugin to give you the coordinates of a HUD message.

XunTric 08-27-2005 11:48

Cool, thanks.
Now I have this, but dont have any idea of how getting it to the other corner. :shock:
Code:
#include <amxmodx> #include <amxmisc> new bool:g_adversite[33] public plugin_init() {     register_plugin("www.xuntric.tk adversite", "1.0", "XunTric")     register_clcmd("say /remove", "removeadd")     register_clcmd("say_team /remove", "removeadd") } public client_putinserver(id) {     g_adversite[id] = true     set_task(15.0, "hud", id) } public hud(id)     {     new message[200]     set_hudmessage(0, 0, 255, 0.01, 0.29, 0, 6.0, 2.0, 0.1, 0.2, 4)     format(message, 199, "----------------------------^nI only have 3 admins + me^nAnd I need more!!^nJoin xuntric.tk^nAnd be active on the server^nThen you might get admin!!^n----------------------------^nTo remove this message:^nsay /remove^n----------------------------")     show_hudmessage(id, message)     if(g_adversite[id] == true) {          set_task(15.0, "hud", id)     }     return }     public removeadd(id) {     client_print(id, print_chat, "[Adversite Text Removed]")     g_adversite[id] = false     remove_task(id)     return PLUGIN_HANDLED } public client_disconnect(id) {     g_adversite[id] = false }

XxAvalanchexX 08-27-2005 15:52

Code:
set_hudmessage(0, 0, 255, 0.0, 1.0, 0, 6.0, 2.0, 0.1, 0.2, 4)

X and Y are 0.0 to 1.0, 0.0 being the left (or top) and 1.0 being the right (or bottom).

XunTric 08-27-2005 16:40

Actually, I liked the position I found in dawg's plugin best, but thanks anyway avalanche :P

Just got another question.
Would it be possible to make the background of the text dark?
Because sometimes its very hard to read.
And I made this cool flash effect so it changes color every second.
So it would look better with dark background.

XxAvalanchexX 08-27-2005 17:20

You can't change the background color of the text, just the color of the letters.

XunTric 08-27-2005 17:31

Yeh but would it some kind of way be possible to make it dark behind the text?
Like just place a big black square behind it lol. :P

XxAvalanchexX 08-27-2005 18:32

You can't draw shapes on a client's screen with AMXx. Just use a more readable text color.


All times are GMT -4. The time now is 14:24.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.