Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
empfun
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
External Wiki
External Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sourcemod
empfun
Commits
6598f7d6
Commit
6598f7d6
authored
Oct 14, 2020
by
Mikleo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.25
parent
222f24f4
Pipeline
#11303
passed with stages
in 18 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
122 additions
and
12 deletions
+122
-12
dist/addons/sourcemod/plugins/empfun.smx
dist/addons/sourcemod/plugins/empfun.smx
+0
-0
dist/addons/sourcemod/scripting/empfun.sp
dist/addons/sourcemod/scripting/empfun.sp
+46
-6
dist/addons/sourcemod/scripting/empfun/funcs.sp
dist/addons/sourcemod/scripting/empfun/funcs.sp
+75
-5
dist/updater.txt
dist/updater.txt
+1
-1
No files found.
dist/addons/sourcemod/plugins/empfun.smx
View file @
6598f7d6
No preview for this file type
dist/addons/sourcemod/scripting/empfun.sp
View file @
6598f7d6
...
...
@@ -10,7 +10,7 @@
#include <SteamWorks>
#define PluginVersion "1.2
4
"
#define PluginVersion "1.2
5
"
float pVersion;
// note linearmap field is unstable
...
...
@@ -382,6 +382,8 @@ public OnMapStart()
PrecacheSound("weapons/mortar/mortar_explode2.wav");
// some maps don't precache this, is essential
PrecacheModel("models/nf/buildings/armory/nf_armory.mdl", true);
latestKnownMapEntity = 0;
Funcs_OnMapStart();
...
...
@@ -4142,10 +4144,10 @@ bool LoadScenario(int client,char[] filename)
LoadCvars(kv);
int hLimit = kv.GetNum("hLimit",BASEHAMMERID -1 );
int hMin = kv.GetNum("hMin",
0
);
int hMin = kv.GetNum("hMin",
-1
);
int hMax = kv.GetNum("hMax",
0
);
if(hMax > 0)
int hMax = kv.GetNum("hMax",
-1
);
if(hMax >
=
0)
hLimit = hMax;
...
...
@@ -4418,10 +4420,14 @@ LoadEntities(KeyValues kv,float version,int hMin,int hLimit)
entity = RestoreEntity(entity,kv,classInfo,className);
// restore back hammer id
SetEntProp(entity,Prop_Data,"m_iHammerID",hammer_id);
if(entity != -1)
{
// restore back hammer id
SetEntProp(entity,Prop_Data,"m_iHammerID",hammer_id);
includedEntities.Push(entity);
}
}
} while (kv.GotoNextKey(false));
...
...
@@ -4669,6 +4675,13 @@ RestoreEntity(int entity,KeyValues kv,any[] classInfo ,char[] className)
if(isNew )
{
if(!hasPosition)
{
// position isnt optional for entities that are new.
// therefore you can strip fields and if the entity is removed by a mapper it won't be reloaded.
return -1;
}
if(StrEqual(className,"emp_vehicle",true))
{
...
...
@@ -5411,6 +5424,19 @@ LoadMetaData(KeyValues kv)
}
float GetResources(int team)
{
if(team == 2)
{
return GetEntPropFloat(NFTeamEntity,Prop_Send,"resource_balance");
}
else if(team == 3)
{
return GetEntPropFloat(BETeamEntity,Prop_Send,"resource_balance");
}
return 0.0;
}
// hack for now;
SetResources(int team,float amount)
{
...
...
@@ -5426,6 +5452,20 @@ SetResources(int team,float amount)
AcceptEntityInput(paramEntity,"ModifyBEResources",paramEntity,paramEntity);
}
}
float GetTickets(int team)
{
if(team == 2)
{
return GetEntPropFloat(NFTeamEntity,Prop_Send,"tickets_balance");
}
else if(team == 3)
{
return GetEntPropFloat(BETeamEntity,Prop_Send,"tickets_balance");
}
return 0.0;
}
SetTickets(int team,float amount)
{
int paramEntity = EU_ParamEntity();
...
...
dist/addons/sourcemod/scripting/empfun/funcs.sp
View file @
6598f7d6
...
...
@@ -1110,6 +1110,14 @@ public int SetVariable(int entity,char[] mArgs,char[] remainder)
// set the local variable here.
SetScriptVariable(variableName,valueToSet);
}
else if(offset == -3)
{
if(type == PropField_Integer)
{
int value = StringToInt(valueToSet);
GlobalVariableInt(variableName[1],value,true);
}
}
else
{
// setting values
...
...
@@ -1806,17 +1814,56 @@ void ReadPackVector(DataPack dataPack,float[3] vector)
vector[2] = ReadPackFloat(dataPack);
}
// TODO
bool GetGlobalVariableInt(char[] variable, int &value)
bool GlobalVariableInt(char[] variable, int &value, bool set = false)
{
if(StrEqual(variable,"g_int_clients_in_server",false))
{
// return the playercount
value = GetClientCount(true);
return true;
}
else if(StrEqual(variable,"g_int_clients_in_teams",false))
{
value = GetTeamClientCount(2) + GetTeamClientCount(3);
return true;
// return the playercount in teams.
}
else if(StrEqual(variable,"g_int_tickets_nf",false))
{
if(set)
SetTickets(2,float(value));
else
value = RoundFloat(GetTickets(2));
return true;
}
else if(StrEqual(variable,"g_int_tickets_be",false))
{
if(set)
SetTickets(3,float(value));
else
value = RoundFloat(GetTickets(3));
return true;
}
else if(StrEqual(variable,"g_int_resources_nf",false))
{
if(set)
SetResources(2,float(value));
else
value = RoundFloat(GetResources(2));
return true;
}
else if(StrEqual(variable,"g_int_resources_be",false))
{
if(set)
SetResources(3,float(value));
else
value = RoundFloat(GetResources(3));
return true;
}
return false;
}
...
...
@@ -1841,9 +1888,20 @@ int FindPropOffset(int entRef,char[] variableName, PropType &propType, PropField
}
else if(StringBegins(variableName, "g_"))
{
if(StringBegins(variableName, "g_
int
"))
if(StringBegins(variableName, "g_
float_
"))
{
type = PropField_Float;
return -3;
}
else if(StringBegins(variableName, "g_int_"))
{
type = PropField_Integer;
return -3;
}
else if(StringBegins(variableName, "g_string_"))
{
type = PropField_String;
return -3;
}
}
...
...
@@ -1942,6 +2000,18 @@ ReplaceVariables(int entRef,char[] message,int messageSize)
ReplaceStringEx(message, messageSize,stringToReplace,outputValue,size,-1);
}
if(offset == -3)
{
if(type == PropField_Integer)
{
int value;
if(GlobalVariableInt(variable,value))
{
IntToString(value,outputValue,sizeof(outputValue));
ReplaceStringEx(message, messageSize,stringToReplace,outputValue,size,-1);
}
}
}
else if(offset != -1)
{
...
...
dist/updater.txt
View file @
6598f7d6
...
...
@@ -4,7 +4,7 @@
{
"Version"
{
"Latest" "1.2
4
"
"Latest" "1.2
5
"
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment