Raised This Month: $ Target: $400
 0% 

admin connect "customizing"


Post New Thread Reply   
 
Thread Tools Display Modes
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
Voi
Veteran Member
Join Date: Sep 2006
Location: Gdansk, Poland
Old 02-18-2007 , 19:01   Re: admin connect "customizing"
Reply With Quote #2

if(is_user_admin(id))

?
__________________
Voi is offline
Spiky Pirate
Senior Member
Join Date: Oct 2006
Old 02-18-2007 , 19:16   Re: admin connect "customizing"
Reply With Quote #3

huh?
Spiky Pirate is offline
GraffityMaster
Member
Join Date: Jan 2007
Old 02-19-2007 , 09:12   Re: admin connect "customizing"
Reply With Quote #4

Is this what you want (check attach.)?

If it dosent work...post here...I havent tested it
Attached Files
File Type: sma Get Plugin or Get Source (amx_adminconnect.sma - 914 views - 7.6 KB)
__________________
GraffityMaster is offline
Spiky Pirate
Senior Member
Join Date: Oct 2006
Old 02-19-2007 , 15:46   Re: admin connect "customizing"
Reply With Quote #5

Sort of..

It doesnt display the messages when regular players join/leave the server, so that's good.

The joining message(when i join the server), the color of the message is green. But the message that shows up when i leave is the default color.. so I was wondering if you could change the leaving message to green just like joining message

I am curious how this works because I dont want all of my server admins to have this feature... I want this to be used for only me and my friend.

Thanks for the quick work however!
I really appreciate it, and i will be waiting for new edittion

p.s. for the original plugin, here it is(just in case you need it): http://forums.alliedmods.net/showthread.php?p=359316
Spiky Pirate is offline
Da_sk8rboy
Veteran Member
Join Date: Jul 2006
Old 02-19-2007 , 16:36   Re: admin connect "customizing"
Reply With Quote #6

when you post in small tags
__________________
i stop around here and there.
Da_sk8rboy is offline
Spiky Pirate
Senior Member
Join Date: Oct 2006
Old 02-19-2007 , 18:22   Re: admin connect "customizing"
Reply With Quote #7

sorry?
Spiky Pirate is offline
Spiky Pirate
Senior Member
Join Date: Oct 2006
Old 02-20-2007 , 18:38   Re: admin connect "customizing"
Reply With Quote #8

so, graffity, can you edit it once again?
Spiky Pirate is offline
Spiky Pirate
Senior Member
Join Date: Oct 2006
Old 02-28-2007 , 15:52   Re: admin connect "customizing"
Reply With Quote #9

or anyone else????
Spiky Pirate 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 00:43.


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