AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   client_print at player spawn? (https://forums.alliedmods.net/showthread.php?t=49159)

hlstriker 12-28-2006 21:05

client_print at player spawn?
 
How can I do a client_print each time a player spawns? Please help :)

The Specialist 12-28-2006 21:09

Re: client_print at player spawn?
 
Here :)
Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #define PLUGIN "print spawn" #define VERSION "1.0" #define AUTHOR "The Specialist" #define MAX_PLAYERS  32 new bool:g_restart_attempt[MAX_PLAYERS + 1]; public plugin_init()  {  register_plugin(PLUGIN, VERSION, AUTHOR);  register_event("ResetHUD", "event_hud_reset", "be");  register_clcmd("fullupdate", "clcmd_fullupdate") ;  register_event("TextMsg", "event_restart_attempt", "a", "2=#Game_will_restart_in"); } public clcmd_fullupdate() {  return 1; } public event_restart_attempt() {  new players[32], num;  get_players(players, num, "a");    for (new i; i < num; ++i)  {   g_restart_attempt[players[i]] = true;  } } public event_hud_reset(id) {  if (g_restart_attempt[id])  {   g_restart_attempt[id] = false;   return;  }  event_player_spawn(id) } public event_player_spawn(id) {  client_print(id,print_chat,"Hello Or Whatever");  return 0; }

hlstriker 12-28-2006 21:30

Re: client_print at player spawn?
 
Thanks very much! +karma

hlstriker 12-30-2006 03:46

Re: client_print at player spawn?
 
Uh oh, I found I problem with that. Each time someone types "record <demoname>" in their console, it will display the message. No one is even being spawned? I don't know why it is doing this though.

Does anyone else know why it does this or how to fix it?

Lord_Destros 12-30-2006 04:00

Re: client_print at player spawn?
 
Quote:

Originally Posted by The Specialist (Post 421123)
Here :)
Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #define PLUGIN "print spawn" #define VERSION "1.0" #define AUTHOR "The Specialist" #define MAX_PLAYERS  32 new bool:g_restart_attempt[MAX_PLAYERS + 1]; public plugin_init()  {  register_plugin(PLUGIN, VERSION, AUTHOR);  register_event("ResetHUD", "event_hud_reset", "be");  register_clcmd("fullupdate", "clcmd_fullupdate") ;  register_event("TextMsg", "event_restart_attempt", "a", "2=#Game_will_restart_in"); } public clcmd_fullupdate() {  return 1; } public event_restart_attempt() {  new players[32], num;  get_players(players, num, "a");    for (new i; i < num; ++i)  {   g_restart_attempt[players[i]] = true;  } } public event_hud_reset(id) {  if (g_restart_attempt[id])  {   g_restart_attempt[id] = false;   return;  }  event_player_spawn(id) } public event_player_spawn(id) {  client_print(id,print_chat,"Hello Or Whatever");  return 0; }


???

Why do you register a client command and the event TxtMsg?

You should just need this
Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN "print spawn" #define VERSION "1.0" #define AUTHOR "The Specialist" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_event("ResetHUD", "event_hud_reset", "be") } public event_hud_reset(id) {     client_print(id,print_chat,"Zomg hi %s",get_user_name(id)) }

VEN 12-30-2006 04:03

Re: client_print at player spawn?
 
Lord_Destros: He used a snippet from my tutorial, refer to the "Code Snippets / Tutorials" for details.

Quote:

client_print(id,print_chat,"Zomg hi %s",get_user_name(id))
Actually should be something like that:
Quote:

new name[32]
get_user_name(id, name, 31)
client_print(id,print_chat,"Zomg hi %s",name)
hlstriker: You didn't compiled/installed the above script properly.
Refer to the articles for details:
http://wiki.amxmodx.org/index.php/Co...28AMX_Mod_X%29 - compiling plugins
http://wiki.amxmodx.org/index.php/Co...d_X#Installing - installing plugins

hlstriker 12-30-2006 13:34

Re: client_print at player spawn?
 
Yeah I compiled and installed it correctly, maybe I worded what I said poorly.

The plugin works fine, but I found the message will show not only when you spawn, but ALSO when you type "record <demoname>" in the console. I think when you start recording a demo it resets the hud, which makes the message display when spawned and when you start recording.

My question is how would I block the message from showing when someone types "record <demoname>" in the console. This should ONLY show when a player spawns.

SweatyBanana 12-30-2006 14:11

Re: client_print at player spawn?
 
Look in the client spawn tutorial.. You will find it is easy to hook a players spawn.

Lord_Destros 12-30-2006 14:12

Re: client_print at player spawn?
 
Quote:

Originally Posted by VEN (Post 421715)
Lord_Destros: He used a snippet from my tutorial, refer to the "Code Snippets / Tutorials" for details.


Actually should be something like that:


hlstriker: You didn't compiled/installed the above script properly.
Refer to the articles for details:
http://wiki.amxmodx.org/index.php/Co...28AMX_Mod_X%29 - compiling plugins
http://wiki.amxmodx.org/index.php/Co...d_X#Installing - installing plugins

Meh, my bad yeah. One of the downsides of posting around midnight :lol:.

hlstriker 12-30-2006 14:40

Re: client_print at player spawn?
 
Quote:

Originally Posted by SweatyBanana (Post 421878)
Look in the client spawn tutorial.. You will find it is easy to hook a players spawn.

I've searched around and could not find a spawn tutorial. I found some threads mentioning hooking the spawn function itself, but I don't have a clue how to hook functions. I need to learn that :)


All times are GMT -4. The time now is 22:20.

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