chantikki分身 發表於 28-2-2009 20:11:48

誠誠誠 發表於 28-2-2009 20:41:26

[轉]教你整經驗值升Level AMXX
#include <amxmodx>
#include <amxmisc>
#include <nvault>   //save exp時用的

new PlayerXP,PlayerLevel   //新增變數playerEXP(經驗值) playerLevel(等級)
new XP_Kill,XP_Hs,SaveXP // 一個固定的經驗值
new g_vault//用來save的數字
new const LEVELS = {    //const 即 constant(常數) 此處為每級EXP 等級數目不可大於[]內數字
0,
100,//你需要100exp
200,//200 exp
400,//400exp
800,
1600,
99999//可防止某BUG
}

public plugin_init()   //大致上BBQ都教了
{
    register_plugin("EXPLEVELmod", "1.0", "LSM")
    register_event("DeathMsg", "eDeath", "a")   //殺人時發生 "eDeath" 時件
    SaveXP = register_cvar("SaveXP","1")
    XP_Kill=register_cvar("XP_per_kill", "20")   //指令 令殺人幾多exp
    XP_Hs=register_cvar("XP_hs_bonus","20")
    g_vault = nvault_open("expmod")            //開一個save 檔
    register_clcmd("say /class", "ChangeClass")
    register_clcmd("say_team /class", "ChangeClass")
    register_clcmd("say /xp", "ShowHud")
    register_clcmd("say_team /xp", "ShowHud")
}
public eDeath( ) //function name
{
    new killer = read_data( 1 )
    new iVictim = read_data( 2 )
    new headshot = read_data( 3 )
    PlayerXP += get_pcvar_num(XP_Kill) //殺手增加XP_Kill 咁多exp
    if(headshot)
    PlayerXP += get_pcvar_num(XP_Hs) //爆頭的附加exp
   while(PlayerXP >= LEVELS]) //當exp大於
    {
      client_print(killer, print_chat, " Congratulations! You are a level %i %s!", PlayerLevel,CLASSES])
      PlayerLevel += 1 //此變數加一
    }
    ShowHud(killer)
}
public ShowHud(id) //HUD顯示器
{
    set_hudmessage(255, 0, 0, 0.75, 0.01, 0, 6.0, 15.0)
    show_hudmessage(id, "Level: %i^nXP: %i^nClass: %s",PlayerLevel,PlayerXP)
}

public client_connect(id)//當某人入場
{
    if(get_pcvar_num(SaveXP) == 1)
    {
      // load save
      LoadData(id)
    }
}
public client_disconnect(id) //類似上面 當有人離場
{
   if(get_pcvar_num(SaveXP) == 1)
   {
          SaveData(id)
   }
}
public SaveData(id)
{
    new AuthID get_user_authid(id,AuthID,34)
    new vaultkey,vaultdata
    format(vaultkey,63,"%s-Mod",AuthID)
    format(vaultdata,255,"%i#%i#",PlayerXP,PlayerLevel)
    nvault_set(g_vault,vaultkey,vaultdata)
    return PLUGIN_CONTINUE
}

public LoadData(id)
{
    new AuthID get_user_authid(id,AuthID,34)
    new vaultkey,vaultdata
    // search
    format(vaultkey,63,"%s-Mod",AuthID)
    format(vaultdata,255,"%i#%i#",PlayerXP,PlayerLevel)
    // load the data
    nvault_get(g_vault,vaultkey,vaultdata,255)
    replace_all(vaultdata, 255, "#", " ")
    new playerxp, playerlevel
    parse(vaultdata, playerxp, 31, playerlevel, 31)
    PlayerXP = str_to_num(playerxp)
    PlayerLevel = str_to_num(playerlevel)
    return PLUGIN_CONTINUE
}

叛逆炎 發表於 28-2-2009 20:42:12

要求 : 編寫
主題 : 死後爆骨
內容 : 人物死後會 爆血爆骨 好似血腥插件中的爆骨一樣

chantikki分身 發表於 28-2-2009 20:51:48

yathsing 發表於 28-2-2009 20:54:38

本帖最後由 yathsing 於 28-2-2009 20:56 編輯

33# 叛逆炎


SetHamParamInteger(3, 2) <-爆身 ham code

28# 叛逆炎


咁似我伺服器既@@?

教你

random_num(x,x) <-隨機

我係用呢個code的

chantikki分身 發表於 28-2-2009 21:06:04

yathsing 發表於 28-2-2009 21:15:41

36# chantikki分身


唔識就要教啦

npmps2d 發表於 28-2-2009 21:26:00

要求 : 繁化主題 :
內容 : war3's txt
其他意見 : just want txt..thx

DL野用 發表於 28-2-2009 21:34:36

要求 : 編寫
主題 : BHOP距離
內容 : 可以知道自己BHOP呎到幾多既AMXX 最好加入LJ CJ插件內

叛逆炎 發表於 28-2-2009 21:53:26

36# chantikki分身


唔識就要教啦
yathsing 發表於 28-2-2009 21:15 http://www.nakuz.com/bbs/images/common/back.gif

係邊到SET @@ AMX_GORE?
頁: 1 2 3 [4] 5 6 7 8 9 10 11 12 13
查看完整版本: 繁化區 / 創作區