警告系統 Warning System

Home Home
引用 | 編輯 龍心
2017-10-31 02:28
樓主
推文 x0

圖 1.


【插件資訊】

插件來源:網路資源轉載提供會員參考
使用指令:自行修改編譯及參考http://bbs.mychat.tw/reads.php?tid=1005540
安裝路徑:自行修改編譯及參考http://bbs.mychat.tw/reads.php?tid=1005540

【插件介紹】

複製程式

new WarningName[9999][64];
new NOW_NAME;
new Type_Index;
new Object_Index;
new PlayerIndex;
new PlayerNum[33][32];
new PlayerCount[33];
new Warning_Msg;


get_configsdir(String:name[], len)
{
    return get_localinfo(0, name, len);
}


public plugin_init()
{
    register_plugin(2604312, "1.0", "EnDieS");
    register_clcmd("say /warning", "WarningMenu01", -1, "", -1);
    new szConfigsDir[64];
    get_configsdir(szConfigsDir, 63);
    format(szConfigsDir, "", "%s/Warning.ini", szConfigsDir);
    LoadFileText(szConfigsDir);
    Warning_Msg = CreateHudSyncObj(0);
    return 0;
}


LoadFileText(String:szFile[])
{
    if (!file_exists(szFile))
    {
        server_print("WARNING: File Warning.ini not found");
        return 0;
    }
    new nLen = 0;
    new temp[256];
    while (NOW_NAME < 9999 && read_file(szFile, NOW_NAME, temp, "", nLen))
    {
        if (WarningName[NOW_NAME][0][0][0] == 59)
        {
        }
        else
        {
            parse(temp, WarningName[NOW_NAME][0][0], 63);
            NOW_NAME = NOW_NAME + 1;
        }
    }
    server_print("[Warning] Loaded %d Warning Name", NOW_NAME);
    return 0;
}


public WarningMenu01(id)
{
    if (get_user_flags(id, 0) & 8)
    {
        new szLen[256];
        new szNum[33];
        format(szLen, "", 2604856);
        new menu = menu_create(szLen, "WarningMenu_Handler01", 0);
        new i = 0;
        while (i < NOW_NAME)
        {
            format(szLen, "", "%s", WarningName[i][0][0]);
            num_to_str(i, szNum, 32);
            menu_additem(menu, szLen, szNum, 0, -1);
            i++;
        }
        menu_setprop(menu, "", 1);
        menu_display(id, menu, 0);
        return 1;
    }
    if (get_user_flags(id, 0) & 33554432)
    {
        client_print(id, 4, 2605112);
        return 1;
    }
    return 1;
}


public WarningMenu_Handler01(id, menu, item)
{
    if (item == -3)
    {
        menu_destroy(menu);
        return 1;
    }
    new data[6];
    new iName[64];
    new access = 0;
    new callback = 0;
    menu_item_getinfo(menu, item, access, data, "", iName, "", callback);
    Type_Index = str_to_num(data);
    WarningMenu02(id);
    return 1;
}


public WarningMenu02(id)
{
    new szLen[256];
    new szNum[33];
    new szName[33];
    format(szLen, "", 2605200, WarningName[Type_Index][0][0]);
    new menu = menu_create(szLen, "WarningMenu_Handler02", 0);
    get_players(PlayerNum[id][0][0], PlayerCount[id], "", "");
    new i = 0;
    while (PlayerCount[id][0][0] > i)
    {
        PlayerIndex = PlayerNum[id][0][0][i];
        get_user_name(PlayerIndex, szName, 32);
        format(szLen, "", "%s", szName);
        num_to_str(PlayerIndex, szNum, 32);
        menu_additem(menu, szLen, szNum, 0, -1);
        i++;
    }
    menu_setprop(menu, "", 1);
    menu_display(id, menu, 0);
    return 1;
}


public WarningMenu_Handler02(id, menu, item)
{
    if (item == -3)
    {
        menu_destroy(menu);
        return 1;
    }
    new data[6];
    new iName[64];
    new access = 0;
    new callback = 0;
    menu_item_getinfo(menu, item, access, data, "", iName, "", callback);
    Object_Index = str_to_num(data);
    Warning_Handler(id);
    return 1;
}


public Warning_Handler(id)
{
    new szName[33];
    get_user_name(Object_Index, szName, 32);
    set_hudmessage("", 0, 0, -1.00, 0.20, 0, 0, 5.00, 0.10, 0.20, 4);
    ShowSyncHudMsg(0, Warning_Msg, 2605544, szName, WarningName[Type_Index][0][0]);
    return 1;}


獻花 x0