|
发表于 2003-12-11 16:00:01
|
显示全部楼层
|阅读模式
来自 中国–内蒙古–呼和浩特
Play the piano in any Half-Life mod. Its great for CS in that it gives you something to do to entertain yourself, while you are dead for example. Admin can set player's pianos to broadcast to all players, to the dead plyers only, or just no broadcast to players (default for regular players). The notes of the piano are all mathematically created from a single sound. The range is 5 chromatic octaves. Sorry, the lowest notes are out of tune, a limitation in Half-Life pitch adjustments. There are 4 different piano sounds to choose from.
AMX Code:
/***************************************************************************
* amx_ejl_piano.sma version 1.0 Date: 7/01/2003
* Author: Eric Lidman ejlmozart@hotmail.com
* Alias: Ludwig van Upgrade: http://lidmanmusic.com/cs/plugins.html
*
* Play the piano in any Half-Life mod. Its great for CS in that it gives
* you something to do to entertain yourself, while you are dead for
* example. Admin can set player's pianos to broadcast to all players, to
* the dead plyers only, or just no broadcast to players (default for
* regular players). An admin's default for his own piano is broadcast to
* all. Set your mode to 0 with command below to play only to yourself.
* The notes of the piano are all mathematically created from a single
* sound. The range is 5 chromatic octaves. Sorry, the lowest notes are
* out of tune, a limitation in Half-Life pitch adjustments. There are 4
* different piano sounds to choose from.
*
* ADMIN COMMANDS:
*
* amx_pinao_mode <player> <mode> --Sets a players piano broadcast mode
* to determine who can hear his piano
* 0 = no broadcast
* 1 = only to dead
* 2 = to all players
* amx_piano_mode_all <mode> --same as above command, but sets mode
* for every player on the server
*
* CLIENT COMMANDS:
*
* say /piano --in chat: Get help and info on setting up piano
* amx_set_piano --in console: Set key binds to piano mode
* amx_unset_piano --in console: Return key binds to normal, whatever is
* in client's config.cfg
* amx_piano_wtf --in console: Returns key binds to original default
* settings in the event amx_unset_piano cannot do it
* amx_pianonote <number from 1 to 13> 1 = C natural
* amx_pianooctave <number from 1 to 5> Default octave is 3 for medium
* pitch range playing
* amx_pianosound <number from 0 to 3> Default is 0 for fvox/boop sound
*
*
* WARNING: If you should become disconnected while in piano mode, your keys
* may be stuck in piano mode. If the unset command doesnt work, enter this
* in console: amx_piano_wtf and your binds will go back to original default
* for the keys that were used for piano. Those keys are:
*
* Change Note Keys: 1,2,3,4,5,6,7,8,9,0,-,=,backspace
* Change Octave Keys: F3,F4,F5,F6,F7
* Change instrument type: F8
*
* Normally I am not a fan of changing peoples binds or doing anything that
* can possibly be destructive to the config.cfg, but there are safegaurds
* built into the plugin to help minimize such an occurance. Use at your
* own risk.
*
****************************************************************************/
#include <amxmod>
#include <amxmisc>
new g_broadcastmode
new broadcastmode[33]
new octave[33]
new instrument[33]
new instrument_sound[4][] = {"fvox/boop","fvox/beep","buzwarn","bizwarn"}
new Float:transpose[4] = {86.4,102.9,111.5,94.5}
new are_you_sure[33]
public plugin_init() {
register_plugin("PLAY THE PIANO","1.0","EJL")
register_concmd("amx_piano_mode","admin_piano_bmode",ADMIN_MAP,"<player> <mode 0|1|2 : 0=no broadcast 1=only to dead 2=to all>")
register_concmd("amx_piano_mode_all","admin_piano_bmode",ADMIN_MAP,"<mode 0|1|2 : 0=no broadcast 1=only to dead 2=to all>")
register_clcmd("amx_pianonote", "admin_piano")
register_clcmd("amx_pianooctave","admin_octave")
register_clcmd("amx_set_piano","admin_bindk")
register_clcmd("amx_unset_piano","admin_unbindk")
register_clcmd("amx_pianosound","admin_instr")
register_clcmd("amx_piano_wtf","admin_piano_wtf")
register_clcmd("say /piano","piano_motd")
register_clcmd("say","HandleSay")
return PLUGIN_CONTINUE
}
public client_connect(id){
octave[id] = 3
instrument[id] = 0
if(get_user_flags(id) & ADMIN_MAP)
broadcastmode[id] = 2
else
broadcastmode[id] = g_broadcastmode
return PLUGIN_CONTINUE
}
public admin_piano_bmode(id,level,cid){
if (!cmd_access(id,level,cid,2))
return PLUGIN_HANDLED
new cmd[32]
read_argv(0,cmd,31)
if(equal(cmd[15],"a",1)){
new arg[8]
read_argv(1,arg,7)
new bmode = strtonum(arg)
if(bmode < 0 || bmode > 2)
bmode = 0
g_broadcastmode = bmode
new maxpl = get_maxplayers()
for(new i = 1;i<maxpl;i++)
broadcastmode = bmode
switch(g_broadcastmode){
case 0:{
console_print(id,"[AMX] You have set everyone's piano to no broadcast mode.")
client_print(0,print_chat,"[AMX] Admin has set server so only you hear yourself playing piano. Help: say /piano")
}
case 1:{
console_print(id,"[AMX] You have set everyone's piano to broadcast to dead only mode.")
client_print(0,print_chat,"[AMX] Admin has set server so only dead hear you playing piano. Help: say /piano")
}
case 2:{
console_print(id,"[AMX] You have set everyone's piano to broadcast to all players.")
client_print(0,print_chat,"[AMX] Admin has set server so everone hear everyone playing piano. Help: say /piano")
}
}
}else{
new arg[32], arg2[8]
read_argv(1,arg,31)
read_argv(2,arg2,7)
new player = cmd_target(id,arg,1)
if (!player) return PLUGIN_HANDLED
new bmode = strtonum(arg2)
if(bmode < 0 || bmode > 2)
bmode = 0
broadcastmode[player] = bmode
new pname[32]
get_user_name(player,pname,31)
switch(broadcastmode[player]){
case 0:{
console_print(id,"[AMX] You have set %s's piano to no broadcast mode.",pname)
client_print(0,print_chat,"[AMX] Admin has set %s's piano to no broadcast mode.",pname)
}
case 1:{
console_print(id,"[AMX] You have set %s's piano to broadcast to dead only mode.",pname)
client_print(0,print_chat,"[AMX] Admin has set %s's paino so only dead hear him playing piano.",pname)
}
case 2:{
console_print(id,"[AMX] You have set %s's piano to broadcast to all players.",pname)
client_print(0,print_chat,"[AMX] Admin has set %s's piano to broadcast to all players.",pname)
}
}
}
return PLUGIN_HANDLED
}
public HandleSay(id) {
new Speech[192]
read_args(Speech,192)
remove_quotes(Speech)
if( (containi(Speech, "piano") != -1) || (containi(Speech, "music") != -1) ){
switch(broadcastmode[id]){
case 0: client_print(id,print_chat,"[AMX] Only you can hear yourself playing piano. Help: say /piano")
case 1: client_print(id,print_chat, "[AMX] Only the dead can hear you playing piano. Help: say /piano")
case 2: client_print(id,print_chat, "[AMX] Everyone can hear you playing piano. Help: say /piano")
}
}
return PLUGIN_CONTINUE
} |
|