Board logo

標題: 修改藥包問題((尋求插件)) [打印本頁]

作者: 風行天    時間: 2011-2-18 08:38     標題: 修改藥包問題((尋求插件))

// update fixed item spawn counts to handle 8 players
        // These only update item spawns found in starting area/saferooms
        UpdateEntCount("weapon_pumpshotgun_spawn","12"); // defaults 4/5
        UpdateEntCount("weapon_smg_spawn", "127"); // defaults 4/5
        UpdateEntCount("weapon_rifle_spawn", "12"); // defaults 4/5
        UpdateEntCount("weapon_hunting_rifle_spawn", "12"); // default 4/5
        UpdateEntCount("weapon_autoshotgun_spawn", "12"); // default 4/5
        UpdateEntCount("weapon_first_aid_kit_spawn", "8"); // default 1
我想要藥包變成藥罐 跟沒有電擊器的插件

[ 本帖最後由 風行天 於 2011-2-25 10:19 編輯 ]
作者: apple_W    時間: 2011-2-18 13:14

doubleitems個sp檔黎?
如果係doubleitems黎
就冇得改
要另外寫插件
作者: 風行天    時間: 2011-2-18 14:10

是SP黨 如果是要另外寫插件的話 是要怎麼寫啊??
l4d2_mult-items_for_lxd 我是用這個黨
作者: leo221094    時間: 2011-2-20 13:42

藥包取代方法:
先用FindEntityByClassname搵出藥包既ent
之後有2個方法
1. 將呢個ent 既classname改做 pills既
2. 先以呢個ent用GetEntPropVector搵出ent既position
    跟住remove呢個ent,再於之前搵出既position重新DispatchSpawn番個pills出黎

至於電擊器消滅方法:
我直接copy以前寫出黎既copy比你好了
        new ent = -1;
        new prev = 0;
        while ((ent = FindEntityByClassname(ent, "weapon_defibrillator_spawn")) != -1)
        {
                if (prev) RemoveEdict(prev);
                prev = ent;
        }
        if (prev) RemoveEdict(prev);
       
        ent = -1;
        prev = 0;
        while ((ent = FindEntityByClassname(ent, "weapon_defibrillator")) != -1)
        {
                if (prev) RemoveEdict(prev);
                prev = ent;
        }
        if (prev) RemoveEdict(prev);


希望幫到你吧, 好耐冇掂過寫code了, 你努力吧
作者: 風行天    時間: 2011-2-25 10:17

可以直接轉成SMX黨給我嗎= =

我看不懂怎麼用欸-0.-
作者: apple_W    時間: 2011-2-25 12:59

身上冇notepad冋sourcemod
亂打
複製內容到剪貼板
代碼:

#include <sourcemod>
public OnPluginStart()
{
HookEvent("round_start", Event_RoundStart);
}
public Action:Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
new ent = -1;
        new prev = 0;
        while ((ent = FindEntityByClassname(ent, "weapon_defibrillator_spawn")) != -1)
        {
                if (prev) RemoveEdict(prev);
                prev = ent;
        }
        if (prev) RemoveEdict(prev);
        
        ent = -1;
        prev = 0;
        while ((ent = FindEntityByClassname(ent, "weapon_defibrillator")) != -1)
        {
                if (prev) RemoveEdict(prev);
                prev = ent;
        }
        if (prev) RemoveEdict(prev);
  
    new EntCount = GetEntityCount();
    new String:EdictName[128];
    for (new i = 0; i <= EntCount; i++)
    {
        if (IsValidEntity(i))
        {
            GetEdictClassname(i, EdictName, sizeof(EdictName));
            if (StrContains(EdictName, "weapon_first_aid_kit_spawn", false) != -1)
            {
    new Float:pos[3];
    GetEntPropVector(i, Prop_Send, "m_vecOrigin", pos);
                RemoveEdict(i);
    new pills = CreateEntityByName("weapon_pills_spawn");
    TeleportEntity(pills,pos,NULL_VECTOR,NULL_VECTOR);
    DispatchSpawn(pills);
                continue;
            }
        }
    }  
  
}

作者: 風行天    時間: 2011-2-25 19:09     標題: 程式碼有錯欸

程式碼有錯欸程式碼有錯欸程式碼有錯欸
作者: apple_W    時間: 2011-2-26 00:12

應該少左句#include <sdktools>
複製內容到剪貼板
代碼:
test.sp(9) : warning 217: loose indentation
test.sp(10) : error 017: undefined symbol "FindEntityByClassname"
test.sp(19) : error 017: undefined symbol "FindEntityByClassname"
test.sp(26) : warning 217: loose indentation
test.sp(37) : warning 217: loose indentation
test.sp(38) : warning 217: loose indentation
test.sp(38) : error 017: undefined symbol "CreateEntityByName"
test.sp(39) : error 017: undefined symbol "TeleportEntity"
test.sp(40) : error 017: undefined symbol "DispatchSpawn"
test.sp(41) : warning 217: loose indentation
test.sp(38) : warning 204: symbol is assigned a value that is never used: "pills"

5 Errors.

作者: 風行天    時間: 2011-2-26 08:22

程式碼是沒錯了 但是還是有補包阿ˊˋ
作者: apple_W    時間: 2011-2-26 11:54

我錯了=_=
weapon_first_aid_kit_spawn改做weapon_first_aid_kit
作者: 風行天    時間: 2011-2-26 13:33

改那句之後 就變成程式碼有錯誤了= =
作者: apple_W    時間: 2011-2-26 15:24

有咩錯COPY睇睇
作者: 風行天    時間: 2011-2-26 15:26

不然你重新COPY一次給我.....
作者: apple_W    時間: 2011-2-26 17:41

複製內容到剪貼板
代碼:
#include <sourcemod>
#include <sdktools>
public OnPluginStart()
{
HookEvent("round_start", Event_RoundStart);
}
public Action:Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
new ent = -1;
        new prev = 0;
        while ((ent = FindEntityByClassname(ent, "weapon_defibrillator_spawn")) != -1)
        {
                if (prev) RemoveEdict(prev);
                prev = ent;
        }
        if (prev) RemoveEdict(prev);
        
        ent = -1;
        prev = 0;
        while ((ent = FindEntityByClassname(ent, "weapon_defibrillator")) != -1)
        {
                if (prev) RemoveEdict(prev);
                prev = ent;
        }
        if (prev) RemoveEdict(prev);
  
    new EntCount = GetEntityCount();
    new String:EdictName[128];
    for (new i = 0; i <= EntCount; i++)
    {
        if (IsValidEntity(i))
        {
            GetEdictClassname(i, EdictName, sizeof(EdictName));
            if (StrContains(EdictName, "weapon_first_aid_kit", false) != -1)
            {
    new Float:pos[3];
    GetEntPropVector(i, Prop_Send, "m_vecOrigin", pos);
                RemoveEdict(i);
    new pills = CreateEntityByName("weapon_pills_spawn");
    TeleportEntity(pills,pos,NULL_VECTOR,NULL_VECTOR);
    DispatchSpawn(pills);
                continue;
            }
        }
    }  
  
}

作者: gordon7803    時間: 2011-2-26 18:52

用參數仲好
作者: apple_W    時間: 2011-2-26 20:31

用咩參數可以用= = ?
作者: 風行天    時間: 2011-2-26 20:59

還是不行 雖然可以轉乘SMX黨 但是一開始還是有補包沒有變成藥罐ˊˋ
作者: hihi1210    時間: 2011-2-26 21:46

if (StrContains(EdictName, "weapon_first_aid_kit", false) != -1)
>>>>>
if (StrContains(EdictName, "weapon_first_aid_kit_spawn", false) != -1)


Create   _spawn 既野有得 set 攞既 limit 吧

[ 本帖最後由 hihi1210 於 2011-2-26 21:48 編輯 ]
作者: 風行天    時間: 2011-2-26 22:15

if (StrContains(EdictName, "weapon_first_aid_kit_spawn", false) != -1)
是加在
if (StrContains(EdictName, "weapon_first_aid_kit", false) != -1)
下面??

就變成
if (StrContains(EdictName, "weapon_first_aid_kit", false) != -1)
if (StrContains(EdictName, "weapon_first_aid_kit_spawn", false) != -1)
??
可是這樣還是有包欸= =
作者: apple_W    時間: 2011-2-26 23:11

if (StrContains(EdictName, "weapon_first_aid_kit_spawn", false) != -1)
咪同一開始果個一樣
試下係RemoveEdict(i);前面加


AcceptEntityInput(i, "Kill");
作者: 風行天    時間: 2011-2-27 08:52

可以麻煩你重新複製一次給我嗎-.-......
作者: hihi1210    時間: 2011-2-27 20:50

why not use confogl directly?
作者: 風行天    時間: 2011-3-5 09:43

#include <sourcemod>
#include <sdktools>
public OnPluginStart()
{
HookEvent("round_start", Event_RoundStart);
}
public Action:Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
new ent = -1;
        new prev = 0;
        while ((ent = FindEntityByClassname(ent, "weapon_defibrillator_spawn")) != -1)
        {
                if (prev) RemoveEdict(prev);
                prev = ent;
        }
        if (prev) RemoveEdict(prev);
        
        ent = -1;
        prev = 0;
        while ((ent = FindEntityByClassname(ent, "weapon_defibrillator")) != -1)
        {
                if (prev) RemoveEdict(prev);
                prev = ent;
        }
        if (prev) RemoveEdict(prev);
  
    new EntCount = GetEntityCount();
    new String:EdictName[128];
    for (new i = 0; i <= EntCount; i++)
    {
        if (IsValidEntity(i))
        {
            GetEdictClassname(i, EdictName, sizeof(EdictName));
            if (StrContains(EdictName, "weapon_first_aid_kit", false) != -1)
                        if (StrContains(EdictName, "weapon_first_aid_kit_spawn", false) != -1)
            {
    new Float:pos[3];
    GetEntPropVector(i, Prop_Send, "m_vecOrigin", pos);
                RemoveEdict(i);
    new pills = CreateEntityByName("weapon_pills_spawn");
    TeleportEntity(pills,pos,NULL_VECTOR,NULL_VECTOR);
    DispatchSpawn(pills);
                continue;
            }
        }
    }  
  
}
AcceptEntityInput(i, "Kill");是要在加哪個RemoveEdict(i);的前面
作者: apple_W    時間: 2011-3-6 00:22

重新汁過曬D CODE
複製內容到剪貼板
代碼:
#include <sourcemod>
#include <sdktools>
public OnPluginStart()
{
HookEvent("round_start", Event_RoundStart);
}
public Action:Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
        new EntCount = GetEntityCount();
        new String:EdictName[128];
        for (new i = 0; i <= EntCount; i++)
        {
                if (IsValidEntity(i))
                {
                        GetEdictClassname(i, EdictName, sizeof(EdictName));
                        if (StrContains(EdictName, "weapon_defibrillator", false) != -1)
                        RemoveEdict(i);
                        if (StrContains(EdictName, "weapon_first_aid_kit_spawn", false) != -1)
                        {
                                new Float:pos[3];
                                GetEntPropVector(i, Prop_Send, "m_vecOrigin", pos);
                                RemoveEdict(i);
                                new pills = CreateEntityByName("weapon_pain_pills_spawn");
                                DispatchSpawn(pills);
                                TeleportEntity(pills,pos,NULL_VECTOR,NULL_VECTOR);
                        }
                }
        }  

        }

作者: 風行天    時間: 2011-3-8 15:16

還是有包欸..................
作者: alienenllon    時間: 2011-3-8 23:52

why not you don_t use confogl directly x2
google serch就搞掂
作者: apple_W    時間: 2011-3-9 00:35

= =點解會仲有包嫁
我自己試下先
作者: apple_W    時間: 2011-3-9 01:06

攪店了
抄番之前寫過D CODE- -
複製內容到剪貼板
代碼:

#include <sourcemod>
#include <sdktools>
public OnPluginStart()
{
HookEvent("round_start", Event_RoundStart);
}
public Action:Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
Spawnpills()
}
Spawnpills()
{
new EntCount = GetEntityCount();
new String:EdictName[128];
for (new i = 0; i<=EntCount; i++)
{
if (IsValidEntity(i))
{
GetEdictClassname(i,EdictName,128);


if(StrContains(EdictName, "weapon_pipe_bomb", false) != -1||StrContains(EdictName, "weapon_molotov", false) != -1 ||StrContains(EdictName, "weapon_vomitjar", false) != -1 ||StrContains(EdictName, "weapon_first_aid_kit", false) != -1 ||StrContains(EdictName, "weapon_defibrillator", false) != -1||(StrContains(EdictName, "weapon_upgradepack_explosive", false) != -1) || (StrContains(EdictName, "weapon_upgradepack_incendiary", false) != -1))
{
if(StrContains(EdictName, "weapon_first_aid_kit", false) != -1)
{
new index = CreateEntityByName("weapon_pain_pills_spawn");
new Float:Location[3];
GetEntPropVector(i, Prop_Send, "m_vecOrigin", Location);
if(index != -1)
{
new Float:Angle[3];
GetEntPropVector(i, Prop_Send, "m_angRotation", Angle);
TeleportEntity(index, Location, Angle, NULL_VECTOR);
DispatchSpawn(index);
}
}
if(GetRandomInt(1,2)==1)
{
new index = CreateEntityByName("weapon_pain_pills_spawn");
new Float:Location[3];
GetEntPropVector(i, Prop_Send, "m_vecOrigin", Location);
if(index != -1)
{
new Float:Angle[3];
GetEntPropVector(i, Prop_Send, "m_angRotation", Angle);
TeleportEntity(index, Location, Angle, NULL_VECTOR);
DispatchSpawn(index);
}
}
AcceptEntityInput(i, "Kill");
continue;
}
}
}
}

作者: 風行天    時間: 2011-3-9 20:24

我丟進去 會彈GAME欸
作者: apple_W    時間: 2011-3-10 01:12

但係我無問題喎- -
我無彈GAME




歡迎光臨 IPvE vLan 遊戲平台|網吧系統 (https://www.ipve.com/bbs/) Powered by Discuz! 6.0.0