廣告廣告
  加入我的最愛 設為首頁 風格修改
首頁 首尾
 手機版   訂閱   地圖  簡體 
您是第 2054 個閱讀者
 
發表文章 發表投票 回覆文章
  可列印版   加為IE收藏   收藏主題   上一主題 | 下一主題   
Alan.
個人頭像
個人文章 個人相簿 個人日記 個人地圖
小人物
級別: 小人物 該用戶目前不上站
推文 x41 鮮花 x31
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片
推文 x0
[1.6][插件] 新手學寫插件~大大幫我睇睇這幾個是什麼
新手學寫插件~大大幫我睇睇這幾個是什麼
來處是一個升級插件
這幾個是什麼意思
new const EXPERIENCE[NUM_LEVELS]=
new const LEVEL_DIF[MAX_LEVEL_DIF]=
stock Float:LOSS_PERC[LOSS_FACTOR_LEVELS]=
stock Float:WIN_PERC[WIN_FACTOR_LEVELS]=
public plugin_init()
public on_round(id)
public on_death()
public client_connect(id)
public client_disconnect(id)
public reset_experience(id)
public change_experience(killer, killed, level_dif)
get_user_team(killed))


獻花 x0 回到頂端 [樓 主] From:香港城市電訊 | Posted:2011-01-16 12:23 |
i-c0112
個人頭像
個人文章 個人相簿 個人日記 個人地圖
小有名氣
級別: 小有名氣 該用戶目前不上站
推文 x6 鮮花 x194
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片

public plugin_init()
插件初始化的時會呼叫此函數

get_user_team(killed))
看英文不就懂了...函數回傳隊伍編號啊

其他的要看你sma裡的定義...只給名稱誰懂啊= =


獻花 x1 回到頂端 [1 樓] From:台灣中華電信 | Posted:2011-01-16 12:28 |
a7811311622 手機
個人頭像
個人文章 個人相簿 個人日記 個人地圖
特殊貢獻獎 優秀管理員勳章 社區建設獎
頭銜:我…在工作了…我…在工作了…
版主
級別: 版主 該用戶目前不上站
版區: CS提問區
推文 x771 鮮花 x2152
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片

下面是引用 ☆孤獨x朱 於 2011-01-16 12:23 發表的 新手學寫插件~大大幫我睇睇這幾個是什麼: 到引言文
新手學寫插件~大大幫我睇睇這幾個是什麼
來處是一個升級插件
這幾個是什麼意思
new const EXPERIENCE[NUM_LEVELS]=
new const LEVEL_DIF[MAX_LEVEL_DIF]=
stock Float:LOSS_PERC[LOSS_FACTOR_LEVELS]=
stock Float:WIN_PERC[WIN_FACTOR_LEVELS]=
public plugin_init()
public on_round(id)
public on_death()
public client_connect(id)
public client_disconnect(id)
public reset_experience(id)
public change_experience(killer, killed, level_dif)
get_user_team(killed))

new const EXPERIENCE[NUM_LEVELS]→推測是記錄升級的經驗值條件吧…
new const LEVEL_DIF[MAX_LEVEL_DIF]→推測是記錄和等級相關的內容吧…
stock Float:LOSS_PERC[LOSS_FACTOR_LEVELS]→推測是輸的玩家經驗減少%數吧…
stock Float:WIN_PERC[WIN_FACTOR_LEVELS]→推測是贏的玩家經驗增加%數吧…
public plugin_init()→請看一樓…
public on_round(id)→推測是新回合要執行的內容吧…(register_event("ResetHUD","on_round","be"))
public on_death()→推測是玩家死亡時要執行的內容吧…(register_event("DeathMsg", "on_death", "a"))
public client_connect(id)→推測是進入伺服器後要執行的內容吧…
public client_disconnect(id)→推測是離開伺服器時要執行的內容吧…
public reset_experience(id)→推測是重設經驗值的內容吧…
public change_experience(killer, killed, level_dif)→推測是成功擊殺目標時經驗值的變化吧…
get_user_team(killed))→あははーっ、佐祐理にはわかりません


尚無簽名,歡迎 [新增個性化簽名]
獻花 x1 回到頂端 [2 樓] From:台灣教育部 | Posted:2011-01-16 20:11 |
Alan.
個人頭像
個人文章 個人相簿 個人日記 個人地圖
小人物
級別: 小人物 該用戶目前不上站
推文 x41 鮮花 x31
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片

多謝大大的幫忙,但知了解釋還是不明白,這些有什麼用途,我只好再找高手了。


獻花 x0 回到頂端 [3 樓] From:香港城市電訊 | Posted:2011-01-17 06:47 |
i-c0112
個人頭像
個人文章 個人相簿 個人日記 個人地圖
小有名氣
級別: 小有名氣 該用戶目前不上站
推文 x6 鮮花 x194
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片

下面是引用 ☆孤獨x朱 於 2011-01-17 06:47 發表的 : 到引言文
多謝大大的幫忙,但知了解釋還是不明白,這些有什麼用途,我只好再找高手了。
多看幾次sma內容應該就會明白= =
你不給完整內容找幾個人都是一樣......


[ 此文章被i-c0112在2011-01-17 23:08重新編輯 ]


獻花 x0 回到頂端 [4 樓] From:台灣中華電信 | Posted:2011-01-17 22:43 |
Alan.
個人頭像
個人文章 個人相簿 個人日記 個人地圖
小人物
級別: 小人物 該用戶目前不上站
推文 x41 鮮花 x31
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片

