廣告廣告
  加入我的最愛 設為首頁 風格修改
首頁 首尾
 手機版   訂閱   地圖  簡體 
您是第 3744 個閱讀者
 
發表文章 發表投票 回覆文章
  可列印版   加為IE收藏   收藏主題   上一主題 | 下一主題   
crazy4ever
個人文章 個人相簿 個人日記 個人地圖
初露鋒芒
級別: 初露鋒芒 該用戶目前不上站
推文 x39 鮮花 x77
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片
推文 x0
[1.6][插件] 求指出錯處
這sma 有錯處 , 不能轉amxx ,
當中有錯處  , 求大大幫助 ><


#include <amxmodx>
#include <engine>
#include <fun>
#include <cstrike>

// ======== EDITABLE ZONE ======== //

// Set the time for healing (in seconds).
#define HealthTime 10

// Set the distance between the Health Kit owner and the receiver (in HL units).
#define OriginsDistance 260

// Set the custom Health Kit model.
new const g_MedKit[ ] = { "models/umbrella/p_medkit.mdl" };

// ======== END OF EDITABLE ZONE ======== //
// Don't proceed if you have no idea what you are doing!

#define SetUserHealthKit(%1) g_bHealthKit |= (1<<(%1 & 31))
#define HasUserHealthKit(%1) g_bHealthKit & (1<<(%1 & 31))
#define ClearUserHealthKit(%1) g_bHealthKit &= ~(1<<(%1 & 31))

#define SetUserConnected(%1) g_bConnected |= (1<<(%1 & 31))
#define IsUserConnected(%1) g_bConnected & (1<<(%1 & 31))
#define ClearUserConnected(%1) g_bConnected &= ~(1<<(%1 & 31))

new g_bHealthKit;
new g_bConnected;

new g_nMsgBarTime;

public plugin_precache( )
{
precache_model( g_MedKit );
}

public plugin_init( )
{
register_plugin( "Health Kit", "0.1.3c", "TBagT Edit" );

register_event( "HLTV", "eventRoundStart", "a", "1=0", "2=0" );
}

public plugin_cfg( )
{
g_nMsgBarTime = get_user_msgid( "BarTime" );
}

public eventRoundStart( id, iPlayer )
{
if (!is_user_alive(id))
return

static CsTeams: team ; team = cs_get_user_team(id)

if (team == CS_TEAM_T)

remove_entity( find_ent_by_model( iPlayer, "info_target", g_MedKit ) );
ClearUserHealthKit( iPlayer );
}
else if (team == CS_TEAM_CT)
{
if ( HasUserHealthKit( iPlayer ) )
{
client_print( iPlayer, print_chat, "You already have a Health Kit" );
}

SetUserHealthKit( iPlayer );

new iEnt = create_entity( "info_target" );
entity_set_int( iEnt, EV_INT_movetype, MOVETYPE_FOLLOW );
entity_set_edict( iEnt, EV_ENT_aiment, iPlayer );
entity_set_edict( iEnt, EV_ENT_owner, iPlayer );
entity_set_model( iEnt, g_MedKit );

static const szMessages[ ][ ] =
{
"You now have a health kit!",
"Press E (+use) aiming to a friend.",
"If you don't aim to a friend you will heal yourself."
}

for (new i = 0; i < sizeof ( szMessages ); i++)
{
client_print( iPlayer, print_chat, szMessages[ i ] );
}
}
}

public client_putinserver( iPlayer )
{
ClearUserHealthKit( iPlayer );
SetUserConnected( iPlayer );
}

public client_disconnect( iPlayer )
{
ClearUserHealthKit( iPlayer );
ClearUserConnected( iPlayer );
}

public client_PreThink( iPlayer )
{
if ( HasUserHealthKit( iPlayer ) && is_user_alive( iPlayer ) && get_user_team(iPlayer) == 2 )
{
if ( ( entity_get_int( iPlayer, EV_INT_button ) & IN_USE ) && !( entity_get_int( iPlayer, EV_INT_oldbuttons ) & IN_USE ) )
{
new iTarget;
new iDontCare;
get_user_aiming( iPlayer, iTarget, iDontCare );

if ( is_user_alive( iTarget ) )
{
new iOwnerOrigin[ 3 ];
new iReceiverOrigin[ 3 ];

get_user_origin( iPlayer, iOwnerOrigin, 0 );
get_user_origin( iTarget, iReceiverOrigin, 0 );

if ( get_distance( iOwnerOrigin, iReceiverOrigin ) <= OriginsDistance )
{
if ( get_user_health( iTarget ) < 100 )
{
set_view( iPlayer, CAMERA_3RDPERSON );

showBarTimeMessage( iPlayer, HealthTime );

set_hudmessage( 85, 255, 255, 0.16, 0.05, 1, 6.0, 5.0 );
show_hudmessage( iTarget, "A friend is healing you!" );

static szData[ 2 ];
szData[ 0 ] = iPlayer;
szData[ 1 ] = iTarget;

set_task( float( HealthTime ), "taskHealReceiver", _, szData, sizeof ( szData ) );
}
}
return;
}
else
{
if ( get_user_health( iPlayer ) < 100 )
{
set_view( iPlayer, CAMERA_3RDPERSON );

showBarTimeMessage( iPlayer, HealthTime );

set_task( float( HealthTime ), "taskHealHimself", iPlayer );
}
return;
}
}
}
}

showBarTimeMessage( iPlayer, iTime)
{
message_begin( MSG_ONE_UNRELIABLE, g_nMsgBarTime, _, iPlayer );
write_short( iTime );
message_end( );
}

public taskHealReceiver( szParams[ ] )
{
new iPlayer = szParams[ 0 ];
new iTarget = szParams[ 1 ];

if ( IsUserConnected( iTarget ) && is_user_alive( iTarget ) )
{
set_user_health( iTarget, 100 );
}

if ( IsUserConnected( iPlayer ) )
{
if ( is_user_alive( iPlayer ) )
{
set_view( iPlayer, CAMERA_NONE );
}
ClearUserHealthKit( iPlayer );
}

remove_entity( find_ent_by_model( iPlayer, "info_target", g_MedKit ) );
}

public taskHealHimself( iPlayer )
{
if ( IsUserConnected( iPlayer ) )
{
if ( is_user_alive( iPlayer ) )
{
set_user_health( iPlayer, 100 );

set_view( iPlayer, CAMERA_NONE );
}
ClearUserHealthKit( iPlayer );
}

remove_entity( find_ent_by_model( iPlayer, "info_target", g_MedKit ) );
}



獻花 x0 回到頂端 [樓 主] From:未知地址 | Posted:2013-08-07 23:34 |
love6534121
個人頭像
個人文章 個人相簿 個人日記 個人地圖
小有名氣
級別: 小有名氣 該用戶目前不上站
推文 x44 鮮花 x243
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片

幫你轉好了....


獻花 x1 回到頂端 [1 樓] From:台灣固網股份有限公司 | Posted:2013-08-08 01:08 |
crazy4ever
個人文章 個人相簿 個人日記 個人地圖
初露鋒芒
級別: 初露鋒芒 該用戶目前不上站
推文 x39 鮮花 x77
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片

謝謝你 ><


獻花 x0 回到頂端 [2 樓] From:未知地址 | Posted:2013-08-08 10:22 |

首頁  發表文章 發表投票 回覆文章
Powered by PHPWind v1.3.6
Copyright © 2003-04 PHPWind
Processed in 0.092130 second(s),query:16 Gzip disabled
本站由 瀛睿律師事務所 擔任常年法律顧問 | 免責聲明 | 本網站已依台灣網站內容分級規定處理 | 連絡我們 | 訪客留言