AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   print_center help (https://forums.alliedmods.net/showthread.php?t=99429)

Costin83 08-05-2009 06:46

print_center help
 
HTML Code:

#include <amxmodx>
#include <amxmisc>
#define PLUGIN "Messag3"
#define VERSION "0.1"
#define AUTHOR "80T"
 
public plugin_init()
{
 register_plugin(PLUGIN, VERSION, AUTHOR)
 register_event("ResetHUD", "event_spawn", "b")
}
public event_spawn(id)
{
 client_print(id, print_center, "M^ne^ns^ns^na^ng^n3")
 return PLUGIN_CONTINUE
}
 

I don't know what is wrong in this code but I can't get a "print_center" message to be displayed VERTICAL

I just want to make a verry simple plugin that will display a vertical center message to every player when he spawns... :|

ConnorMcLeod 08-05-2009 07:17

Re: print_center help
 
PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#define VERSION "0.0.1"

public plugin_init()
{
    
register_plugin("Spawn Message"VERSION"ConnorMcLeod")

    
RegisterHam(Ham_Spawn"player""Player_Spawn_Post"1)
}

public 
Player_Spawn_Postid )
{
    if( 
is_user_alive(id) )
    {
        
client_print_center(id"^nM^ne^ns^ns^na^ng^n3")
    }
}

client_print_center(idmsg[], any:...)
{
    static 
szMsg[128]
    
vformat(szMsgcharsmax(szMsg), msg3)
    
engfunc(EngFunc_ClientPrintfid1szMsg)



hleV 08-05-2009 09:30

Re: print_center help
 
Code:
engclient_print(id, engprint_center, "M^ne^ns^ns^na^ng^n3");

Costin83 08-05-2009 10:50

Re: print_center help
 
Wow! Those was prety fast replyes.

Thank you both :mrgreen:

+K

Annyways.... I don't see the HAM_GivePlayerBeer function...

Exolent[jNr] 08-05-2009 14:35

Re: print_center help
 
Quote:

Originally Posted by ConnorMcLeod (Post 890709)
Code:
#include <amxmodx> #include <fakemeta> #include <hamsandwich> #define VERSION "0.0.1" public plugin_init() {     register_plugin("Spawn Message", VERSION, "ConnorMcLeod")     RegisterHam(Ham_Spawn, "player", "Player_Spawn_Post", 1) } public Player_Spawn_Post( id ) {     if( is_user_alive(id) )     {         client_print_center(id, "^nM^ne^ns^ns^na^ng^n3")     } } client_print_center(id, msg[], any:...) {     static szMsg[128]     vformat(szMsg, charsmax(szMsg), msg, 3)     engfunc(EngFunc_ClientPrintf, id, 1, szMsg) }

Small bug.

ConnorMcLeod 08-05-2009 14:42

Re: print_center help
 
Ops, fixed.

Costin83 08-05-2009 15:03

Re: print_center help
 
Quote:

Originally Posted by Exolent[jNr] (Post 890958)
Small bug.

What was the difference ?
Why was it necessary to be an "^n" in front ?

Exolent[jNr] 08-05-2009 15:08

Re: print_center help
 
Quote:

Originally Posted by Costin83 (Post 890985)
What was the difference ?
Why was it necessary to be an "^n" in front ?

He used the function with an invalid argument.
It was something like:
PHP Code:

client_print_center(idprint_center"message....")
// where it should be
client_print_center(id"message...."


ConnorMcLeod 08-05-2009 15:09

Re: print_center help
 
Quote:

Originally Posted by Costin83 (Post 890985)
Why was it necessary to be an "^n" in front ?

That one let the game display its own centered messages.

Costin83 08-06-2009 15:40

Re: print_center help
 
Ok so now I understand thanks for explanations.


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

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