|
发表于 2007-6-14 08:54:16
|
显示全部楼层
来自 中国–广东–深圳–南山区
回复: 消除脚步声插件+被闪后一定时间内身体变透明
怎么都不发缘码的?
http://forums.alliedmods.net/showthread.php?p=7808
[PHP]/*
*
* Stealth Shoes
* Version 2.0
* Author: AssKicR; to_asskicr@hotmail.com (MSN) DaAssKicR (AIM)
*
* This plugin will add a Stealth Shoes to Counter-Strike. You can buy/sell your shoes
* While using it you will have silent footsteps
* You can set the cost of the Stealth Shoes and enable/disable buyzone & buytime.
*
* Requirements:
* Compiled on 0.9.4.
* Should work successfully on 0.9.3
* Tested successfully on 0.9.4.
* Should work successfully on 0.9.5.
*
* Admin Commands:
* amx_shoes < nick, uniqueid, #userid, @TEAM, or * > <- Gives Stealth Shoes to specified client(s)
* amx_unshoes < nick, uniqueid, #userid, @TEAM, or * > <- Take Away Stealth Shoes
*
* Client Commands:
* say /shoes <- Displays the Stealth Shoes help menu
* buyshoes <- Buys a Stealth Shoes for specified player
* (Player must be in buyzone if specified by CVAR)
* sellshoes <- Sells player's Stealth Shoes for 75% of the buy price
*
* Server CVARs:
* shoes_cost "1500 - 10000" <- Amount of cash it takes to buy a Stealth Shoes
* shoes_buyzone 1/0 <- If on, player will required to be in a buyzone when buying Stealth Shoes
* shoes_buytime 1/0 <- If on, only allows player to buy Stealth Shoes during buytime
*
*/
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
new bool:StealthShoes[33]
new bool:BuyTimeAllow
new bool:BuyZoneAllow[33]
new Float:BuyTimeFloat
new BuyTimeNum
new bool:BuyTimeCvar
new bool:BuyZoneCvar
//TAKE AWAY CODE BELOW TO REMOVE CONNECT MESSAGE
public client_connect(id) {
StealthShoes[id]=false
}
//TAKE AWAY CODE ABOVE TO REMOVE CONNECT MESSAGE
public client_disconnect(id) {
StealthShoes[id]=false
}
public ass_sshoes(id,level,cid) {
if (!cmd_access(id,level,cid,2)) {
return PLUGIN_HANDLED
}
new victim[32]
read_argv(1,victim,31)
new admin[32]
get_user_name(id,admin,31)
if (victim[0]=='@') {
new team[32], inum
get_players(team,inum,"e",victim[1])
if (inum==0) {
console_print(id,"[AMX] No clients found on such team.")
return PLUGIN_HANDLED
}
for (new i=0;i<inum;++i) {
StealthShoes[team]=true
set_user_footsteps(team,1)
client_print(0,print_chat,"AMX Command: %s has gave all %s's Stealth Shoes.",admin,victim[1])
}
}
else if (victim[0]=='*') {
new all[32], inum
get_players(all,inum)
for (new i=0;i<inum;++i) {
StealthShoes[all]=true
set_user_footsteps(all,1)
client_print(0,print_chat,"AMX Command: %s has gave all clients Stealth Shoes.",admin)
}
}
else {
new player = cmd_target(id,victim,0)
new playername[32]
get_user_name(player,playername,31)
if (!player) {
return PLUGIN_HANDLED
}
StealthShoes[player]=true
set_user_footsteps(player,1)
client_print(0,print_chat,"AMX Command: %s has given %s a pair of Stealth Shoes.",admin,playername)
}
return PLUGIN_HANDLED
}
public ass_unsshoes(id,level,cid) {
if (!cmd_access(id,level,cid,2)) {
return PLUGIN_HANDLED
}
new victim[32]
read_argv(1,victim,31)
new admin[32]
get_user_name(id,admin,31)
if (victim[0]=='@') {
new team[32], inum
get_players(team,inum,"e",victim[1])
if (inum==0) {
console_print(id,"[AMX] No clients found on such team.")
return PLUGIN_HANDLED
}
for (new i=0;i<inum;i++) {
StealthShoes[team]=false
set_user_footsteps(team,0)
client_print(0,print_chat,"AMX Command: %s sabotaged all %s's Stealth Shoess.",admin,victim[1])
}
}
else if (victim[0]=='*') {
new all[32], inum
get_players(all,inum)
for (new i=0;i<inum;++i) {
StealthShoes[all]=false
set_user_footsteps(all,0)
client_print(0,print_chat,"AMX Command: %s sabotaged everyones Stealth Shoess.",admin)
}
}
else {
new player = cmd_target(id,victim,0)
new playername[32]
get_user_name(player,playername,31)
if (!player) {
return PLUGIN_HANDLED
}
StealthShoes[player]=false
set_user_footsteps(player,0)
client_print(0,print_chat,"AMX Command: %s sabotaged %s's Stealth Shoes.",admin,playername)
}
return PLUGIN_HANDLED
}
public cost_force() {
if (get_cvar_num("shoes_cost") < 1500) {
set_cvar_num("shoes_cost",1500)
}
if (get_cvar_num("shoes_cost") > 10000) {
set_cvar_num("shoes_cost",10000)
}
return PLUGIN_CONTINUE
}
public RoundTime()
{
if ( read_data(1)==get_cvar_num("mp_freezetime") || read_data(1)==6 ) // freezetime starts
{
remove_task(701) // remove buytime task
BuyTimeAllow = true
BuyTimeFloat = get_cvar_float("mp_buytime") * 60
BuyTimeNum = floatround(BuyTimeFloat,floatround_floor)
BuyTimeCvar = (get_cvar_num("shoes_buytime")) ? true : false
BuyZoneCvar = (get_cvar_num("shoes_buyzone")) ? true : false
}
else // freezetime is over
{
set_task(BuyTimeFloat,"BuyTimeTask",701)
}
return PLUGIN_CONTINUE
}
public BuyTimeTask()
{
BuyTimeAllow = false // buytime is over
}
public BuyIcon(id) // player is in buyzone?
{
if (read_data(1))
BuyZoneAllow[id] = true
else
BuyZoneAllow[id] = false
return PLUGIN_CONTINUE
}
public Check(id) // check if player can buy
{
if ( !is_user_alive(id)){
client_print(id,print_center,"You cannot buy while dead.")
return false
}
if ((!BuyZoneAllow[id]&&BuyZoneCvar) ) {
client_print(id,print_center,"You cannot buy outside of the buyzone.")
return false
}
if (BuyTimeCvar) {
if (!CheckTime(id))
return false
}
return true
}
public CheckTime(id) // check buytime
{
if (!BuyTimeAllow)
{
client_print(id,print_center,"%d seconds have passed...^n^nYou can't buy anything now!",BuyTimeNum)
return false
}
return true
}
public buy_shoes(id) {
new name[32]
get_user_name(id,name,31)
new userCash = cs_get_user_money(id)
new shade_cost = get_cvar_num("shoes_cost")
if (StealthShoes[id]) {
client_print(id,print_chat,"[SHOES] You currently have a pair of Stealth Shoes.")
return PLUGIN_HANDLED
}
if (!Check(id)) {
return PLUGIN_HANDLED
}
if (!is_user_alive(id)) {
return PLUGIN_HANDLED
}
if (userCash < shade_cost) {
client_print(id,print_center,"You have insufficient funds!")
client_print(id,print_chat,"[SHOES] You do not have enough money to buy Stealth Shoes. You need $%i.",shade_cost)
return PLUGIN_HANDLED
}
else if (userCash >= shade_cost) {
StealthShoes[id]=true
set_user_footsteps(id,1)
cs_set_user_money(id,userCash - shade_cost,1)
client_print(id,print_chat,"[SHOES] You have successfully bought a pair of Stealth Shoes.")
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
public sell_shoes(id) {
new name[32]
get_user_name(id,name,31)
new userCash = cs_get_user_money(id)
new shade_sell = get_cvar_num("shoes_cost")*2/3
if (!StealthShoes[id]) {
client_print(id,print_chat,"[SHOES] You currently do not have a pair of Stealth Shoes.")
}
if (StealthShoes[id]) {
StealthShoes[id]=false
set_user_footsteps(id,0)
cs_set_user_money(id,userCash + shade_sell,1)
client_print(id,print_chat,"[SHOES] You have sold your Stealth Shoes for 75 percent of the sell price.")
}
return PLUGIN_HANDLED
}
public HandleSay(id) {
new Speech[192]
read_args(Speech,192)
remove_quotes(Speech)
if( (containi(Speech, "water") != -1) || (containi(Speech, "diving") != -1) || (containi(Speech, "damage") != -1) || (containi(Speech, "breathe") != -1) ){
client_print(id,print_chat, "[SHOES] You can buy Stealth Shoes on this server. Type /shoes for details.")
}
return PLUGIN_CONTINUE
}
public shoes_help(id)
{
new buffer[1024]
new len = copy( buffer , 1023 , "Buy Stealth Shoes:^n\
Bind a key to buyshoes -- OR -- Type buyshoes in console^n^n\
Sell Stealth Shoes:^n\
Bind a key to sellshoes -- OR -- type sellshoes in console^n^n\
In order to bind a key you must open your console and use the bind command: ^n\
Bind ^"key^" ^"command^" ^n^n" )
len += copy( buffer[len] , 1023-len , "In this case the commands are ^"buyshoes^" & ^"sellshoes^".^nHere are some examples:^n\
bind / buyshoes bind / sellshoes^n^n\
When you have the Stealth Shoes:^n\
- You will have silent footsteps when using this. ")
show_motd(id,buffer ,"Stealth Shoes Help:")
return PLUGIN_HANDLED
}
public CheckIt() {
new all[32], inum
get_players(all,inum)
for (new i=0;i<inum;++i) {
if (StealthShoes){
set_user_footsteps(i,1)
}else{
set_user_footsteps(i,0)
}
}
}
public player_death()
{
new id = read_data(2)
set_user_footsteps(id,0)
StealthShoes[id]=false
return PLUGIN_HANDLED
}
public plugin_init() {
register_plugin("Stealth Shoes","2.0","AssKicR")
register_clcmd("buyshoes","buy_shoes")
register_clcmd("sellshoes","sell_shoes")
register_concmd("amx_shoes","ass_sshoes",ADMIN_LEVEL_A,"< Nick, UniqueID, #userid, @TEAM, or * > gives player a pair of stealth shoes")
register_concmd("amx_unshoes","ass_unsshoes",ADMIN_LEVEL_A,"< Nick, UniqueID< #userid, @TEAM, or * > removes player's stealth shoes")
register_cvar("shoes_cost","2000")
register_cvar("shoes_buyzone","1")
register_cvar("shoes_buytime","1")
register_event("StatusIcon","BuyIcon","be","2=buyzone")
register_event("RoundTime","RoundTime","bc")
register_event("DeathMsg", "player_death", "a")
register_clcmd("say","HandleSay",0)
register_clcmd("say /shoes", "shoes_help",0,": Opens Stealth Shoes help menu")
set_task(0.5,"cost_force",0,"",0,"b")
set_task(1.0,"CheckIt",0,"",0,"b")
return PLUGIN_CONTINUE
}
[/PHP]
http://forums.alliedmods.net/showthread.php?p=131723
[PHP]
/* AMX Mod X Script
*
* Author: KoST
* Version: 0.2
* Date: 25.July.05
*
*
* Negative Flash Grenades v0.2 -------------------------------------------------------
*
* Description:
* When you look into an exploding flash grenade you would normally get blinded.
* This plugin 'negates' this by making 'flashed' players invisible that's why it's
* called 'Negative Flash Grenades'. You can specify how long a player is invisible
* and how long it takes to fade him in again.
*
* Cvars:
* nf_on 0/1 -> turns the plugin on/off(default: 0)
* nf_flash 0/1 -> get flashed by flash grenades on/off( default: 0 )
* nf_holdtime x -> seconds to be fully invisible (default: 7)
* nf_fadetime x -> seconds it takes to fade-in again ( default: 8 )
*
* Requires: (these modules must be activated in your modules.ini in configs dir.)
* + engine
+ fun
*
* Quick_start:
* all you have to do is set:
* nf_on 1
*
* ChangeLog:
* + 22.July.05 - v0.1
* - first release
*
* + 25.July.05 - v0.2
* - bug in fader code fixed (player was too long invisible and then abrupt visible)
* - placement of hud messages changed
*
*
*/
new VERSION[]="0.2"
#include <amxmodx>
#include <engine>
#include <fun>
new screen_fade
new players_flashtime[32]
new players_fadecalls[32]
new Float:fade_timer=0.2
new bool:IsFadeing=false
public plugin_init(){
register_plugin("Negative Flash Grenades", VERSION, "KoST")
register_cvar("nf_on","0")
register_cvar("nf_flash","1")
register_cvar("nf_holdtime","7")
register_cvar("nf_fadetime","8")
screen_fade=get_user_msgid("ScreenFade")
register_logevent("annotation", 2, "0=World triggered", "1=Round_Start")
register_message(screen_fade,"fade_msg")
return PLUGIN_CONTINUE
}
public plugin_end(){
if (IsFadeing) remove_task(0)
}
public annotation(id,level,cid){
if (get_cvar_num("nf_on")>0){
set_hudmessage(222, 70,0, -1.0, 0.75, 1, 9.0, 2.0, 6.0, 1.0, 2)
show_hudmessage(0,"Negative Flash Grenades ON - flash yourself to get invisible..")
}
return PLUGIN_CONTINUE
}
public fade_msg(msgid,msgDest,msgEnt){
if (get_cvar_num("nf_on")>0){
}else{
return PLUGIN_CONTINUE
}
if (get_msg_arg_int(4)==255 && get_msg_arg_int(5)==255 && get_msg_arg_int(6)==255 && get_msg_arg_int(7)==255){
new blinded_id=get_player_by_entid(msgEnt)
new timestamp=get_systime()
players_flashtime[blinded_id]=timestamp
//client_print(blinded_id,print_chat,"You got flashed %d seconds after January 1 1970 00:00:00 GMT",timestamp)
players_fadecalls[blinded_id]=0
set_user_rendering(blinded_id,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,0)
if (!IsFadeing){
IsFadeing=true
set_task(fade_timer,"fader",0,"",1,"b")
}
if (get_cvar_num("nf_flash")>0){
return PLUGIN_CONTINUE
}else{
return PLUGIN_HANDLED
}
}
return PLUGIN_CONTINUE
}
public fader(){
new ft,diff,f
new hold=get_cvar_num("nf_holdtime")
new fade=get_cvar_num("nf_fadetime")
new fade_calls=floatround(fade/fade_timer)
new bool:finished=true
for(new i=0;i<32;i++){
ft=players_flashtime
if (ft>0){
diff=get_systime()-ft
if (diff<hold){
set_hudmessage(255, 255, 255, -1.0, 0.2, 1, 2.0, 0.1, 1.8, 0.1, 3)
show_hudmessage(i,"you are invisible(%d sec)..",(hold-diff))
}else if(diff<hold+fade){
f=(255/fade_calls)*(players_fadecalls+1)
set_user_rendering(i,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,f)
set_hudmessage(f/2, f/2, f/2, -1.0, 0.2, 0, 1.0, 0.1, 0.8, 0.1, 3)
show_hudmessage(i,"getting visible (%d/255)..",f)
players_fadecalls++
}else if (diff>=hold+fade){
set_user_rendering(i,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,255)
set_hudmessage(255, 255, 255, -1.0, 0.2, 0, 1.0, 0.1, 0.8, 0.1, 3)
show_hudmessage(i,"fully visible now...")
players_flashtime=0
}
finished=false;
}
}
if (finished){
remove_task(0)
IsFadeing=false;
}
return PLUGIN_CONTINUE
}
get_player_by_entid(ent_id){
new result[32]
entity_get_string(ent_id,EV_SZ_netname,result,31)
return get_user_index(result)
}[/PHP] |
|