/*
Level Mod by love6534121繁化
This plugin is based off of bungie's Halo 2 Stats System
( http://www.bungie.net/Stats/cont...h2statoverview )
You earn experience for killing enemies, and lose experience for dying, teamkills, and suicides.
The most you can gain or lose is 150 experience and the least you can gain or lose is 50
experience (unless above level 40, then 25).
The way the gain/loss differs is by your current level (higher levels are given less and lose more)
and by level difference (if you are a higher level you are given less and lose more).
As you increase levels you are required more experience for the next. Eventually, if you are a high
level and playing low levels it might seem nearly impossible to grow a level because you are constantly
earning little experience and the needed is demanding. However, play with higher levels and you will
gain more experience quicker.
*/
#include <amxmodx>
#include <amxmisc>
#include <nvault>
#define PLUGIN "等級顯示V1.0"
#define VERSION "1.0"
#define AUTHOR "love6534121繁化"
#define NUM_LEVELS 50
#define MAX_LEVEL_DIF 31     //including negatives and zero
#define LOSS_FACTOR_LEVELS 27
#define WIN_FACTOR_LEVELS 10
new rank_level[33], rank_experience[33], rank_user_rank[33][21], g_status_sync
new const EXPERIENCE[NUM_LEVELS]=   //經驗值
{
 0,
 1000,
 2000,
 3000,
 4000,
 5000,
 6000,
 7000,
 8000,
 9000,
 10000,
 11000,
 12000,
 14000,
 16000,
 18000,
 20000,
 22500,
 25000,
 27500,
 30000,
 32500,
 35000,
 37500,
 40000,
 42500,
 45000,
 47500,
 50000,
 52500,
 55000,
 57500,
 60000,
 62500,
 65000,
 67500,
 70000,
 72500,
 75000,
 77500,
 80000,
 82500,
 85000,
 87500,
 90000,
 92500,
 95000,
 97500,
 100000,
 150000,
}
new const LEVEL_DIF[MAX_LEVEL_DIF]=
{
 150, //-15
 149, //-14
 148, //-13
 147, //-12
 146, //-11
 144, //-10
 142, //-9
 140, //-8
 137, //-7
 134, //-6
 130, //-5
 126, //-4
 121, //-3
 115, //-2
 108, //-1
 100, //0
 92, //1
 85, //2
 79, //3
 74, //4
 70, //5
 66, //6
 63, //7
 60, //8
 58, //9
 56, //10
 54, //11
 53, //12
 52, //13
 51, //14
 50  //15
}
stock Float:LOSS_PERC[LOSS_FACTOR_LEVELS]=
{
  0.0, //1
  0.025, //2
  0.050, //3
  0.075, //4
  0.100, //5
  0.125, //6
  0.150, //7
  0.175, //8
  0.200, //9
  0.225, //10
  0.250, //11
  0.275, //12
  0.300, //13
  0.325, //14
  0.350, //15
  0.400, //16
  0.450, //17
  0.500, //18
  0.550, //19
  0.600, //20
  0.650, //21
  0.700, //22
  0.750, //23
  0.800, //24
  0.850, //25
  0.900, //26
  0.950 //27
}
stock Float:WIN_PERC[WIN_FACTOR_LEVELS]=
{
  0.950, //41
  0.900, //42
  0.850, //43
  0.800, //44
  0.750, //45
  0.700, //46
  0.650, //47
  0.600, //48
  0.550, //49
  0.500 //50
}
public plugin_init()
{
 register_plugin(PLUGIN, VERSION, AUTHOR)
 register_event("DeathMsg", "on_death", "a")
 register_event("RoundTime", "on_round", "b")
 
 register_event("StatusValue", "setTeam", "be", "1=1");
 register_event("StatusValue", "on_ShowStatus", "be", "1=2", "2!0");
 register_event("StatusValue", "on_HideStatus", "be", "1=1", "2=0");
 g_status_sync = CreateHudSyncObj();
}
public on_round(id)
{
 Load(id)
 check_experience(id)
 if(task_exists(id))
  remove_task(id)
 show_hud(id)
}
public on_death()
{
 new killer = read_data(1), killed = read_data(2)
 new level_dif = rank_level[killer] - rank_level[killed]
 change_experience(killer, killed, level_dif)
}
public client_connect(id)
{
 reset_experience(id)
 Load(id)
 check_experience(id)
}
public client_disconnect(id)
{
 Save(id)
 reset_experience(id)
}
public reset_experience(id)
{
 rank_experience[id] = 0
}
public change_experience(killer, killed, level_dif)
{
  
 if(level_dif>15)
  level_dif = 15
 else if(level_dif<-15)
  level_dif = -15
  
 if(killer==killed || get_user_team(killer) == get_user_team(killed))
 {
  rank_experience[killer] -= LEVEL_DIF[0]
  check_experience(killer)
  Save(killer)
  return PLUGIN_CONTINUE
 }
  
 if(is_user_connected(killer) && killer>0)
 {
  new final_gain = 0
  if(rank_level[killer]<40)
  {
   final_gain = LEVEL_DIF[level_dif+15]
   rank_experience[killer] += final_gain
  }
  else if(rank_level[killer]>=40 && rank_level[killer]<50)
  {
   final_gain = floatround(LEVEL_DIF[level_dif+15]*WIN_PERC[rank_level[killer] - 40])
   rank_experience[killer] += final_gain
  }
  else
   return PLUGIN_CONTINUE
   
  check_experience(killer)
  Save(killer)
 }
 
 if(is_user_connected(killed) && killed>0)
 {
  new opp_LEVEL_DIF = LEVEL_DIF[level_dif+15]*-1
  new final_loss = 0
  if(rank_level[killed]<27)
  {
   final_loss = floatround(opp_LEVEL_DIF *LOSS_PERC[rank_level[killed]])
   rank_experience[killed] += final_loss
  }
  else if(rank_level[killed]>=27)
  {
   final_loss = opp_LEVEL_DIF
   rank_experience[killed] += final_loss
  }
  check_experience(killed)
  Save(killed)
 }
 
 return PLUGIN_CONTINUE 
}
public check_experience(id)
{
 if(!is_user_connected(id) || id<=0)
  return PLUGIN_CONTINUE
  
 if(rank_experience[id]<0)
 {
  rank_experience[id] = 0
  check_experience(id)
  return PLUGIN_CONTINUE
 }
 
 new old_rank = rank_level[id]
 
 for (new x=0; x<NUM_LEVELS; x++)
 { 
  if (rank_experience[id]>=EXPERIENCE[x])
  {
   rank_level[id]=x;
  }
  else
  {
   x=NUM_LEVELS;
  }
 }
 
 if(rank_level[id]>49)
  rank_level[id] = 50
 
 num_to_word(rank_level[id] + 1, rank_user_rank[id], 23)
 
 if(rank_level[id]>old_rank)
  client_cmd(id, "排名 ^"fvox/%s^"", rank_user_rank[id])
 
 if(!task_exists(id))
  show_hud(id) 
 
 return PLUGIN_CONTINUE
}

 
public show_hud(id)
{
 if(is_user_connected(id) && id>0 && !is_user_bot(id))
 {
  new StatsDisplay[84]
  new next_level = rank_level[id]+1
  if(next_level>49)
   next_level = 49
  format(StatsDisplay, 83, "[個人狀態] 經驗值: %d/%d 等級: %d ",rank_experience[id], EXPERIENCE[next_level] , rank_level[id] + 1)
  set_hudmessage(225, 235, 0, -1.0, 0.05, 0, 5.0, 600.0, 0.1, 0.2, 1)
  show_hudmessage(id, StatsDisplay)
 }
 set_task(0.3, "show_hud", id)
}
public Save(id)
{
 new authid[32];
 get_user_authid(id, authid, 31);
 
 new key[64], data[101];
 
 format(key, 63, "等級-%s", authid);
 format(data, 100, "%i", rank_experience[id]);
 
 nvault_set(nvault_open("levelmod"), key, data);
}
public Load(id) {
 new authid[32];
 get_user_authid(id, authid, 31);
 
 new key[64], data[101];
 
 new gexperience[8]
 
 format(key, 63, "等級-%s", authid);
 format(data, 100, "%i", rank_experience[id]);
 nvault_get(nvault_open("levelmod"), key, data, 81);
 
 replace_all(data, 100, "#", " ");
 
 parse(data, gexperience, 7);
 
 rank_experience[id] = str_to_num(gexperience);
}


