發新話題
打印

sp 求教

[Close]

sp 求教

我想問有無人知點 check d 在線 player 係咪入左 safe room (check point 過關那個, 唔係一開始個 room)?
好似下面就係 check player 係咪在線/alive
if (IsClientConnected(i) && IsClientInGame(i) && !IsFakeClient(i))
咁 check player 入左 saferoom 又係點寫??

TOP

U wanna to ask sp or Cmd?!

TOP

sp 或者 提供個參數
如 IsClientEnterCheckPoint()
有無哩一句?

因為我想寫一個插件係如果有第一個人進入左check point 安全室,
就會啟動倒數計時器, 指定時限內要其他所有玩家都進入安全室,
否則還沒進入安全室者會被 kill

[ 本帖最後由 vleun 於 2010-5-29 15:49 編輯 ]

TOP

引用:
原帖由 vleun 於 2010-5-29 15:19 發表
sp 或者 提供個參數
如 IsClientEnterCheckPoint()
有無哩一句?

因為我想寫一個插件係如果有第一個人進入左check point 安全室,
就會啟動倒數計時器, 指定時限內要其他所有玩家都進入安全室,
否則還沒進入安全室者 ...
咁你開邊個 sp 檔??

內建檔案本身無你講既野, 估計要下載插件!

TOP

用左3個字幫你寫左個
自己拎去compile

#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <sdktools_functions>
#include <adminmenu>

#define PLUGIN_VERSION "0.0.1"
        
new bool:IsClientEnterCheckPoint[MAXPLAYERS+1];


public Plugin:myinfo =
{
        name = "Check Saferoom Player",
        author = "LazyCat",
        description = "",
        version = PLUGIN_VERSION,
        url = ""
};



public OnPluginStart()
{
        HookEvent("player_entered_checkpoint",Event_PlayerEnteredCheckpoint);
        HookEvent("player_left_checkpoint",Event_PlayerLeftCheckpoint);
        new maxClients = GetMaxClients();
        for (new i = 1; i <= maxClients; i++)
        {
                IsClientEnterCheckPoint = false;
        }
        RegConsoleCmd("sm_checkpt", CheckPointState);
}

public Action:Event_PlayerEnteredCheckpoint(Handle:event, const String:name[], bool:dontBroadcast)
{
        new client = GetClientOfUserId(GetEventInt(event, "userid"));
        if(client!=0 && IsClientInGame(client) && IsPlayerAlive(client) && GetClientTeam(client) == 2)
        {
                IsClientEnterCheckPoint[client] = true;
        }
}

public Action:Event_PlayerLeftCheckpoint(Handle:event, const String:name[], bool:dontBroadcast)
{
        new client = GetClientOfUserId(GetEventInt(event, "userid"));
        if(client!=0 && IsClientInGame(client) && IsPlayerAlive(client) && GetClientTeam(client) == 2)
        {
                IsClientEnterCheckPoint[client] = false;
        }
}

public Action:CheckPointState(client,args)
{
        CheckPointPanel(client);
}

public Action:CheckPointPanel(client)
{
        new Handle:panel = CreatePanel();
        SetPanelTitle(panel, "CheckPoint名單:");
        DrawPanelText(panel, "================");
        new maxClients = GetMaxClients();
        for (new i = 1; i <= maxClients; i++)
        {
                if(IsClientEnterCheckPoint)
                {
                        decl String: name[128];
                        Format(name,sizeof(name),"%N", i);
                        DrawPanelText(panel, name);
                }
        }
        DrawPanelText(panel, "================");
        DrawPanelItem(panel, "取消");

        SendPanelToClient(panel, client, PanelContent, 30);
        CloseHandle(panel);
}


public PanelContent(Handle:menu, MenuAction:action, param1, param2)
{
        if (action == MenuAction_Select) { switch (param2) { case 1:{} } }
}


[ 本帖最後由 leo221094 於 2010-5-31 00:38 編輯 ]

TOP

thx Q it's useful for me.

TOP

引用:
原帖由 leo221094 於 2010-5-31 00:36 發表
用左3個字幫你寫左個
自己拎去compile

#pragma semicolon 1
#include
#include
#include
#include

