AlliedModders

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

[ --<-@ ] Black Rose 03-03-2006 18:32

message help
 
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 :D

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") }

wouter 03-03-2006 18:36

whats wrong with adminlisten?
coz my server is latstes time crashing a lot now you mention it, cince i have adminlisten plugin... :(

[ --<-@ ] Black Rose 03-03-2006 18:45

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?

VEN 03-04-2006 03:30

You forgot if team == 3 (Spectator)
Try change write_string(name) to write_string("")

wouter 03-04-2006 03:34

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.

VEN 03-04-2006 03:36

Quote:

Originally Posted by wouter
whats wrong with adminlisten?

Last time i checked thread there was an array index out of bounds bug.

wouter 03-04-2006 03:48

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 :)

[ --<-@ ] Black Rose 03-04-2006 09:00

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 03-04-2006 09:29

it works PERFECTLY, thank you VEN!!

VEN 03-05-2006 03:48

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.


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

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