Raised This Month: $ Target: $400
 0% 

message help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 03-03-2006 , 18:32   message help
Reply With Quote #1

ok i need some help with this... i wanted it to show as it was real chat and not like client_print but i messed it up... i guess i have to use the same event as adminlisten is using but i hopefully dont need that so thats why im asking you guys for help

Code:
#include <amxmodx> #include <amxmisc> psycholisten_mode() {     new mode[4]     get_cvar_string("pd_listen_mode", mode, 3)     return read_flags(mode) } public func(id) { // yes, this is catching say.     new mode = psycholisten_mode()     if (! mode) {         // completely disabled         return PLUGIN_CONTINUE     }         new is_alive = is_user_alive(id)     new team = get_user_team(id)         new command[17]     read_argv(0, command, 16)         new is_team_msg = ! equal(command, "say")         new player_count = get_playersnum()     new players[32]         get_players(players, player_count, "c")         new message2[129]     read_argv(1, message2, 128)         new name[33]     get_user_name(id, name, 32)                 // problem somewhere here     new channel[64]     if ( is_team_msg ) {         if ( team == 0 ) channel = "#Cstrike_Chat_Spec"         else if ( team == 1 ) channel = "#Cstrike_Chat_T"         else if ( team == 2 ) channel = "#Cstrike_Chat_CT"     }         else {         if ( is_user_alive(id) ) channel = "#Cstrike_Chat_All"         else channel = "#Cstrike_Chat_AllSpec"     }     // to here                 for (new i = 0; i < player_count; i++) {         if ( !is_user_bot(i) ) {             if ( ( mode & 2 ) && ! is_user_alive(players[i]) && is_alive && (! is_team_msg || team == get_user_team(players[i]) ) ) {                                                                 // problem somewhere here                 message_begin(MSG_ONE, get_user_msgid("SayText"),{0,0,0},players[i])                 write_byte(id)                 write_string(channel)                 write_string(name)                 write_string(message2)                 message_end()                 // to here                                                             }                         else if ( ( mode & 1 ) && ( get_user_flags(players[i] ) & ADMIN_LEVEL_B ) ) {                 if ( ( is_user_alive(players[i]) && ! is_alive ) || (is_team_msg && team != get_user_team(players[i]))) {                                                                                 // problem somewhere here                     message_begin(MSG_ONE, get_user_msgid("SayText"),{0,0,0},players[i])                     write_byte(id)                     write_string(channel)                     write_string(name)                     write_string(message2)                     message_end()                     // to here                                                                             }             }         }     }     return PLUGIN_CONTINUE } public plugin_init() {     register_plugin("..." , "...", "...")         register_clcmd("say", "handle_say")     register_clcmd("say_team", "handle_say")     register_cvar("pd_listen_mode", "ab") }
[ --<-@ ] Black Rose is offline
wouter
Senior Member
Join Date: Feb 2005
Location: Belgium
Old 03-03-2006 , 18:36  
Reply With Quote #2

whats wrong with adminlisten?
coz my server is latstes time crashing a lot now you mention it, cince i have adminlisten plugin...
wouter is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 03-03-2006 , 18:45  
Reply With Quote #3

i dunno whats wrong with it... never used it

does adminlisten shows:
ALL dead players what an alive player wrote and vice versa for admins?
team msgs?
[ --<-@ ] Black Rose is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 03-04-2006 , 03:30  
Reply With Quote #4

You forgot if team == 3 (Spectator)
Try change write_string(name) to write_string("")
VEN is offline
wouter
Senior Member
Join Date: Feb 2005
Location: Belgium
Old 03-04-2006 , 03:34  
Reply With Quote #5

Quote:
Originally Posted by [ --<-@
Black Rose]i dunno whats wrong with it... never used it

does adminlisten shows:
ALL dead players what an alive player wrote and vice versa for admins?
team msgs?
yes as an admin you can see it all. dead (spectator) , alive, team_messgaes.
wouter is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 03-04-2006 , 03:36  
Reply With Quote #6

Quote:
Originally Posted by wouter
whats wrong with adminlisten?
Last time i checked thread there was an array index out of bounds bug.
VEN is offline
wouter
Senior Member
Join Date: Feb 2005
Location: Belgium
Old 03-04-2006 , 03:48  
Reply With Quote #7

Quote:
Originally Posted by VEN
Quote:
Originally Posted by wouter
whats wrong with adminlisten?
Last time i checked thread there was an array index out of bounds bug.
okidoki
wouter is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 03-04-2006 , 09:00  
Reply With Quote #8

Quote:
Originally Posted by VEN
You forgot if team == 3 (Spectator)
Try change write_string(name) to write_string("")
i used something to print out what team i was and when i was spec it printed out 0
but will try it
[ --<-@ ] Black Rose is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 03-04-2006 , 09:29  
Reply With Quote #9

it works PERFECTLY, thank you VEN!!
[ --<-@ ] Black Rose is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 03-05-2006 , 03:48  
Reply With Quote #10

Just a note:

get_user_team sometimes returns old team id
For example on CT<-->T or Spectator join (usually only if playe isn't alive).
So i recommend use get_user_team(id, teamname, len) method especially for those who not familiar with such mannerism.

And even more better way cs_get_user_team but it requires cstrike module.
VEN is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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