發新話題
打印

修改藥包問題((尋求插件))

[Close]
doubleitems個sp檔黎?
如果係doubleitems黎
就冇得改
要另外寫插件

TOP

身上冇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;
            }
        }
    }  
  
}

TOP

應該少左句#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.

TOP

我錯了=_=
weapon_first_aid_kit_spawn改做weapon_first_aid_kit

TOP

有咩錯COPY睇睇

TOP

複製內容到剪貼板
代碼:
#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;
            }
        }
    }  
  
}

TOP

用咩參數可以用= = ?

TOP

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


AcceptEntityInput(i, "Kill");

TOP

重新汁過曬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);
                        }
                }
        }  

        }

TOP

= =點解會仲有包嫁
我自己試下先

TOP

攪店了
抄番之前寫過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;
}
}
}
}
附件: 您所在的用戶組無法下載或查看附件

TOP

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

TOP

發新話題