廣告廣告
  加入我的最愛 設為首頁 風格修改
首頁 首尾
 手機版   訂閱   地圖  簡體 
您是第 1904 個閱讀者
 
發表文章 發表投票 回覆文章
  可列印版   加為IE收藏   收藏主題   上一主題 | 下一主題   
davidto1995
個人文章 個人相簿 個人日記 個人地圖
小人物
級別: 小人物 該用戶目前不上站
推文 x2 鮮花 x5
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片
推文 x0
[1.6] 求救!!!
進能幫我修理..不知道要什麼問題



















/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <nvault>
#define MAXCLASSES 100  

#define PLUGIN "New Plugin"
#define VERSION "1.0"
#define AUTHOR "Author"

 new PlayerXP[33],PlayerLevel[33],PlayerClass[33]
 //these are for special kills  
 new XP_Kill,XP_Knife,XP_Hs,SaveXP
 //this is for Nvault. so that We can save XP
 new g_vault  
 
 new const CLASSES[MAXCLASSES][] = {
    "1",
    "2",
    "3",
    "4",
    "5",
    "6",
    "7",
    "8",
    "9",
    "10",
    "11",
    "12",
    "13",
    "14",
    "15",
    "16",
    "17",
    "18",
    "19",
    "20",
    "21",
    "22",
    "23",
    "24",
    "25",
    "26",
    "27",
    "28",
    "29",
    "30",
    "31",
    "32",
    "33",
    "34",
    "35",
    "36",
    "37",
    "38",
    "39",
    "40",
    "41",
    "42",
    "43",
    "44",
    "45",
    "46",
    "47",
    "48",
    "49",
    "50",
    "51",
    "52",
    "53",
    "54",
    "55",
    "56",
    "57",
    "58",
    "59",
    "60",
    "61",
    "62",
    "63",
    "64",
    "65",
    "66",
    "67",
    "68",
    "69",
    "70",
    "71",
    "72",
    "73",
    "74",
    "75",
    "76",
    "77",
    "78",
    "79",
    "80",
    "81",
    "82",
    "83",
    "84",
    "85",
    "86",
    "87",
    "88",
    "89",
    "90",
    "91",
    "92",
    "93",
    "94",
    "95",
    "96",
    "97",
    "98",
    "99"
    } 


