PDA

View Full Version : Ummm client chat


blobby
08-14-2007, 07:19 PM
If i wanted only admins with a certain access flag to see a chat message how would i do that is it like this

client_print(id, print_chat, "MY MESSAGE HERE");

Please help me

Regards

Blobby

FeuerSturm
08-15-2007, 02:52 AM
If i wanted only admins with a certain access flag to see a chat message how would i do that is it like this

client_print(id, print_chat, "MY MESSAGE HERE");

Please help me

Regards

Blobby

You will need to catch all admins first, "id" is just the index of one player,
so we need to send that message to all admins:

new admins[32],players
get_players(admins,players)
for(new i=0; i<players; i++)
{
new id = admins[i]
if(is_user_connected(id) == 1 && get_user_flags(id)&ADMIN_BAN)
{
client_print(id,print_chat,"All Admins with Ban-Access will see this")
}
}

that will go through all players and check if they have "ADMIN_BAN" access,
if that's the case, it will print the message to him/her, if it's not an admin
nothin happens.

Hope that helps!

blobby
08-15-2007, 10:26 AM
Ok ive lost myself now so this is what im trying to code witch did compile until i tried to add a chat message so here is my code

//* Plugin generated by AMXX-Studio *////////////////////////////////////////////////////
///////*make sure you difine your admin level where ADMIN_LEVEL_H is to your settings///
///////////////////////////////////////////////////////////////////////////////////////
#include <amxmodx>
#include <amxmisc>
#include <dodfun>

#define PLUGIN "Shadow Panthers Secret Spectate"
#define VERSION "1.0"
#define AUTHOR "Blobby"

// Define an admin level it is required below (third part)
#define INVISIBILE_ADMIN ADMIN_LEVEL_H

new g_msgPTeam, g_isSwitching[33];

public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR);

g_msgPTeam = get_user_msgid("PTeam");

register_clcmd("mespec", "me_spec", INVISIBILE_ADMIN);
register_clcmd("say /mespec","me_spec", INVISIBILE_ADMIN);
register_message(g_msgPTeam, "block_team_msg");
}

public me_spec(id,level,cid) {
if(!cmd_access(id,level,cid,1))
return PLUGIN_HANDLED;
g_isSwitching[id] = 1;
dod_set_user_team(id, 3, 1);
set_task(0.5, "client_connect", id);
return PLUGIN_HANDLED;
}

public block_team_msg() {
new m_iClient = get_msg_arg_int(1);
if(g_isSwitching[m_iClient])
{
client_print(id, print_chat, "[DOD SECRET SPEC] you are now in spectator mode no one knows you are there :p");
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}

public client_connect(id) {
g_isSwitching[id] = 0;
}


Ok so if you can see where ive put my chat message so what i want the message to do is like the dod_invisibility chat message does is only show that one person the message who carry s out the command can you help

Regards

Blobby

P.S i Know there are a whole bunch of these plugins about but i just wanted to do something easy for my first one XD

FeuerSturm
08-16-2007, 07:25 PM
the message will only be shown to the admin that is using the command,
you just have to change
client_print(id,print_chat,"..........................")
to
client_print(m_iClient,print_chat,".....................")

i have to admit that i don't have much time at the moment, so i
didn't really look through your complete code if it will actually does what
you want it to do.

if it's not working, i'll take a closer look at it at the weekend!

blobby
08-17-2007, 08:38 AM
Woot Woot it compiled buzzin im gonna run this now on my server and see what happens Thankyou so much FeuerSturm

Regards

Blobby

blobby
08-17-2007, 11:11 AM
Ok i change my chat message to the above but it still dosent show and lol also my /mespec command wont work it dosent display it in chat but it dosent send me to specs so wounderd if you would look over my code when you have a bit of free time and maby point out lol where im going wrong

Thanks for you help and regards

Blobby

FeuerSturm
08-18-2007, 03:28 PM
okay, i looked through your code and now i know why your
message isn't printed:

- sending the admin to spectators with "dod_set_user_team" doesn't
generate a server message, so your message-hook will never be called.
You can just add that chatmessage to the "me_spec" unction then.

- if you want it to be a "secret spectate" you should change dod_set_user_team(id, 3, 1); to dod_set_user_team(id, 3, 0); so the scoreboard is NOT updated and the player is still shown on the team he was before.

i removed what is not needed and changed it to display the message.
i changed "dod_set_user_team" to be "secret" as well, take a look at it please:

#include <amxmodx>
#include <amxmisc>
#include <dodfun>

#define PLUGIN "Shadow Panthers Secret Spectate"
#define VERSION "1.0"
#define AUTHOR "Blobby"

// Define an admin level it is required below (third part)
#define INVISIBILE_ADMIN ADMIN_LEVEL_H

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("mespec", "me_spec", INVISIBILE_ADMIN)
register_clcmd("say /mespec","me_spec", INVISIBILE_ADMIN)
}

public me_spec(id,level,cid)
{
if(!cmd_access(id,level,cid,1))
{
return PLUGIN_HANDLED
}
dod_set_user_team(id, 3, 0)
client_print(id, print_chat, "[DOD SECRET SPEC] you are now in spectator mode no one knows you are there :p")
return PLUGIN_HANDLED
}

The problem you now have with your "simple" secret spectator plugin is
that if you get on a team again after spectating the message "*Blobby joined Axis" or "*Blobby joined Allies" will be shown.
you would have to block that message then as you can't use "dod_set_user_team" on spectating players.

You should try it yourself first and let me know if you have any problems, i'll try to help you!

blobby
08-19-2007, 10:42 AM
Thanks m8 i like the way you have tided the code up on your demonstration i think i might begin to lay it out like that as its easier to see what im doing

Regards

JS

blobby
08-19-2007, 10:59 AM
Just a silly question is there any where i can like get a print off or a document of all the dod functions and there out comes because im having to look at other plugins and read what i need to do my functions and things any help on this will be great also i did try the links to the ones wilson has posted in the past but only 2 of them worked :(

Regards

Blobby

diamond-optic
08-19-2007, 12:23 PM
if you look in the amxmodx/scripting/includes/ directory.. those files will show you all the natives and constants and such & such.. and alot of them have little explanations on how to use them and what they do.. might not be exactly what your looking for but they really help (i even look at them alot still lol)

FeuerSturm
08-19-2007, 12:57 PM
the easiest way would be to take a look at:
http://www.amxmodx.org/funcwiki.php

you can browse all modules and functions there! :D

blobby
08-19-2007, 01:12 PM
Thanks Guys i will go look at those now and tell you how i get on

Regards

Blobby