//////////FROM BF2 RANK MOD//////////
public on_ShowStatus(id) //called when id looks at someone
{
 new name[32], pid = read_data(2);
 new pidrank = rank_level[pid];
 get_user_name(pid, name, 31);
 new color1 = 0, color2 = 0;
 if (get_user_team(pid) == 1)
  color1 = 255;
 else
  color2 = 255  
 
 set_hudmessage(color1, 100, color2, -1.0, 0.35, 0, 0.01, 20.0); 
 ShowSyncHudMsg(id, g_status_sync, "%s^n等級: %d", name, rank_level[pidrank]+1);
}
public on_HideStatus(id)
{
 ClearSyncHud(id, g_status_sync);
}

是這個升級插件了..小弟想研究研究。 


獻花 x0 回到頂端 [5 樓] From:香港城市電訊 | Posted:2011-01-18 06:59 |
lyw8614505
個人文章 個人相簿 個人日記 個人地圖
小有名氣
級別: 小有名氣 該用戶目前不上站
推文 x6 鮮花 x184
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片

看A78大回複,又明白了一些道理


獻花 x0 回到頂端 [6 樓] From:歐洲 | Posted:2011-01-19 16:46 |
Alan.
個人頭像
個人文章 個人相簿 個人日記 個人地圖
小人物
級別: 小人物 該用戶目前不上站
推文 x41 鮮花 x31
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片

如果要改經,個function 應該點改?


獻花 x0 回到頂端 [7 樓] From:局域網對方和您在同一內部網 | Posted:2011-01-25 09:10 |
q7291172
個人文章 個人相簿 個人日記 個人地圖
小人物
級別: 小人物 該用戶目前不上站
推文 x1 鮮花 x13
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片

你的这个升级插件怎么那么像广东大学的升级插件?


獻花 x0 回到頂端 [8 樓] From:未知地址 | Posted:2011-01-26 09:45 |
q7291172
個人文章 個人相簿 個人日記 個人地圖
小人物
級別: 小人物 該用戶目前不上站
推文 x1 鮮花 x13
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片

new PLUGIN_VERSION[]  = "1.2"
#define Resetcost 2000
#define Kill_Experience  120 
#define Hos_Experience  50
#define Obj_Experience  80
#define MIN_PLAYERS  6 //Minimum players that are connected to get objective xp
#define Max_Level  56
//How much the passive upgrades cost
#define armorcost 1
#define hpcost 1
#define speedcost 1
#define gravitycost 1
#define stealthcost 4
#define multijumpcost 7
#define dmgcost 1
//How much the passive upgrades adds
#define armorperbuy 7
#define hpperbuy 25
#define speedperbuy 4
//eg. 0.05 it will take off 5% of the users gravity
#define gravityperbuy 0.08
//eg. (stealthperbuy = 60) times (stealthmaxlvl = 3) = 180 // the value must be lower than the defaultstealth
#define defaultstealth 200
#define stealthperbuy 20
#define damage_PerLevel 500000.0
//How much the passive upgrades Max Level
#define armormaxlvl 16
#define hpmaxlvl 23
#define speedmaxlvl 13
#define gravitymaxlvl 8
#define stealthmaxlvl 6
#define multijumpmaxlvl 2
#define MaxLevel_damage   8
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <vault>
#include <fun>
#include <fakemeta>
#include <hamsandwich>
#define BOMB_TASK 1234
new LevelUpSound[]  = { "events/task_complete.wav" }
new DeniedSound[]  = { "buttons/blip1.wav"}
new UpgradedSound[]  = { "items/tr_kevlar.wav" }
new LEVELS[Max_Level] =
{
 300,
 800,
 1400,
 2200,
 3200,
 4200,
 5200,
 6400,
 7600,
 8800,
 10200,
 11600,
 13000,
 14600,
 15200,
 17000,
 18800,
 20400,
 23800,
 26000,
 30800,
 34000,
 40000,
 45000,
 50400,
 58000,
 64800,
 70800,
 78000,
 85400,
 90000,
 97800,
 105800,
 116000,
 125400,
 135000,
 144800,
 154800,
 165000,
 175400,
 186000,
 198000,
 201000,
 215000,
 225000,
 238000,
 245000,
 260000,
 276000,
 290000,
 310000,
 330000,
 350000,
 380000,
 410000,
 1155000
}