new const LEVELS[99] = {
0,
50,//this means you need 100 xp
100,//this means you need 200 xp
150,//this means you need 400 xp
200,//so on
250,//so on
300,//so on
350,
400,
450,
500,
550,
600,
650,
700,
750,
800,
850,
900,
950,
1000,//21
1100,
1200,
1300,
1400,
1500,
1600,
1700,
1800,
1900,
2000,//31
2150,
2300,
2450,
2600,
2750,
2900,
3050,//38
3250,
3450,
3650,
3850,
4050,//43
4300,
4550,
4800,
5050,
5350,
5650,
5950,
6250,//51,300
6600,//350
6950,
7300,//54,400
7700,
8100,
8100,//450
8550,
9000,
9500,
10000,//550
10550,
11000,//600
11600,
12200,//650
12850,
13500,//700
14200,
14950,//750
15700,//800
16500,//850
17350,
18250,//950
19200,//1000,74,Up100
19300,//Up200
19500,
19800,//300
20100,
20500,
21000,
21600,
22300,
23100,
24000,
25000,//85,x000+x00
26100,
27300,
28600,
30000,
31500,
33100,//91,Up1700
34800,
36600,
38500,
40500,//95,Up2100
42600,
44800,
47100,
49500



     



public plugin_init() {
     register_plugin("level system","v1.0","Esai<David>")
    //we need this to check your level after you kill some one
    register_event("DeathMsg", "eDeath", "a")
     //is saving on?
    SaveXP = register_cvar("SaveXP","1")
    //how many xp are u gonna get per kill?
    XP_Kill=register_cvar("XP_per_kill", "1")
    //if you get a hs you get bonus xp
    XP_Hs=register_cvar("XP_hs_bonus","1")
    //if you make a knife kill you get bounus xp
    XP_Knife=register_cvar("XP_knife_bonus","5")
    //we just opened a new connection NVAULT connection
    // we will call it animod
    g_vault = nvault_open("lvmod")
    // register a say command to change class
    register_clcmd("say /level", "ChangeClass")
    register_clcmd("say_team /level", "ChangeClass")
    //show how much xp you have
    register_clcmd("say /xp", "ShowHud")
    register_clcmd("say_team /xp", "ShowHud")
   

}

public eDeath( ) //function name
{
    // If the player's Class is  nothing, then dont bother to do any of the below
    if(PlayerClass[attacker] == 0)
        return PLUGIN_CONTINUE 
     
     // We create the victim variable, so that this function can check
     // if a player was killed
    new iVictim = read_data( 2 )
    // If a player was killed by a HeadShot, this will be used for the cvar Xp_Hs
    new headshot = read_data( 3 )
 
    //which weapon was used
    new clip, ammo, weapon = get_user_weapon(id,clip,ammo);
    PlayerXP[attacker] += get_pcvar_num(XP_Kill)
    // used for the xp_hs cvar
    // it checks if the victim was killed by a headshot
    if(headshot)
    // give him/her bonus xp
    PlayerXP[attacker] += get_pcvar_num(XP_Hs)
    // checks if the victim was killed by a knife
    if(weapon == CSW_KNIFE)
        //give him/her bonus xp
    PlayerXP[attacker] += get_pcvar_num(XP_Knife)
    // this checks if the player has enough xp to advance to a new level
    while(PlayerXP[attacker] >= LEVELS[PlayerLevel[attacker]])
    { // this will create the Congratulations message.
        client_print(attacker, print_chat, "[Esai<David> LevelSystem] Your level: %i %s!",PlayerLevel[attacker],CLASSES[PlayerClass[attacker]])
        // Add his/her level
        PlayerLevel[attacker] += 1
    }
    // shows his level on a hud message
    ShowHud(attacker)
 


public ShowHud(id)
{
    set_hudmessage(255, 0, 0, 0.75, 0.01, 0, 6.0, 15.0)
    show_hudmessage(id, "Level: %i^nXP: %i^nClass: %s",PlayerLevel[id],PlayerXP[id],CLASSES[PlayerClass[id]])
}


 
public Class_Handle(id , menu , item)
{
    if(item == MENU_EXIT)
    {
        menu_destroy(menu);
    }
    new szCommand[6] , szName[64]; new access , callback;
    menu_item_getinfo(menu , item , access , szCommand , 5 , szName , 63 , callback);
    new i = str_to_num(szCommand)
    if(PlayerClass[id] != i)
    {
        PlayerClass[id] = i client_print(id,print_chat,"You are now a %s",CLASSES)
    }
    else
    {
        client_print(id,print_chat,"You are alredy a %s",CLASSES)
    }
    menu_destroy(menu);
    return PLUGIN_CONTINUE
}   

public client_connect(id)
{
    // Only does it if xp saving is on
    if(get_pcvar_num(SaveXP) == 1)
    {
        // load your player data
        LoadData(id)
    }
}


public client_disconnect(id)
{
// Only does it if xp saving is on
     if(get_pcvar_num(SaveXP) == 1)
     {
          // lets save the data
          SaveData(id)
     }
}

public SaveData(id)
{
    // get the players steam id. We need this because we are saving by steam id
    new AuthID[35] get_user_authid(id,AuthID,34)
    new vaultkey[64],vaultdata[256]
    // format wat is going to be in the level mod vault file
    format(vaultkey,63,"%s-Mod",AuthID)
    format(vaultdata,255,"%i#%i#",PlayerXP[id],PlayerLevel[id])
    // save the data
    nvault_set(g_vault,vaultkey,vaultdata)
    return PLUGIN_CONTINUE
}


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



獻花 x0 回到頂端 [樓 主] From:香港和記電訊 | Posted:2010-06-20 03:20 |
husano896 手機
個人頭像
個人文章 個人相簿 個人日記 個人地圖
初露鋒芒
級別: 初露鋒芒 該用戶目前不上站
推文 x79 鮮花 x138
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片

你連attacker和id 都沒有指定好 當然會這樣啦....

attacker 可以透過 readdata的方式取得


這邊流動率真的挺低的'w' 但我是有在看的哦w
也許哪天被我亂入也說不定(!?

按這裡檢視影片,登入論壇可以直接觀看
*ZP*沒爆頭回合不結束

↓吃瀏覽數長大的龍:)
獻花 x0 回到頂端 [1 樓] From:台灣中華電信 | Posted:2010-06-20 07:49 |
davidto1995
個人文章 個人相簿 個人日記 個人地圖
小人物
級別: 小人物 該用戶目前不上站
推文 x2 鮮花 x5
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片

要怎樣指定??


獻花 x0 回到頂端 [2 樓] From:香港和記電訊 | Posted:2010-06-20 15:30 |

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