發新話題
打印

sp 求教

[Close]
用左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

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

#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

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


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

TOP

發新話題