Raised This Month: $ Target: $400
 0% 

Editing Maxim's admin_listen


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
carmstrong
New Member
Join Date: Mar 2004
Location: Pittsburgh, PA, USA
Old 04-23-2004 , 15:03   Editing Maxim's admin_listen
Reply With Quote #1

Hello everyone! I'm trying to edit Maxim's admin_listen plugin so that it will only occur if the admin is on the spectator team. I have pasted the original code from Maxim's plugin and then my code below. My code compiles fine, but it has a bad start. Thanks everyone! Appreciate the input.

Code:
#include <amxmodx> #include <engine> new count[32][32]     //Counter for the SayText event. new g_voice_status[2] public catch_say(id){    new reciever = read_data(0) //Reads the ID of the message recipient    new sender = read_data(1)   //Reads the ID of the sender of the message    new message[151]            //Variable for the message    read_data(2,message,150)    //Reads the message from the SayText event IE: "(DEAD)(TEAM) Maxim|PSK: i'm dead"    //With the SayText event, the message is sent to the person who sent it last.    //It's sent to everyone else before the sender recieves it.    count[sender][reciever] = 1          //Keeps count of who recieved the message    if (sender == reciever){      //If current SayText message is the last then...       new player_count = get_playersnum()  //Gets the number of players on the server       new players[32] //Player IDs       get_players(players, player_count, "c")       for (new i = 0; i < player_count; i++) {          if (get_user_flags(players[i]) & ADMIN_LEVEL_B){     //If the player is an admin then...             if (count[sender][players[i]] != 1){              //If the player did not recieve the message then...                message_begin(MSG_ONE, get_user_msgid("SayText"),{0,0,0},players[i])                //Appends the ID of the sender to the message, so the engine knows what color to make the name.                write_byte(sender)                //Appends the message to the message.                write_string(message)                message_end()             }          }          count[sender][players[i]] = 0  //Set everyone's counter to 0 so it's ready for the next SayText       }    }    return PLUGIN_CONTINUE } public plugin_init(){    register_plugin("AdminListen","2.1x","xmdxtremekiller")    register_srvcmd("amx_adminlisten_voice","voice_status")    register_event("SayText","catch_say","b")    return PLUGIN_CONTINUE } // ********************* // VoiceComm Stuff // ********************* public client_infochanged(id) {    if ((get_user_flags(id) & ADMIN_LEVEL_B) && equal(g_voice_status,"1")) set_speak(id, 4) } public client_connect(id) {    if ((get_user_flags(id) & ADMIN_LEVEL_B) && equal(g_voice_status,"1")) set_speak(id, 4) } public voice_status(){    read_argv(1,g_voice_status,1)    new player_count = get_playersnum()    new players[32] //Player IDs    get_players(players, player_count, "c")    for (new i = 0; i < player_count; i++) {       if ((get_user_flags(players[i]) & ADMIN_LEVEL_B)){                  if (equal(g_voice_status,"0")) set_speak(players[i], 0)          if (equal(g_voice_status,"1")) set_speak(players[i], 4)       }    } }


Code:
//my changes -- compiles but bad load public catch_say(id){    new reciever = read_data(0) //Reads the ID of the message recipient    new sender = read_data(1)   //Reads the ID of the sender of the message    new message[151]            //Variable for the message    read_data(2,message,150)    //Reads the message from the SayText event IE: "(DEAD)(TEAM) Maxim|PSK: i'm dead"    //With the SayText event, the message is sent to the person who sent it last.    //It's sent to everyone else before the sender recieves it.    count[sender][reciever] = 1          //Keeps count of who recieved the message    if (sender == reciever){      //If current SayText message is the last then...       new player_count = get_playersnum()  //Gets the number of players on the server       new players[32] //Player IDs       get_players(players, player_count, "c")       for (new i = 0; i < player_count; i++) {          if (get_user_flags(players[i]) & ADMIN_LEVEL_B){      //If the player is an admin then...            if (get_user_team(id)==6){                  //If the admin is a spectator          if (count[sender][players[i]] != 1){              //If the player did not recieve the message then...                message_begin(MSG_ONE, get_user_msgid("SayText"),{0,0,0},players[i])                //Appends the ID of the sender to the message, so the engine knows what color to make the name.                write_byte(sender)                //Appends the message to the message.                write_string(message)                message_end()              }            }      }          count[sender][players[i]] = 0  //Set everyone's counter to 0 so it's ready for the next SayText       }    }    return PLUGIN_CONTINUE }
__________________
Invictus maneo
carmstrong is offline
Send a message via ICQ to carmstrong Send a message via AIM to carmstrong Send a message via MSN to carmstrong Send a message via Yahoo to carmstrong
GanJa
Member
Join Date: Mar 2004
Location: Salem, OR
Old 04-23-2004 , 16:08  
Reply With Quote #2

slight prob with this, most mods no longer use numbers for teams, in fact about the only mod I know of that is main stream is TFC.
Now you would have to do this mod based of course but use this code:
Code:
      new team[32]       get_user_team(id,team,31)       //TFC support =)       new theteam=get_user_team(id)       if(equali(team,"spectator") || equali(team,"spectatorteam") || (theteam==6)){             //your stuff here       }
I did equali so that you can cut some code out and possibly support more mods since some mods may use the same team name =)
Here is a list of some of the teams for some mods:
  • //ns
    undefinedteam
    spectatorteam
    alien1team
    marine1team

    //cs
    SPECTATOR
    UNASSIGNED
    CT
    TERRORIST

    //dod
    spectator
    axis
    allies
Note: I could be totally off on this since I'm just now moving into amxmodx. This is all based off of amx.
GanJa is offline
carmstrong
New Member
Join Date: Mar 2004
Location: Pittsburgh, PA, USA
Old 04-24-2004 , 23:15  
Reply With Quote #3

I changed the team ID of "6" to "SPECTATOR" and recieved the following error messages while compiling with compile.bat that comes with AMXModX:

amx_listen.sma(43) : error 017: undefined symbol "SPECTATOR"
amx_listen.sma(73) : error 017: undefined symbol "set_speak"
amx_listen.sma(78) : error 017: undefined symbol "set_speak"
amx_listen.sma(88) : error 017: undefined symbol "set_speak"
amx_listen.sma(89) : error 017: undefined symbol "set_speak"
__________________
Invictus maneo
carmstrong is offline
Send a message via ICQ to carmstrong Send a message via AIM to carmstrong Send a message via MSN to carmstrong Send a message via Yahoo to carmstrong
GanJa
Member
Join Date: Mar 2004
Location: Salem, OR
Old 04-25-2004 , 14:03  
Reply With Quote #4

what is your code? Below is a snippet of some of my code:
Code:
if(equal(modname,"cstrike")){     new zteam[32]     get_user_team(id,zteam,31)     if(equal(zteam,"UNASSIGNED") && equal(command,"cx_autoassign")){         engclient_cmd(players[a], "jointeam","5")     }     if(equal(zteam,"SPECTATOR") && equal(command,"cx_autoassign")){         engclient_cmd(players[a], "jointeam","5")     } }
GanJa is offline
Reply


Thread Tools
Display Modes

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 16:01.


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