new PlayerXp[33]
new PlayerLevel[33]
new PlayerPoints[33]
new Armor[33]
new Health[33]
new Speed[33]
new Gravity[33]
new Stealth[33]
new multijump[33]
new jumpnum[33]
new g_damageLevel[33]
new bool:g_PlayerReseted[33]
new bool:dojump[33] = false
new bool:speed = true
new hudmsg[512]
new PLUGIN_NAME[]  = "广东工业大学专用升级插件"
new PLUGIN_AUTHOR[]  = "Cheap_Suit, 后期设计:Eyeshield21"
public plugin_init()
{
 register_cvar("amx_upgrades", "1")
 register_menu("GDUT 主要升级菜单", 1023, "MainMenuCommand")
 register_menu("GDUT 技能菜单", 1023, "actionMenu")
 register_menu("Item Upgrade Menu", 1023, "EUAMenu")
 register_menu("Item 2 Upgrade Menu", 1023, "EUA2Menu")
 register_clcmd("say", "handlesay")
 register_clcmd("say_team", "handlesay")
 register_clcmd("upgrade", "MainUpgradesMenu")
 RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
 register_event("ResetHUD", "Event_ResetHUD", "be")
 register_event("StatusValue","show_status","bd","1=2")
 register_event("DeathMsg", "Event_DeathMsg", "a")
 register_event("CurWeapon","update","be","1=1")
 register_event("Damage", "damage_msg", "b", "2!0", "3=0", "4!0")
 register_event("Damage", "Event_Damage1", "bd", "2>0")
 register_logevent("LogEvent_Objectives", 3, "1=triggered")
 server_cmd("sv_maxspeed 1500")
 set_task(0.1, "Main1UpgradesMenu", 12, _, _, "b")
}
public Event_ResetHUD(id)
{
 if(!is_user_alive(id)) {
  return PLUGIN_CONTINUE
 }
 
 if(g_PlayerReseted[id])
 {  
  new iPoints = PlayerLevel[id]
  PlayerPoints[id] = iPoints
  Armor[id] = 0
  Health[id] = 0
  Speed[id] = 0
  Gravity[id] = 0
  Stealth[id] = 0
  jumpnum[id] = 0
  multijump[id] = 0
  g_damageLevel[id] = 0
  client_print(id, print_chat, "【广东工业大学提醒您】 您的技能点已经重置")
  g_PlayerReseted[id] = false
  SaveData(id)
 }
 if(get_cvar_num("amx_upgrades") == 1)
 {
   if(Armor[id] > 0)
   {
    new iap = (Armor[id] * armorperbuy)
    set_user_armor(id, 0 + iap)
   }
   if(Health[id] > 0)
   {
    new ihp = (Health[id] * hpperbuy)
    set_user_health(id, 250 + ihp)
   }
  speed = false
  set_task(get_cvar_float("mp_freezetime"), "allow_speed", 0)
 }
 return PLUGIN_CONTINUE
}
public Main1UpgradesMenu()

 new Players[32], iNum
 get_players(Players, iNum)
 
 for(new i = 0; i < iNum; ++i)
 {
  new id = Players
  if(is_user_alive(id))
  {
   new InfoMsg[255]
   format(InfoMsg, 254, "等级: %d/%d    经验值: %d/%d    技能点: %d ", PlayerLevel[id], Max_Level-1, PlayerXp[id], LEVELS[PlayerLevel[id]], PlayerPoints[id])
        
   message_begin(MSG_ONE, get_user_msgid("StatusText"), {0, 0, 0}, id)
   write_byte(0)
   write_string(InfoMsg)
   message_end()
  }
 
  if(PlayerXp[id] >= LEVELS[Max_Level-1] || PlayerLevel[id] >= Max_Level-1)
  {
   PlayerLevel[id] = Max_Level-1
   PlayerXp[id] = LEVELS[Max_Level-1]
   return PLUGIN_CONTINUE
  }
  
  if(PlayerXp[id] >= LEVELS[PlayerLevel[id]])
  {
   PlayerLevel[id] += 1
   PlayerPoints[id] += 1
   showMenu(id)
   client_cmd(id, "spk %s", LevelUpSound)
  }
 }
 return PLUGIN_CONTINUE
}
public client_authorized(id)
{
{
  Armor[id] = 0
  Health[id] = 0
  Speed[id] = 0
  Gravity[id] = 0
  Stealth[id] = 0
  jumpnum[id] = 0
  multijump[id] = 0
  g_damageLevel[id] = 0
  LoadData(id)
  new iPoints = PlayerLevel[id]
  PlayerPoints[id] = iPoints
  if(PlayerXp[id] >= Resetcost){
    PlayerXp[id] = PlayerXp[id] - Resetcost
    client_print(id, print_chat, "【广东工业大学提醒你】 你的技能点已经重置,并扣除了%d经验值", Resetcost)
  }
  if(PlayerXp[id] < Resetcost){
   client_print(id, print_chat, "【广东工业大学提醒你】 你的技能点已经重置")
  }
}
 return PLUGIN_CONTINUE
}

public show_status(id)
{
 if(get_cvar_num("amx_upgrades") != 1)
  return PLUGIN_CONTINUE
 new target = read_data(2)
   if(target != id && target != 0)
   {
  new name[32]
     get_user_name(target, name,31)
  new len = format(hudmsg, 511, "名字: %s^n提升技能:^n", name)
  len += format(hudmsg[len], 511-len, "等级: %d^n", PlayerLevel[target])
  len += format(hudmsg[len], 511-len, "剩余技能点: %d^n", PlayerPoints[target])
  len += format(hudmsg[len], 511-len, "护甲技能: %d/%d^n生命技能: %d/%d^n速度技能: %d/%d^n重力技能: %d/%d^n隐身技能: %d/%d^n多重跳跃: %d/%d^n伤害技能: %d/%d^n", Armor[target], armormaxlvl, Health[target], hpmaxlvl, Speed[target], speedmaxlvl, Gravity[target], gravitymaxlvl, Stealth[target], stealthmaxlvl, multijump[target], multijumpmaxlvl, g_damageLevel[target], MaxLevel_damage)
  len += format(hudmsg[len], 511-len, "^n暂无项目:^n")
  set_hudmessage(255, 255, 255, 0.6, -1.0, 0, 0.0, 6.0, 0.0, 0.0, 1)
  show_hudmessage(id, hudmsg)
 }
 return PLUGIN_CONTINUE
}
public allow_speed()
{
 speed = true
 return PLUGIN_HANDLED
}
get_connectedplayers()
{
 new cpl
 for(new i = 1; i <= get_maxplayers(); ++i) if(is_user_connected(i)) {
  cpl += 1
 }
 return cpl
}
public LogEvent_Objectives()
{
 if(get_connectedplayers() < MIN_PLAYERS) {
  return PLUGIN_CONTINUE
 }
 
 new sArg[64], sAction[64]
 read_logargv(0, sArg, 64)
 read_logargv(2, sAction, 64)
 
 new sName[1], iUserId, iExperienceGain
 parse_loguser(sArg, sName, 0, iUserId)
 new id = find_player("k", iUserId)
 if(equal(sAction,"Planted_The_Bomb") || equal(sAction, "Defused_The_Bomb") || equal(sAction, "Escaped_As_VIP"))
 {
  if(PlayerLevel[id] < 1) {
   iExperienceGain = Obj_Experience
  } else {
   iExperienceGain = Obj_Experience * PlayerLevel[id]
  }
  
  add_experience(id, iExperienceGain)
  client_print(id, print_chat, "你获得 %d 点经验", iExperienceGain)
  client_print(id, print_console, "*** 你获得 %d 点经验 ***", iExperienceGain)
 }
 else if(equal(sAction, "Rescued_A_Hostage"))
 {
  if(PlayerLevel[id] < 1) {
   iExperienceGain = Hos_Experience
  } else {
   iExperienceGain = Hos_Experience * PlayerLevel[id]
  } 
  
  add_experience(id, iExperienceGain)
  client_print(id, print_chat, "你获得 %d 点经验", iExperienceGain)
  client_print(id, print_console, "*** 你获得 %d 点经验 ***", iExperienceGain)
 }
 return PLUGIN_CONTINUE
}
public Event_HostagesRescued()
{
 if(get_connectedplayers() < MIN_PLAYERS) {
  return PLUGIN_CONTINUE
 }
 
 new iPlayers[32], iNum, i
 get_players(iPlayers, iNum, "ae", "CT")
 for(i = 0; i <= iNum; i++)
 {
  new id = iPlayers
  
  new iExperienceGain
  if(PlayerLevel[id] < 1) {
   iExperienceGain = Obj_Experience
  } else {
   iExperienceGain = Obj_Experience * PlayerLevel[id]
  }
  
  add_experience(id, iExperienceGain)
  client_print(id, print_chat, "你获得 %d 点经验", iExperienceGain)
  client_print(id, print_console, "*** 你获得 %d 点经验 ***", iExperienceGain)
 }
 return PLUGIN_CONTINUE
}
public Event_DeathMsg()
{
 new attacker = read_data(1)
 new victim = read_data(2)
  
 if(!is_user_connected(attacker) || !is_user_connected(victim)) {
  return PLUGIN_CONTINUE
 }
 
 if(get_user_team(attacker) == get_user_team(victim)) {
  return PLUGIN_CONTINUE
 }
 if(attacker != victim)
 {
  new iExperienceGain
  if(PlayerLevel[attacker] < 1) {
   iExperienceGain = Kill_Experience
  } else {
   iExperienceGain = Kill_Experience * PlayerLevel[attacker]
  }  
     
  add_experience(attacker, iExperienceGain)
  client_print(attacker, print_center, "你获得 %d 点经验", iExperienceGain)
  client_print(attacker, print_console, "***你获得 +%d 点经验 ***", iExperienceGain)
 }
 return PLUGIN_CONTINUE
}
public Event_Damage1(id)
{
 if(!is_user_connected(id)) {
  return PLUGIN_CONTINUE
 }
 return PLUGIN_CONTINUE
}

public damage_msg(id)
{
  new attacker = get_user_attacker(id)
  if (is_user_connected(id) && is_user_connected(attacker))
{
  new damage = read_data(2)
  new iExperienceGain
  if(damage > 0)
{
  iExperienceGain = damage
}
  add_experience(attacker, iExperienceGain)
}
}

public client_disconnect(id)
{
 Armor[id] = 0
 Health[id] = 0
 Speed[id] = 0
 Gravity[id] = 0
 Stealth[id] = 0
 jumpnum[id] = 0
 multijump[id] = 0
 g_damageLevel[id] = 0
 SaveData(id)
 return PLUGIN_CONTINUE
}
public handlesay(id)
{
 new arg[64], arg1[32], arg2[32]
 read_args(arg,63)
 remove_quotes(arg)
 strtok(arg,arg1,255,arg2,255,' ',1)
 trim(arg2)
 if(arg1[0] == '/')
 {
  if(equali(arg1, "/ummenu") == 1 || equali(arg1, "/upgrades") == 1 || equali(arg1, "/upgrade") == 1)
  {
   MainUpgradesMenu(id)
   return PLUGIN_CONTINUE
  }
 }
 return PLUGIN_CONTINUE
}
public MainUpgradesMenu(id)
{
 if(get_cvar_num("amx_upgrades") == 1)
 {
  new keys
  new szMenuBody[255]
  new len = format(szMenuBody, 511, "\rGDUT 主要升级菜单:^n")
  len += format(szMenuBody[len], 511-len, "^n\y1. 技能菜单")
  len += format(szMenuBody[len], 511-len, "^n^n^n\y7. 重置技能(花费 %d 经验值)", Resetcost)
  len += format(szMenuBody[len], 511-len, "^n\y8. 保存经验")
  len += format(szMenuBody[len], 511-len, "^n\y9. 升级版本信息")
  len += format(szMenuBody[len], 511-len, "^n^n\w0.  取消")
  keys = (1<<0|1<<6|1<<7|1<<8|1<<9)
  show_menu(id, keys, szMenuBody, -1)
 }
 else
  client_print(id,print_chat,"[AMXX] Credit Mod is currently disabled")
 return PLUGIN_HANDLED
}
public MainMenuCommand(id, key)
{
 switch(key)
 {
  case 0: showMenu(id)
  case 6:
  {
   if(PlayerXp[id] < Resetcost){
    client_print(id, print_chat, "【广东工业大学提醒你】 你没有足够的经验值重置技能")
    }
   if(PlayerXp[id] >= Resetcost){
    PlayerXp[id] = PlayerXp[id] - Resetcost
    g_PlayerReseted[id] = true
    client_print(id, print_chat, "【广东工业大学提醒你】 你的技能点将在下回合重置")
   }
  }
  case 7:
  {
   SaveData(id)
   client_print(id, print_chat, "【广东工业大学提醒你】 你的经验值已经保存")
  }
  case 8: client_print(id, print_chat, "%s by %s  Version: %s", PLUGIN_NAME, PLUGIN_AUTHOR, PLUGIN_VERSION)
 }
 return PLUGIN_HANDLED
}
public EU2Menu(id)
{
 new keys
 new szMenuBody[512]
 new len = format(szMenuBody, 511, "\y暂无项目:^n")
 len += format(szMenuBody[len], 511-len, "^n^n\w9.  返回")
 len += format(szMenuBody[len], 511-len, "^n\w0.  取消")
 keys = (1<<8|1<<9)
 show_menu(id, keys, szMenuBody, -1)
}
public EUA2Menu(id, key)
{
 switch(key)
 {
  case 8: EUMenu(id)
 }
 return PLUGIN_HANDLED
}
public EUMenu(id)
{
 if(get_cvar_num("amx_upgrades") == 1)
 {
  new keys
  new szMenuBody[512]
  new len = format(szMenuBody, 511, "\y暂无项目:^n")
  len += format(szMenuBody[len], 511-len, "^n^n\w8.  下一页")
  len += format(szMenuBody[len], 511-len, "^n\w9.  返回")
  len += format(szMenuBody[len], 511-len, "^n\w0.  取消")
  keys = (1<<7|1<<8|1<<9)
  show_menu(id, keys, szMenuBody, -1)
 }
}
public EUAMenu(id, key)
{
  switch(key)
  {
   case 7: EU2Menu(id)
   case 8: MainUpgradesMenu(id)
  }
  return PLUGIN_HANDLED
}
public showMenu(id)
{
 if(get_cvar_num("amx_upgrades") == 1)
 {
  new keys
  new szMenuBody[512]
  new len = format(szMenuBody, 511, "\rGDUT 技能菜单:^n")
  if(PlayerPoints[id] >= armorcost){
  len += format(szMenuBody[len], 511-len, "^n\y1. 提升护甲 (%d/%d 费用: %d 技能点)", Armor[id], armormaxlvl, armorcost)
  }
  if(PlayerPoints[id] < armorcost){
  len += format(szMenuBody[len], 511-len, "^n\r1. 提升护甲 (%d/%d 费用: %d 技能点)", Armor[id], armormaxlvl, armorcost)
  }
  if(PlayerPoints[id] >= hpcost){
  len += format(szMenuBody[len], 511-len, "^n\y2. 提升生命 (%d/%d 费用: %d 技能点)", Health[id], hpmaxlvl, hpcost)
  }
  if(PlayerPoints[id] < hpcost){
  len += format(szMenuBody[len], 511-len, "^n\r2. 提升生命 (%d/%d 费用: %d 技能点)", Health[id], hpmaxlvl, hpcost)
  }
  if(PlayerPoints[id] >= speedcost){
  len += format(szMenuBody[len], 511-len, "^n\y3. 提升速度 (%d/%d 费用: %d 技能点)", Speed[id], speedmaxlvl, speedcost)
  }
  if(PlayerPoints[id] < speedcost){
  len += format(szMenuBody[len], 511-len, "^n\r3. 提升速度 (%d/%d 费用: %d 技能点)", Speed[id], speedmaxlvl, speedcost)
  }
  if(PlayerPoints[id] >= gravitycost){
  len += format(szMenuBody[len], 511-len, "^n\y4. 提升重力 (%d/%d 费用: %d 技能点)", Gravity[id], gravitymaxlvl, gravitycost)
  }
  if(PlayerPoints[id] < gravitycost){
  len += format(szMenuBody[len], 511-len, "^n\r4. 提升重力 (%d/%d 费用: %d 技能点)", Gravity[id], gravitymaxlvl, gravitycost)
  }
  if(PlayerPoints[id] >= stealthcost){
  len += format(szMenuBody[len], 511-len, "^n\y5. 提升隐身 (%d/%d 费用: %d 技能点)", Stealth[id], stealthmaxlvl, stealthcost)
  }
  if(PlayerPoints[id] < stealthcost){
  len += format(szMenuBody[len], 511-len, "^n\r5. 提升隐身 (%d/%d 费用: %d 技能点)", Stealth[id], stealthmaxlvl, stealthcost)
  }
  if(PlayerPoints[id] >= multijumpcost){
  len += format(szMenuBody[len], 511-len, "^n\y6. 多重跳跃 (%d/%d 费用: %d 技能点)", multijump[id], multijumpmaxlvl, multijumpcost)
  }
  if(PlayerPoints[id] < multijumpcost){
  len += format(szMenuBody[len], 511-len, "^n\r6. 多重跳跃 (%d/%d 费用: %d 技能点)", multijump[id], multijumpmaxlvl, multijumpcost)
  }
  if(PlayerPoints[id] >= dmgcost){
  len += format(szMenuBody[len], 511-len, "^n\w7. 提升伤害(暂无效果,待完善) (%d/%d 费用: %d 技能点)", g_damageLevel[id], MaxLevel_damage, dmgcost)
  }
  if(PlayerPoints[id] < dmgcost){
  len += format(szMenuBody[len], 511-len, "^n\r7. 提升伤害(暂无效果,待完善) (%d/%d 费用: %d 技能点)", g_damageLevel[id], MaxLevel_damage, dmgcost)
  }
  len += format(szMenuBody[len], 511-len, "^n^n\w9.  返回")
  len += format(szMenuBody[len], 511-len, "^n\w0.  取消")
  keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<8|1<<9)
  show_menu(id, keys, szMenuBody, -1)
 }
 return PLUGIN_CONTINUE
}
public actionMenu(id, key, value)
{
  switch(key)
  {
   case 0:
   {
    if(PlayerPoints[id] < armorcost)
     client_print(id, print_chat, "【广东工业大学提醒你】 你没有足够的技能点")
    if(Armor[id] == armormaxlvl)
     client_print(id, print_chat, "【广东工业大学提醒你】 你的护甲技能已升至最高级")
    if(PlayerPoints[id] >= armorcost && Armor[id] < armormaxlvl)
    {
     Armor[id]++
     UserArmor(id, armorperbuy)
     upgradelevelup(id)
     decpoint(id,armorcost)
     showMenu(id)
     client_print(id, print_chat, "【广东工业大学提醒你】 你增加了 %d 护甲", armorperbuy)
    }
   }
   case 1:
   {
    if(PlayerPoints[id] < hpcost)
     client_print(id, print_chat, "【广东工业大学提醒你】 你没有足够的技能点")
    if(Health[id] == hpmaxlvl)
     client_print(id, print_chat, "【广东工业大学提醒你】 你的生命技能已升至最高级")
    if(PlayerPoints[id] >= hpcost && Health[id] < hpmaxlvl)
    {
     Health[id]++
     UserHealth(id, hpperbuy)
     upgradelevelup(id)
     decpoint(id,hpcost)
     showMenu(id)
     client_print(id, print_chat, "【广东工业大学提醒你】 你增加了 %d 生命", hpperbuy)
    }
   }
   case 2:
   {
    if(PlayerPoints[id] < speedcost)
     client_print(id, print_chat, "【广东工业大学提醒你】 你没有足够的技能点")
    if(Speed[id] == speedmaxlvl)
     client_print(id, print_chat, "【广东工业大学提醒你】 你的速度技能已升至最高级")
    if(PlayerPoints[id] >= speedcost && Speed[id] < speedmaxlvl)
    {
     Speed[id]++
     UserSpeed(id)
     upgradelevelup(id)
     decpoint(id,speedcost)
     showMenu(id)
     client_print(id, print_chat, "【广东工业大学提醒你】 增加了 %d 点速度", speedperbuy)
    }
   }
   case 3:
   {
    if(PlayerPoints[id] < gravitycost)
     client_print(id, print_chat, "【广东工业大学提醒你】 你没有足够的技能点")
    if(Gravity[id] == gravitymaxlvl)
     client_print(id, print_chat, "【广东工业大学提醒你】 你的重力技能已升至最高级")
    if(PlayerPoints[id] >= gravitycost && Gravity[id] < gravitymaxlvl)
    {
     Gravity[id]++
     UserGravity(id)
     upgradelevelup(id)
     decpoint(id,gravitycost)
     showMenu(id)
     client_print(id, print_chat, "【广东工业大学提醒你】 你已减轻了重力")
    }
   }
   case 4:
   {
    if(PlayerPoints[id] < stealthcost)
     client_print(id, print_chat, "【广东工业大学提醒你】 你没有足够的技能点")
    if(Stealth[id] == stealthmaxlvl)
     client_print(id, print_chat, "【广东工业大学提醒你】 你的隐身技能已升至最高级")
    if(PlayerPoints[id] >= stealthcost && Stealth[id] < stealthmaxlvl)
    {
     Stealth[id]++
     UserStealth(id)
     upgradelevelup(id)
     decpoint(id,stealthcost)
     showMenu(id)
     client_print(id, print_chat, "【广东工业大学提醒你】 你增加了透明度")
    }
   }
   case 5:
   {
    if(PlayerPoints[id] < multijumpcost)
     client_print(id, print_chat, "【广东工业大学提醒你】 你没有足够的技能点")
    if(multijump[id] == multijumpmaxlvl)
     client_print(id, print_chat, "【广东工业大学提醒你】 你的多重跳跃技能已升至最高级")
    if(PlayerPoints[id] >= multijumpcost && multijump[id] < multijumpmaxlvl)
    {
     multijump[id]++
     upgradelevelup(id)
     decpoint(id,multijumpcost)
     showMenu(id)
     client_print(id, print_chat, "【广东工业大学提醒你】 你现在能在空中多跳跃 %d 次", multijump[id])
    }
   }
   case 6:
   {
    if(PlayerPoints[id] < dmgcost)
     client_print(id, print_chat, "【广东工业大学提醒你】 你没有足够的技能点")
    if(g_damageLevel[id] == MaxLevel_damage)
     client_print(id, print_chat, "【广东工业大学提醒你】 你的火力技能已升至最高级")
    if(PlayerPoints[id] >= dmgcost && g_damageLevel[id] < MaxLevel_damage)
    {
     g_damageLevel[id]++
     upgradelevelup(id)
     decpoint(id,dmgcost)
     showMenu(id)
     client_print(id, print_chat, "【广东工业大学提醒你】 你提升了火力")
    }
   }
   case 8: MainUpgradesMenu(id)
  }
  return PLUGIN_HANDLED
}
add_experience(id, value)
{
 if(PlayerLevel[id] <= Max_Level-1) {
  PlayerXp[id] += value
 }
}
public UserArmor(id, value)
{
 new CsArmorType:ArmorType
 new iArmor = cs_get_user_armor(id, ArmorType)
 cs_set_user_armor(id, iArmor + value, ArmorType)
 return PLUGIN_CONTINUE
}
public UserHealth(id, value)
{
 new iHealth = get_user_health(id)
 set_user_health(id, iHealth + value)
 return PLUGIN_CONTINUE
}
public UserSpeed(id)
{
 if(speed == false)
  return PLUGIN_CONTINUE
 new ispeed = (Speed[id] * speedperbuy)
 set_user_maxspeed(id, 240.0 + ispeed)
 return PLUGIN_CONTINUE
}
public UserGravity(id)
{
 set_user_gravity(id, 1 - Gravity[id] * gravityperbuy)
 return PLUGIN_CONTINUE
}
public UserStealth(id)
{
 new istealth = (Stealth[id] * stealthperbuy)
 set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, defaultstealth - istealth)
 return PLUGIN_CONTINUE
}
public client_PreThink(id)
{
 if(is_user_alive(id) && get_cvar_num("amx_upgrades") == 1)
 {
  new buttons = get_user_button(id)
  new obut = get_user_oldbutton(id)
  if(multijump[id] > 0)
  {
   if((buttons & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(obut & IN_JUMP))
   {
    if(jumpnum[id] < multijump[id])
    {
     dojump[id] = true
     jumpnum[id]++
     return PLUGIN_CONTINUE
    }
   }
   if((buttons & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
    jumpnum[id] = 0
  }
 }
 return PLUGIN_CONTINUE
}
public client_PostThink(id)
{
 if(is_user_alive(id) && get_cvar_num("amx_upgrades") == 1)
 {
  if(dojump[id] == true)
  {
   new Float:velocity[3] 
   entity_get_vector(id,EV_VEC_velocity,velocity)
   velocity[2] = random_float(265.0,285.0)
   entity_set_vector(id,EV_VEC_velocity,velocity)
   dojump[id] = false
   return PLUGIN_CONTINUE
  }
 }
 return PLUGIN_CONTINUE
}
public fw_TakeDamage(id, victim, inflictor, attacker, Float:damage, damage_type)
{
 if (!is_user_alive(id) || attacker == inflictor)
  return HAM_IGNORED
 
 if (g_damageLevel[id] > 0)
  SetHamParamFloat(4, damage + 1000000)
 
 return HAM_IGNORED 
}
SaveData(id)
{
 new authid[32]
 get_user_authid(id, authid, 31)
 new vaultkey[64], vaultdata[64]
 
 format(vaultkey, 63, "Account-%s-Level", authid)
 format(vaultdata, 63, "%d", PlayerLevel[id])
 set_vaultdata(vaultkey, vaultdata)
 
 format(vaultkey, 63, "Account-%s-Xp", authid)
 format(vaultdata, 63, "%d", PlayerXp[id])
 set_vaultdata(vaultkey, vaultdata)
 format(vaultkey, 63, "Account-%s-Points", authid)
 format(vaultdata, 63, "%d", PlayerLevel[id])
 set_vaultdata(vaultkey, vaultdata)
}
LoadData(id)
{
 new authid[32]
 get_user_authid(id,authid,31)
 new vaultkey[64], vaultdata[64]
 format(vaultkey, 63, "Account-%s-Level", authid)
     get_vaultdata(vaultkey, vaultdata, 63)
     PlayerLevel[id] = str_to_num(vaultdata)
 
 format(vaultkey, 63, "Account-%s-Xp", authid)
     get_vaultdata(vaultkey, vaultdata, 63)
     PlayerXp[id] = str_to_num(vaultdata)
     format(vaultkey, 63, "Account-%s-Points", authid)
     get_vaultdata(vaultkey, vaultdata, 63)
     PlayerPoints[id] = str_to_num(vaultdata)
     
}
public update(id)
{
 if(get_cvar_num("amx_upgrades") != 1)
  return PLUGIN_CONTINUE
 if(!is_user_alive(id))
  return PLUGIN_CONTINUE
 set_user_gravity(id, 1 - Gravity[id] * gravityperbuy)
 if(speed != false)
  set_user_maxspeed(id, 240.0 + (Speed[id] * speedperbuy))
 new temp[2]
 new istealth = (Stealth[id] * stealthperbuy)
 if(Stealth[id] > 0)
 {
  if(get_user_weapon(id, temp[0], temp[1]) == CSW_KNIFE)
  {
   new astealth = istealth + 20
   set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, defaultstealth - astealth)
  }
  else
   set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, defaultstealth - istealth)
 }
 return PLUGIN_CONTINUE
}
public upgradelevelup(id)
{
 client_print(id, print_center, "你该项技能已经提升")
 client_cmd(id, "spk weapons/pl_gun2.wav")
 return PLUGIN_CONTINUE
}
public plugin_precache()
{
 precache_sound("weapons/pl_gun2.wav")
 precache_sound("buttons/blip2.wav")
 precache_sound("weapons/mine_charge.wav")
 precache_model("models/v_satchel_radio.mdl")
 precache_model("models/p_satchel_radio.mdl")
 precache_sound(DeniedSound)
 precache_sound(LevelUpSound)
 precache_sound(UpgradedSound)
}
public decpoint(id, itemcost)
{
 new cost = itemcost
 PlayerPoints[id] = PlayerPoints[id] - cost
 return PLUGIN_HANDLED
}


獻花 x0 回到頂端 [9 樓] From:未知地址 | Posted:2011-01-26 09:46 |

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