#define PLUGIN_VERSION "0.0.1"
        
new bool:IsClientEnterCheckPoint[MAXPLAYERS+1];


public Plugi ...
3個字寫到咁快@_@"

TOP

改少少
加番個過版人名清零先

#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <sdktools_functions>
#include <adminmenu>

#define PLUGIN_VERSION "0.0.1"
       
new bool:IsClientEnterCheckPoint[MAXPLAYERS+1];


public Plugin:myinfo =
{
        name = "Check Saferoom Player",
        author = "LazyCat",
        description = "",
        version = PLUGIN_VERSION,
        url = ""
};



public OnPluginStart()
{
        HookEvent("player_entered_checkpoint",Event_PlayerEnteredCheckpoint);
        HookEvent("player_left_checkpoint",Event_PlayerLeftCheckpoint);
        HookEvent("map_transition", Event_Maptransition, EventHookMode_PostNoCopy);
        new maxClients = GetMaxClients();
        for (new i = 1; i <= maxClients; i++)
        {
                IsClientEnterCheckPoint = false;
        }
        RegConsoleCmd("sm_checkpt", CheckPointState);
}

public Action:Event_PlayerEnteredCheckpoint(Handle:event, const String:name[], bool:dontBroadcast)
{
        new client = GetClientOfUserId(GetEventInt(event, "userid"));
        if(client!=0 && IsClientInGame(client) && IsPlayerAlive(client) && GetClientTeam(client) == 2)
        {
                IsClientEnterCheckPoint[client] = true;
        }
}

public Action:Event_PlayerLeftCheckpoint(Handle:event, const String:name[], bool:dontBroadcast)
{
        new client = GetClientOfUserId(GetEventInt(event, "userid"));
        if(client!=0 && IsClientInGame(client) && IsPlayerAlive(client) && GetClientTeam(client) == 2)
        {
                IsClientEnterCheckPoint[client] = false;
        }
}

public Action:Event_Maptransition(Handle:event, const String:name[], bool:dontBroadcast)
{
        new maxClients = GetMaxClients();
        for (new i = 1; i <= maxClients; i++)
        {
                IsClientEnterCheckPoint = false;
        }
}

public Action:CheckPointState(client,args)
{
        CheckPointPanel(client);
}

public Action:CheckPointPanel(client)
{
        new Handle:panel = CreatePanel();
        SetPanelTitle(panel, "CheckPoint名單:");
        DrawPanelText(panel, "================");
        new maxClients = GetMaxClients();
        for (new i = 1; i <= maxClients; i++)
        {
                if(IsClientEnterCheckPoint)
                {
                        decl String: name[128];
                        Format(name,sizeof(name),"%N", i);
                        DrawPanelText(panel, name);
                }
        }
        DrawPanelText(panel, "================");
        DrawPanelItem(panel, "取消");

        SendPanelToClient(panel, client, PanelContent, 30);
        CloseHandle(panel);
}


public PanelContent(Handle:menu, MenuAction:action, param1, param2)
{
        if (action == MenuAction_Select) { switch (param2) { case 1:{} } }
}

TOP

引用:
/groups/sourcemod/upload_tmp/textuhBhb0.sp(31) : error 033: array must be indexed (variable "IsClientEnterCheckPoint")
/groups/sourcemod/upload_tmp/textuhBhb0.sp(59) : error 033: array must be indexed (variable "IsClientEnterCheckPoint")
/groups/sourcemod/upload_tmp/textuhBhb0.sp(76) : error 033: array must be indexed (variable "IsClientEnterCheckPoint")

3 Errors.
轉唔到做SMX檔..

TOP

引用:
原帖由 天羽‧耀洋 於 2010-6-4 18:16 發表


轉唔到做SMX檔..
你開個txt file改副檔名做.sp
再copy段code入去
save
then將個sp拉去compile度佢就識compile
個output smx file會係compiled度

TOP

唔係leo 既碼錯, 原來係貼子的錯...前有  for (new i = 1; i <= maxClients; i++) 接著的請改為   IsClientEnterCheckPoint[i]

[[i] 本帖最後由 vleun 於 2010-6-5 17:12 編輯 [/i]]

TOP

發新話題