广告广告
  加入我的最爱 设为首页 风格修改
首页 首尾
 手机版   订阅   地图  繁体 
您是第 1964 个阅读者
 
发表文章 发表投票 回覆文章
  可列印版   加为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.033853 second(s),query:16 Gzip disabled
本站由 瀛睿律师事务所 担任常年法律顾问 | 免责声明 | 本网站已依台湾网站内容分级规定处理 | 连络我们 | 访客留言