Commit 75616bd0 authored by Mikleo's avatar Mikleo

--

parent 04327fe4
......@@ -7,6 +7,7 @@
#include <emputils>
#undef REQUIRE_PLUGIN
#include <updater>
#include <SteamWorks>
#define PluginVersion "1.03"
......@@ -197,6 +198,9 @@ public void OnPluginStart()
AddCommandListener(Command_changelevel,"changelevel");
AddCommandListener(Command_Plugin_Version, "ef_version");
RegAdminCmd("sm_commandlog", Command_Command_Log, ADMFLAG_SLAY);
ef_disabletakedamage = CreateConVar("ef_disabletakedamage", "1", "disable using SDKHooks_TakeDamage, to deal with offset issues");
ef_editlock = CreateConVar("ef_editlock", "1", "prevent admins from edit map entities/resources/tickets after game has begun.");
ef_baseswap = CreateConVar("ef_baseswap", "0", "Enable Base Swapping");
......@@ -3766,7 +3770,7 @@ public Action Command_Scenario_Votelist(int client, int args)
// needs some solid values to actually save this.
kv.JumpToKey(arg2,true);
kv.SetNum("min_players",0);
kv.SetNum("max_players",64);
kv.SetNum("max_players",65);
kv.SetString("tags_override","-");
kv.SetString("description_override","-");
......@@ -4095,17 +4099,28 @@ bool LoadScenario(int client,char[] filename)
if(LibraryExists("SteamWorks"))
{
char description[64];
currentScenarioKV.GetString("Description",description,sizeof(description));
char mapName[128];
GetCurrentMap(mapName, sizeof(mapName));
Format(mapName,sizeof(mapName),"%s:%s \n%s",mapName,filename,description);
SteamWorks_SetMapName(mapName);
}
int scenarioBaseSwap = currentScenarioKV.GetNum("BaseSwap",-1);
if(ef_baseswap.IntValue == 1 && scenarioBaseSwap != 0 || (ef_baseswap.IntValue == 0 && scenarioBaseSwap > 0) )
{
DelayedBaseSwap();
}
}
int scenarioBaseSwap = currentScenarioKV.GetNum("BaseSwap",-1);
if(ef_baseswap.IntValue == 1 && scenarioBaseSwap != 0 || (ef_baseswap.IntValue == 0 && scenarioBaseSwap > 0) )
{
DelayedBaseSwap();
}
return succeeded;
}
......@@ -6655,6 +6670,30 @@ public void LoadEntData()
}
public Action Listener(int client, const String:command[], args)
{
new String:message[512] = "";
new String:arg[129];
for(int i = 0;i<=args;i++)
{
GetCmdArg(i, arg, sizeof(arg));
StrCat(message,sizeof(message),arg);
StrCat(message,sizeof(message)," ");
}
//ignore this one.
if(StrContains(message,"emp_comm_rot") == -1)
{
PrintToServer(message);
}
}
public Action Command_Command_Log(int client, int args)
{
AddCommandListener(Listener);
return Plugin_Handled;
}
......@@ -69,6 +69,8 @@ void Funcs_OnPluginStart()
AddCommand("Cancel",CancelCommand,100);
AddCommand("RunIf",RunIfCommand,6);
AddCommand("AddDamageFilter",AddDamageFilterCommand,100);
AddCommand("OnCommand",HookCommand,4);
AddCommand("PrintToTarget",PrintToTarget,1);
RegAdminCmd("sm_clearscripts", Command_Clear_Scripts, ADMFLAG_SLAY);
......@@ -653,9 +655,8 @@ public void OnOutput_Hook(const char[] output, int caller, int activator, float
{
commands.GetArray(i,commandTrack);
if(commandTrack.index != -1 && commandTrack.entRef == entRef && StrEqual(commandTrack.stringSlot1,output,false))
if(commandTrack.index != -1 && commandTrack.entRef == entRef && commandTrack.closeCommand == OnOutput_Close && StrEqual(commandTrack.stringSlot1,output,false))
{
ExecuteCommand(commandTrack);
int ent = commandTrack.entRef;
if(commandTrack.intSlot1 == 1)
ent = activator;
......@@ -751,6 +752,28 @@ public int ChatTextCommand(int entity,char[] args,char[] remainder)
return entity;
}
// prints to clients
public int PrintToTarget(int entity,char[] args,char[] remainder)
{
int client = EntRefToEntIndex(entity);
int argIndex;
char text[256];
BreakVariableArg(entity,args,text,sizeof(text),argIndex);
FormatChatTextMessage(text);
if(client >= 0 && client <= MaxClients)
{
if(IsClientInGame(client))
{
PrintToChat(client,text);
}
}
return entity;
}
public int HudTextCommand(int entity,char[] args,char[] remainder)
{
int argIndex;
......@@ -1285,6 +1308,102 @@ public Action:AddDamageFilter_OnTakeDamage(victim, &attacker, &inflictor, &Float
}
public int HookCommand(int entity,char[] args,char[] remainder)
{
// create a hook to a specific client command.
// parameter used to block the command.
int argIndex;
char commandString[64];
BreakArg(args,commandString,sizeof(commandString),argIndex);
char firstCommand[32];
int first = 0;
BreakArg(commandString,firstCommand,sizeof(firstCommand),first);
AddCommandListener(Command_OnCommandHook,firstCommand);
PrintToServer("hooking %s",commandString);
int handleCommand = 0;
char blockCommand[32];
BreakArg(args,blockCommand,sizeof(blockCommand),argIndex);
if(StrEqual(blockCommand,"Handle"))
{
handleCommand = 1;
}
// do a userIdentifier as well.
char userIdentifier[64];
BreakArg(args,userIdentifier,sizeof(userIdentifier),argIndex);
CreateCommand(entity,INVALID_HANDLE,OnCommand_Close,remainder,userIdentifier,commandString,handleCommand);
return -1;
}
// just block for now.
public Action Command_OnCommandHook(client, const String:command[], args)
{
char commandString[64];
GetCmdArg(0, commandString, sizeof(commandString));
char argString[128];
GetCmdArgString(argString, sizeof(argString));
Format(commandString,sizeof(commandString),"%s %s",commandString,argString);
bool isHandled = false;
CommandTrack commandTrack;
for(int i= 0;i<commands.Length;i++)
{
commands.GetArray(i,commandTrack);
if(commandTrack.index != -1 && commandTrack.closeCommand == OnCommand_Close && StrContains(commandString,commandTrack.stringSlot1,false) != -1)
{
// run as client by default by now
RunEntityFunctionInternal(client,commandTrack.remainder);
isHandled = true;
}
}
if(isHandled)
return Plugin_Handled;
else
return Plugin_Continue;
}
void OnCommand_Close(int commandID)
{
CommandTrack commandTrack;
commands.GetArray(commandID,commandTrack);
// remove the command listener for the first command. maybe check if there are any more with this in the future. Would be buggy right now
char firstCommand[32];
int first = 0;
BreakArg(commandTrack.stringSlot1,firstCommand,sizeof(firstCommand),first);
// only remove the listener if we are the last one with this identifier.
bool remove = true;
for(int i= 0;i<commands.Length;i++)
{
commands.GetArray(i,commandTrack);
if(commandTrack.index != -1 && commandTrack.closeCommand == OnCommand_Close && StrContains(commandTrack.stringSlot1,firstCommand,false) != -1)
{
remove = false;
}
}
if(remove)
RemoveCommandListener(Command_OnCommandHook,firstCommand);
}
void WritePackVector(DataPack dataPack,float[3] vector)
{
WritePackFloat(dataPack,vector[0]);
......
......@@ -6,12 +6,13 @@
"BE_Tickets" "402.000000"
"Scripts"
{
"OnScenarioLoaded" "Run Introduction Introduction2 Setup"
"OnScenarioLoaded" "Run Introduction Introduction2 Setup BlockArty"
"Introduction" "After 60 -> ChatText *Gen. Strickland:TXTCLR_DF Listen up, the artifact in the ruins will provide us an enormous technological advantage in the war to come* *Gen. Mendez:TXTCLR_DF Intel has detected an artifact in the south east ruins with enormous strategic value* **"
"Introduction2" "After 65 -> ChatText *Gen. Strickland:TXTCLR_DF Our objective is clear, defend the artifact at any cost.* *Gen. Mendez:TXTCLR_DF Our objective is clear, destroy the artifact at any cost.* **"
"Setup" "TargetName artifact -> AddDamageFilter NoTeamDamage -> Run ObjectiveTimer DestroyTrigger"
"ObjectiveTimer" "TextTimer 1200 *Defend The Artifact\TIME_LEFT $[m_iHealth]HP* *Destroy The Artifact\TIME_LEFT $[m_iHealth]HP* -> TargetParams -> Input InputNFWin 0 EndActivator"
"DestroyTrigger" "OnOutput OnBreak -> TargetParams -> Input InputImpWin 0 EndActivator"
"BlockArty" "OnCommand *emp_comm_research 34* Handle -> PrintToTarget *Artillery tanks are disabled in this scenario*"
"OnGameStart" "Run Warning AirStrikeExec1 AirStrikeExec2 SmartIdeas AirStrikeExec3"
"Warning" "After 400 -> ChatText *Gen. Strickland:TXTCLR_DF Intel has revealed that the enemy are planning airstrikes on key buildings at our location. Don't take any defences for granted!* *Gen. Mendez:TXTCLR_DF Be alert, We have allied bombers in the area which will deliver precision airstrikes on enemy targets* **"
"AirStrikeExec1" "After 600 -> TargetClassname emp_building_radar 2-> Run AircraftEffect -> TakeDamage 500 -> After 2 -> Run AirStrikeNotice1 "
......@@ -26,7 +27,7 @@
"AircraftDownEffect" "EmitSound *npc/combine_gunship/gunship_explode2.wav*"
}
"Description" "Destroy/Defend the artifact in 20 minutes"
"details" "A timer will appear when the game starts."
"details" "A timer will appear when the game starts.\Artillery tank research disabled"
"Tags" "Mission"
"version" "0.970000"
"hLimit" "172105"
......
......@@ -15,7 +15,7 @@
"funcs"
{
"type" "string"
"prop" "m_iszDamageFilterName"
"prop" "m_iszResponseContext"
"propType" "data"
"defaultValue" ""
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment