廣告廣告
  加入我的最愛 設為首頁 風格修改
首頁 首尾
 手機版   訂閱   地圖  簡體 
您是第 1458 個閱讀者
 
發表文章 發表投票 回覆文章
  可列印版   加為IE收藏   收藏主題   上一主題 | 下一主題   
Alan.
個人頭像
個人文章 個人相簿 個人日記 個人地圖
小人物
級別: 小人物 該用戶目前不上站
推文 x41 鮮花 x31
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片
推文 x0
[1.6][插件] 修改sma問題~(本人新手)
本人是sma新手(努力中),大大如果要把這個只可以用刀的插件,改為用刀也可用手雷,煙霧彈和閃光彈,應該如何修改。


/****************************************************
 * AMX Mod X Script for Counter-Strike 1.6   *
 * by "SilverTide"         *
 * Knives Only          *
 * Version 0.1a          *
 * Email = miketomasello@gmail.com     *
 * http://warcraft...r.com      *
 *              *
 * Credits:           *
 *  Billythekid - I had to use his knifes only      *
 *                plugin as a reference.   *
 *             *
 * Admin Commands -         *
 * amx_knivesonly <1|0> (Default: 0)    *
 *  [ Enables or Disables knives only mode ]  *
 *              *
 * Client Commands-         *
 * say /voteknivesonly        *
 *  [ Starts a vote for knives only mode ]   *
 *              *
 *              *
 * PLUGIN DESCRIPTION : -----------------   *
 * Users will be forced to use knives    *
 * only, any other weapons will be     *
 * removed.           *
 *             *
 ****************************************************/
#include <amxmodx>
#include <amxmisc>
#include <fun>
new knifeonly = 0;
new choice[2];
new voteknivesonly[] = "\yKnives Only?\w^n^n1. On^n2. Off";
public plugin_init () {
 register_plugin ( "Knives Only", "0.1a", "SilverTide" );
 register_concmd ( "amx_knivesonly", "cmdknives_only", ADMIN_LEVEL_A, "- Turns on or off Knives Only." );
 register_concmd ( "amx_voteknivesonly", "cmdvoteknives_only", ADMIN_VOTE, "- Begins a vote to enable Knives Only." );
 register_concmd ( "say /voteknivesonly", "cmdvote", ADMIN_VOTE, "- Begins a vote to enable Knives Only." );
 register_menucmd ( register_menuid("\yKnives Only?"), (1<<0)|(1<<1), "count_votes" );
 register_event ( "CurWeapon", "knife", "b" );
}
public cmdknives_only ( id ) {
 new arg[2];
 read_argv ( 1, arg, 1 );
 set_hudmessage ( 200, 100, 0, -1.0, 0.25, 0, 1.0, 5.0, 0.1, 0.2, 2 );
 
 if ( equal ( arg, "1" ) ) {
  knifeonly = 1;
  client_cmd ( id, "weapon_knife" );
  console_print ( id, "Knives Only has been turned on." );
  show_hudmessage ( 0, "Knives Only has been turned on." );
 } else if ( equal ( arg, "0" ) ) {
  knifeonly = 0
  console_print ( id, "Knives Only has been turned off." );
  show_hudmessage ( 0, "Knives Only has been turned off." );
 } else {
  if ( knifeonly == 0 ){
   console_print ( id, "Usage: amx_knivesonly 1 = 0n 0 = off Currently: OFF" );
  }
  if ( knifeonly == 1 ){
   console_print ( id, "Usage: amx_knivesonly 1 = 0n 0 = off Currently: ON" );
  }
 }
 
 return PLUGIN_CONTINUE;
}
public knife ( id ) {
        if ( knifeonly == 0 ) {
            // Do Nothing;
        }
        if ( knifeonly == 1 ) {
            new clip, ammo;
            new usersweapon = get_user_weapon ( id, clip, ammo );
           
            if ( usersweapon == CSW_KNIFE ) {
                // Do Nothing
            } else {
    // Bury player and strip of weapons, then return to starting position
    new origin[3];
    get_user_origin ( id, origin );
    origin[2] -= 500;
    set_user_origin ( id, origin );
    new iwpn, iwpns[32], nwpn[32];
    get_user_weapons ( id, iwpns, iwpn );
    for ( new a = 0; a < iwpn; ++a ) {
     get_weaponname ( iwpns[a], nwpn, 31 );
     engclient_cmd ( id, "drop", nwpn );
    }
    new origin2[3];
    get_user_origin ( id, origin2 );
    origin2[2] += 500;
    set_user_origin ( id, origin2 );
    // Select the knife
    client_cmd ( id, "weapon_knife" );
            }
        }
        return PLUGIN_CONTINUE;
}
public cmdvote ( id ) {
    new Float:voting = get_cvar_float ( "amx_last_voting" );
    if ( voting > get_gametime () ) {
        client_print ( id, print_chat, "*A vote has already been cast.*" );
        return PLUGIN_HANDLED;
    }
    if ( voting && voting + get_cvar_float ( "amx_vote_delay" ) > get_gametime() ) {
        client_print ( id, print_chat, "*Please wait for a short while before you are able to vote again.*" );
        return PLUGIN_HANDLED;
    }
    new menu_msg[256];
    new name[32];
    format ( menu_msg, 255, voteknivesonly );
    new Float:votetime = get_cvar_float("amx_vote_time") + 10.0;
    get_user_info ( id, "name", name, 31 );
    set_cvar_float ( "amx_last_voting", get_gametime() + votetime );
    show_menu ( 0, (1<<0)|(1<<1), menu_msg, floatround ( votetime ) );
    set_hudmessage ( 200, 0, 0, 0.05, 0.65, 2, 0.02, 30.0, 0.03, 0.3, 2 );
  
    show_hudmessage ( 0, "%s has started the Vote for knivesonly", name );
    set_task ( votetime, "check_the_votes" );
    choice[0] = choice[1] = 0;
    return PLUGIN_HANDLED;
}
public cmdvoteknives_only ( id ) {
    new Float:voting = get_cvar_float ( "amx_last_voting" );
    if ( voting > get_gametime () ) {
        client_print ( id, print_chat, "*A vote has already been cast.*" );
        return PLUGIN_HANDLED;
    }
    if ( voting && voting + get_cvar_float( "amx_vote_delay" ) > get_gametime () ) {
        client_print ( id, print_chat, "*Please wait for a short while before you are able to vote again.*" );
        return PLUGIN_HANDLED;
    }
    new menu_msg[256];
    format ( menu_msg, 255, voteknivesonly );
    new Float:votetime = get_cvar_float ( "amx_vote_time" ) + 10.0;
    set_cvar_float ( "amx_last_voting", get_gametime() + votetime );
    show_menu ( 0, (1<<0)|(1<<1), menu_msg, floatround ( votetime ) );
    set_task ( votetime, "check_the_votes" );
    client_print ( 0, print_chat, "*Voting has started.*" );
    choice[0] = choice[1] = 0;
    return PLUGIN_HANDLED;
}
public count_votes ( id, key ) {
    if ( get_cvar_float ( "amx_vote_answers" ) ) {
        new name[32];
        get_user_name ( id, name, 31 );
        client_print ( 0, print_chat, "* %s voted %s", name, key ? "against knives only" : "for knives only" );
    }
    ++choice[key];
    return PLUGIN_HANDLED;
}
public check_the_votes ( id ) {
    if ( choice[0] > choice[1] ) {
        server_cmd ( "amx_knivesonly 1" );
        client_print ( 0, print_chat, "* Knives Only Mode has been voted on. (On ^"%d^") (Off ^"%d^"). *", choice[0], choice[1] );
    } else {
        server_cmd ( "amx_knivesonly 0" );
        client_print ( 0, print_chat, "* Knives Only Mode has been voted off. (On ^"%d^") (Off ^"%d^"). *", choice[0], choice[1] );
    }
    return PLUGIN_CONTINUE;
}


[ 此文章被☆孤獨x朱在2011-02-01 21:28重新編輯 ]



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

新手+1
為什麼我看不到有相關的內容是寫限用小刀的..
我看只有寫玩家每回合的血量改變
(還是我沒有看得懂= =
表情 表情


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

sorry~我放錯了sma= =


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

我而放回正確的sma了,sorry 放錯


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

先用新手的手法試試..
把if ( usersweapon == CSW_KNIFE )下面的else改成
else if (usersweapon != CSW_FLASHBANG || usersweapon != CSW_HEGRENADE || usersweapon != CSW_SMOKEGRENADE)
測試還有沒有限制用刀子..
和能否用手雷那些
表情 表情


獻花 x0 回到頂端 [4 樓] From:沒有資料 | Posted:2011-02-01 21:49 |

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