Raised This Month: $ Target: $400
 0% 

admin connect "customizing"


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Spiky Pirate
Senior Member
Join Date: Oct 2006
Old 02-18-2007 , 18:51   admin connect "customizing"
Reply With Quote #1

I got this plugin/script from 3rd plugin forums, but the creator of the script is gone so i was wondering if any of you guys can figure this out.

Code:
#include <amxmodx>
#include <amxmisc>
#include <geoip>
public plugin_init() {
 register_plugin("Admin Connect Sound","1.4","flintst0nes.de.vu")
 register_cvar("amx_acs_addgeo","0",0)
 return PLUGIN_CONTINUE
}
public plugin_precache() {
 new soundstring[128]
 new soundfile[128]
 new line
 new txtlen
 new admin_steam_id[34]
 new soundpath[128]
 new temp[5]
 new cfgdir[128]
 new cfgpath[136]
 get_configsdir ( cfgdir, 128 )
 format(cfgpath, 128, "%s/acs.cfg", cfgdir)
    if(file_exists(cfgpath)){
      while(((line=read_file(cfgpath,line,soundstring,140,txtlen))!=0)){
         strtok(soundfile, admin_steam_id, 34, soundstring, 128, '=')
         trim (admin_steam_id)
         trim (soundstring)
   strtok(soundstring, temp, 10, soundpath, 118, ':')
          if(containi(soundpath,".wav") != -1){
            if (file_exists (soundpath)){
             precache_sound(soundpath)
            }
          }else if(containi(soundpath,".mp3") != -1){
            if (file_exists (soundpath)){
             precache_generic(soundpath)
            }
          }
      }
 }else{
  write_file(cfgpath,"#ALL=misc/cl_adminjoin.wav\n#ADMINJOINMSG=Admin %s has joined the server\n#ADMINPARTMSG=Admin %s has left the server\n #USERJOINMSG=User %s has joined the server\n#USERPARTMSG=User %s has left the server\n",-1)
 }
}
//
// plays a sound by given path
//
public playSoundfile(soundfile[]){
    new players[32]
    new player,num,i
 get_players(players,num,"c")
 for(i=0;i<num;i++){
     player = players[i]
        if(containi(soundfile,".wav") != -1){
            client_cmd(player, "play ^"%s^"", soundfile)
        }else if(containi(soundfile,".mp3") != -1){
            client_cmd(i, "mp3 play ^"%s^"", soundfile)
        }
    }
}
//
// client join event
//
public client_putinserver(id){
 // cfg file handling
 new line, txtlen, cfgline[128], cfgcontent[128], soundpath[128]
 // user handling
 new szName[32], authid[34], admin_steam_id[34]
 // messagestring
 new szMsg[169]
 // config variables
 new ADMINJOINSOUND[128], ADMINJOINMSG[128], USERJOINSOUND[128], USERJOINMSG[128]
 new STEAMJOINSOUND[128], STEAMJOINMSG[128], DIRECTOR[10], isAdmin = 0
 // geoip data
    new userip[16], usercountry[45]
 // get user data
 get_user_name(id, szName, 31)
 get_user_authid (id, authid, 34)
 if(is_user_admin(id)){
  isAdmin = 1
 }
 get_user_ip ( id, userip, 16, 1 )
 geoip_country ( userip, usercountry, 45 )
 // configdir
 new cfgdir[128]
 new cfgpath[136]
 get_configsdir ( cfgdir, 128 )
 format(cfgpath, 128, "%s/acs.cfg", cfgdir)
    if(file_exists(cfgpath)){
      while(((line=read_file(cfgpath,line,cfgline,140,txtlen))!=0)){
         strtok(cfgline, admin_steam_id, 34, cfgcontent, 128, '=')
         trim (admin_steam_id)
         trim (cfgcontent)
         if(equal(admin_steam_id,"#ADMINJOINSOUND")){
            ADMINJOINSOUND = cfgcontent
         }
         if(equal(admin_steam_id,"#ADMINJOINMSG")){
            ADMINJOINMSG = cfgcontent
         }
         if(equal(admin_steam_id,"#USERJOINSOUND")){
            USERJOINSOUND = cfgcontent
         }
         if(equal(admin_steam_id,"#USERJOINMSG")){
            USERJOINMSG = cfgcontent
         }
    if(equal(authid, admin_steam_id)){
      strtok(cfgcontent, DIRECTOR, 10, soundpath, 118, ':')
             if(equal(DIRECTOR,"JOINSOUND")){
                STEAMJOINSOUND = soundpath
             }
             if(equal(DIRECTOR,"JOINMSG")){
                STEAMJOINMSG = soundpath
             }
         }
   }
   }
   // check data for sounds
   if(!equal(STEAMJOINSOUND, "")){
      playSoundfile(STEAMJOINSOUND)
   }else{
     if( (!equal(ADMINJOINSOUND, "")) && (isAdmin) ){
      playSoundfile(ADMINJOINSOUND)
     }else if (!equal(USERJOINSOUND, "")){
      playSoundfile(USERJOINSOUND)
     }
   }
   // check data for msgs
   if(!equal(STEAMJOINMSG, "")){
     format(szMsg, 169, STEAMJOINMSG, szName)
     szMsg = addGEOIP(szMsg, usercountry)
     sendChatMessage(0, szMsg, 1)
   }else{
     if( (!equal(ADMINJOINMSG, "")) && (isAdmin) ){
      format(szMsg, 169, ADMINJOINMSG, szName)
      szMsg = addGEOIP(szMsg, usercountry)
      sendChatMessage(0, szMsg, 1)
     }else if( (equal(ADMINJOINMSG, "")) && (isAdmin) ){
      format(szMsg, 169, "Admin %s has joined the server", szName)
      szMsg = addGEOIP(szMsg, usercountry)
      sendChatMessage(0, szMsg, 1)
     }else if (!equal(USERJOINMSG, "")){
      format(szMsg, 169, USERJOINMSG, szName)
      szMsg = addGEOIP(szMsg, usercountry)
      sendChatMessage(0, szMsg,0)
     }else{
      format(szMsg, 169, "%s has joined the server", szName)
      szMsg = addGEOIP(szMsg, usercountry)
      sendChatMessage(0, szMsg,0)
     }
   }
}
//
// client leave event
//
public client_disconnect(id){
 // cfg file handling
 new line, txtlen, cfgline[128], cfgcontent[128], soundpath[128]
 // user handling
 new szName[32], authid[34], admin_steam_id[34]
 // messagestring
 new szMsg[128]
 // config variables
 new ADMINPARTSOUND[128], ADMINPARTMSG[128], USERPARTSOUND[128], USERPARTMSG[128]
 new STEAMPARTSOUND[128], STEAMPARTMSG[128], DIRECTOR[10], isAdmin = 0
 // get user data
 get_user_name(id, szName, 31)
 get_user_authid (id, authid, 34)
 if(is_user_admin(id)){
  isAdmin = 1
 }
 // configdir
 new cfgdir[128]
 new cfgpath[136]
 get_configsdir ( cfgdir, 128 )
 format(cfgpath, 128, "%s/acs.cfg", cfgdir)
    if(file_exists(cfgpath)){
      while(((line=read_file(cfgpath,line,cfgline,140,txtlen))!=0)){
         strtok(cfgline, admin_steam_id, 34, cfgcontent, 128, '=')
         trim (admin_steam_id)
         trim (cfgcontent)
         if(equal(admin_steam_id,"#ADMINPARTSOUND")){
            ADMINPARTSOUND = cfgcontent
         }
         if(equal(admin_steam_id,"#ADMINPARTMSG")){
            ADMINPARTMSG = cfgcontent
         }
         if(equal(admin_steam_id,"#USERPARTSOUND")){
            USERPARTSOUND = cfgcontent
         }
         if(equal(admin_steam_id,"#USERPARTMSG")){
            USERPARTMSG = cfgcontent
         }
    if(equal(authid, admin_steam_id)){
      strtok(cfgcontent, DIRECTOR, 10, soundpath, 118, ':')
             if(equal(DIRECTOR,"PARTSOUND")){
                STEAMPARTSOUND = soundpath
             }
             if(equal(DIRECTOR,"PARTMSG")){
                STEAMPARTMSG = soundpath
             }
         }
   }
   }
   // check data for sounds
   if(!equal(STEAMPARTSOUND, "")){
      playSoundfile(STEAMPARTSOUND)
   }else{
     if( (!equal(ADMINPARTSOUND, "")) && (isAdmin) ){
      playSoundfile(ADMINPARTSOUND)
     }else if (!equal(USERPARTSOUND, "")){
      playSoundfile(USERPARTSOUND)
     }
   }
   // check data for msgs
   if(!equal(STEAMPARTMSG, "")){
     format(szMsg, 128, STEAMPARTMSG, szName)
     sendChatMessage(0, szMsg, 0)
   }else{
     if( (!equal(ADMINPARTMSG, "")) && (isAdmin) ){
      format(szMsg, 128, ADMINPARTMSG, szName)
      sendChatMessage(0, szMsg, 0)
     }else if( (equal(ADMINPARTMSG, "")) && (isAdmin) ){
      format(szMsg, 128, "Admin %s has left the server", szName)
      sendChatMessage(0, szMsg, 0)
     }else if (!equal(USERPARTMSG, "")){
      format(szMsg, 128, USERPARTMSG, szName)
      sendChatMessage(0, szMsg,0)
     }else{
      format(szMsg, 128, "%s has left the server", szName)
      sendChatMessage(0, szMsg,0)
     }
   }
}
//
// public chat msg
//
public sendChatMessage(id, szArgs[], green)
 {
 new szMsg[128]
 if(green == 1){
  format(szMsg,127,"^x04%s",szArgs)
 }else{
  format(szMsg,127,"%s",szArgs)
 }
 if (id == 0){
  new Players[32],Num
  get_players(Players,Num)
  for (new i = 0; i < Num; i++){
   message_begin(MSG_ONE,get_user_msgid("SayText"),{0,0,0},Players[i])
   write_byte(Players[i])
   write_string(szMsg)
   message_end()
  }
 }else{
  message_begin(MSG_ONE, get_user_msgid("SayText"), {0, 0, 0}, id)
  write_byte(id)
  write_string(szMsg)
  message_end()
 }
}
public addGEOIP(msg[], country[]){
 new newMsg[169]
 if(get_cvar_num("amx_acs_addgeo")){
  format(newMsg,169,"%s (%s)",msg,country)
 }else{
  format(newMsg,169,"%s",msg)
 }
 return newMsg
}
It displays a message when users join my server, for example, "John has joined the server(United States)" and also "John has left the building(United States)"

I don't want it to display joining & leaving messages for regular players. I want it to display only for headleaders(me and my friend.)

So anyone can disable the message that shows up when regular users join/leave the server?

Thank you
Spiky Pirate is offline
 



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 00:43.


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