remove trailing whitespaces from sourcecode
This commit is contained in:
@ -56,12 +56,12 @@ enum VolTypeAnticamp
|
||||
bool:Anticamp_InUse, /** Specifies if the data index is used or not. */
|
||||
Float:Anticamp_Interval, /** How often to trigger an action. */
|
||||
Handle:Anticamp_Timer, /** Action timer handle. */
|
||||
|
||||
|
||||
VolAnticampAction:Anticamp_Action, /** What to do with players in anti-camp volumes */
|
||||
Float:Anticamp_Amount, /** Amount depending on action type. Usually time in seconds or damage amount. */
|
||||
|
||||
|
||||
VolAnticampeWarningType:Anticamp_Warning, /** How to warn the player. */
|
||||
String:Anticamp_Message[256] /** Override warning message. Max 256 characters. */
|
||||
String:Anticamp_Message[256] /** Override warning message. Max 256 characters. */
|
||||
}
|
||||
|
||||
/**
|
||||
@ -72,28 +72,28 @@ new AnticampData[ZR_VOLUMES_MAX][VolTypeAnticamp];
|
||||
/**
|
||||
* Event callback. Enables a anticamp volume.
|
||||
*
|
||||
* @param volumeIndex The volume index.
|
||||
* @param volumeIndex The volume index.
|
||||
*/
|
||||
VolAnticampEnable(volumeIndex)
|
||||
{
|
||||
new Float:interval;
|
||||
new Handle:timer;
|
||||
|
||||
|
||||
// Validate index.
|
||||
if (!VolIsValidIndex(volumeIndex))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Get data index.
|
||||
new dataindex = Volumes[volumeIndex][Vol_DataIndex];
|
||||
|
||||
|
||||
// Validate data index.
|
||||
if (!VolAnticampValidateIndex(dataindex))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Check if in use.
|
||||
if (AnticampData[dataindex][Anticamp_InUse])
|
||||
{
|
||||
@ -104,10 +104,10 @@ VolAnticampEnable(volumeIndex)
|
||||
KillTimer(timer);
|
||||
AnticampData[dataindex][Anticamp_Timer] = INVALID_HANDLE;
|
||||
}
|
||||
|
||||
|
||||
// Get interval.
|
||||
interval = AnticampData[dataindex][Anticamp_Interval];
|
||||
|
||||
|
||||
// Validate interval.
|
||||
if (interval > 0.0)
|
||||
{
|
||||
@ -130,7 +130,7 @@ stock VolAnticampEnableAll()
|
||||
{
|
||||
new Float:interval;
|
||||
new dataindex;
|
||||
|
||||
|
||||
// Loop through all volumes.
|
||||
for (new volumeindex = 0; volumeindex < ZR_VOLUMES_MAX; volumeindex++)
|
||||
{
|
||||
@ -140,13 +140,13 @@ stock VolAnticampEnableAll()
|
||||
// Volume not in use, skip it.
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Check if it's a anticamp volume.
|
||||
if (VolIsType(volumeindex, VolFeature_Anticamp))
|
||||
{
|
||||
// Get data index.
|
||||
dataindex = Volumes[volumeindex][Vol_DataIndex];
|
||||
|
||||
|
||||
// Kill timer if it exist.
|
||||
timer = AnticampData[dataindex][Anticamp_Timer];
|
||||
if (timer != INVALID_HANDLE)
|
||||
@ -154,10 +154,10 @@ stock VolAnticampEnableAll()
|
||||
KillTimer(timer);
|
||||
AnticampData[dataindex][Anticamp_Timer] = INVALID_HANDLE;
|
||||
}
|
||||
|
||||
|
||||
// Get interval.
|
||||
interval = AnticampData[dataindex][Anticamp_Interval];
|
||||
|
||||
|
||||
// Validate interval.
|
||||
if (interval > 0.0)
|
||||
{
|
||||
@ -178,22 +178,22 @@ stock VolAnticampEnableAll()
|
||||
VolAnticampDisable(volumeIndex)
|
||||
{
|
||||
new Handle:timerbuffer;
|
||||
|
||||
|
||||
// Validate index.
|
||||
if (!VolIsValidIndex(volumeIndex))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Get data index.
|
||||
new dataindex = Volumes[volumeIndex][Vol_DataIndex];
|
||||
|
||||
|
||||
// Validate data index.
|
||||
if (!VolAnticampValidateIndex(dataindex))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Check if in use.
|
||||
if (AnticampData[dataindex][Anticamp_InUse])
|
||||
{
|
||||
@ -204,10 +204,10 @@ VolAnticampDisable(volumeIndex)
|
||||
KillTimer(timerbuffer);
|
||||
AnticampData[dataindex][Anticamp_Timer] = INVALID_HANDLE;
|
||||
}
|
||||
|
||||
|
||||
LogEvent(_, LogType_Normal, LOG_DEBUG, LogModule_Volfeatures, "Vol state", "Disabled anticamp volume %d.", volumeIndex);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -216,7 +216,7 @@ VolAnticampDisable(volumeIndex)
|
||||
stock VolAnticampDisableAll()
|
||||
{
|
||||
new Handle:timerbuffer;
|
||||
|
||||
|
||||
// Loop through all volumes.
|
||||
for (new dataindex = 0; dataindex < ZR_VOLUMES_MAX; dataindex++)
|
||||
{
|
||||
@ -242,17 +242,17 @@ stock VolAnticampDisableAll()
|
||||
VolAnticampReset(dataIndex)
|
||||
{
|
||||
AnticampData[dataIndex][Anticamp_InUse] = false;
|
||||
|
||||
|
||||
AnticampData[dataIndex][Anticamp_Interval] = 1.0;
|
||||
if (AnticampData[dataIndex][Anticamp_Timer] != INVALID_HANDLE)
|
||||
{
|
||||
KillTimer(AnticampData[dataIndex][Anticamp_Timer]);
|
||||
AnticampData[dataIndex][Anticamp_Timer] = INVALID_HANDLE;
|
||||
}
|
||||
|
||||
|
||||
AnticampData[dataIndex][Anticamp_Action] = Anticamp_Damage;
|
||||
AnticampData[dataIndex][Anticamp_Amount] = 5.0;
|
||||
|
||||
|
||||
AnticampData[dataIndex][Anticamp_Warning] = Anticamp_Chat;
|
||||
Format(String:AnticampData[dataIndex][Anticamp_Message], 256, "");
|
||||
}
|
||||
@ -278,7 +278,7 @@ VolAnticampInit()
|
||||
VolAnticampOnPlayerLeave(client, volumeIndex)
|
||||
{
|
||||
new dataindex = Volumes[volumeIndex][Vol_DataIndex];
|
||||
|
||||
|
||||
switch (AnticampData[dataindex][Anticamp_Action])
|
||||
{
|
||||
case Anticamp_Drug:
|
||||
@ -305,19 +305,19 @@ public Action:Event_VolAnticampTrigger(Handle:timer, any:volumeIndex)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Check if the volume is unused.
|
||||
if (!VolInUse(volumeIndex))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Check if the volume is disabled.
|
||||
if (!VolIsEnabled(volumeIndex))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Check if it's a anticamp volume.
|
||||
if (VolIsType(volumeIndex, VolFeature_Anticamp))
|
||||
{
|
||||
@ -341,17 +341,17 @@ public Action:Event_VolAnticampTrigger(Handle:timer, any:volumeIndex)
|
||||
VolAnticampApplyAction(client, dataIndex, volumeIndex)
|
||||
{
|
||||
new Float:amount = AnticampData[dataIndex][Anticamp_Amount];
|
||||
|
||||
|
||||
// Set client language.
|
||||
SetGlobalTransTarget(client);
|
||||
|
||||
|
||||
// Get player name.
|
||||
decl String:name[64];
|
||||
GetClientName(client, name, sizeof(name));
|
||||
|
||||
|
||||
// Send warning message.
|
||||
VolAnticampWarnPlayer(client, dataIndex);
|
||||
|
||||
|
||||
switch (AnticampData[dataIndex][Anticamp_Action])
|
||||
{
|
||||
case Anticamp_NoAction:
|
||||
@ -363,7 +363,7 @@ VolAnticampApplyAction(client, dataIndex, volumeIndex)
|
||||
// Give damage to player. Kill if zero HP or below.
|
||||
new damage = RoundToNearest(amount);
|
||||
new health = GetClientHealth(client) - damage;
|
||||
|
||||
|
||||
if (health > 0)
|
||||
{
|
||||
SetEntityHealth(client, health);
|
||||
@ -372,7 +372,7 @@ VolAnticampApplyAction(client, dataIndex, volumeIndex)
|
||||
{
|
||||
// Health is zero or below. Kill player.
|
||||
ForcePlayerSuicide(client);
|
||||
|
||||
|
||||
// Log event.
|
||||
LogEvent(false, LogType_Normal, LOG_GAME_EVENTS, LogModule_Volfeatures, "Anti-camp", "%t", "Vol Slay", name, volumeIndex);
|
||||
}
|
||||
@ -381,7 +381,7 @@ VolAnticampApplyAction(client, dataIndex, volumeIndex)
|
||||
{
|
||||
// Instantly kill the player.
|
||||
ForcePlayerSuicide(client);
|
||||
|
||||
|
||||
// Log event.
|
||||
LogEvent(false, LogType_Normal, LOG_GAME_EVENTS, LogModule_Volfeatures, "Anti-camp", "%t", "Vol Slay", name, volumeIndex);
|
||||
}
|
||||
@ -396,10 +396,10 @@ VolAnticampApplyAction(client, dataIndex, volumeIndex)
|
||||
{
|
||||
// Extinguish player first.
|
||||
ExtinguishEntity(client);
|
||||
|
||||
|
||||
// Ignite player for "amount" seconds.
|
||||
IgniteEntity(client, amount);
|
||||
|
||||
|
||||
// Log event.
|
||||
LogEvent(false, LogType_Normal, LOG_GAME_EVENTS, LogModule_Volfeatures, "Anti-camp", "%t", "Vol Ignite", name, volumeIndex);
|
||||
}
|
||||
@ -417,10 +417,10 @@ VolAnticampWarnPlayer(client, dataIndex)
|
||||
{
|
||||
decl String:buffer[256];
|
||||
new bool:custommessage = (strlen(AnticampData[dataIndex][Anticamp_Message]) > 0) ? true : false;
|
||||
|
||||
|
||||
// Set language.
|
||||
SetGlobalTransTarget(client);
|
||||
|
||||
|
||||
// Format message.
|
||||
if (custommessage)
|
||||
{
|
||||
@ -432,7 +432,7 @@ VolAnticampWarnPlayer(client, dataIndex)
|
||||
// Use default anticamp message in translations file.
|
||||
Format(buffer, sizeof(buffer), "%t", "Vol Anticamp Message");
|
||||
}
|
||||
|
||||
|
||||
switch (AnticampData[dataIndex][Anticamp_Warning])
|
||||
{
|
||||
case Anticamp_NoWarning:
|
||||
@ -454,17 +454,17 @@ VolAnticampWarnPlayer(client, dataIndex)
|
||||
{
|
||||
// Display the message in a menu panel.
|
||||
new Handle:panel = CreatePanel();
|
||||
|
||||
|
||||
SetPanelTitle(panel, "Zombie:Reloaded");
|
||||
DrawPanelItem(panel, "", ITEMDRAW_SPACER);
|
||||
DrawPanelItem(panel, buffer);
|
||||
DrawPanelItem(panel, "", ITEMDRAW_SPACER);
|
||||
|
||||
|
||||
SetPanelCurrentKey(panel, 10);
|
||||
|
||||
|
||||
Format(buffer, sizeof(buffer), "%t", "Exit");
|
||||
DrawPanelItem(panel, buffer, ITEMDRAW_CONTROL);
|
||||
|
||||
|
||||
SendPanelToClient(panel, client, Handler_AnitcampDummy, 10);
|
||||
CloseHandle(panel);
|
||||
}
|
||||
@ -495,12 +495,12 @@ VolAnticampGetFreeIndex()
|
||||
{
|
||||
// Mark as in use.
|
||||
AnticampData[dataindex][Anticamp_InUse] = true;
|
||||
|
||||
|
||||
// Return the new index.
|
||||
return dataindex;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// No free index found.
|
||||
return -1;
|
||||
}
|
||||
@ -537,37 +537,37 @@ VolAnticampDumpData(dataIndex, String:buffer[], maxlen)
|
||||
decl String:valuebuffer[256];
|
||||
new anticampcache[VolTypeAnticamp];
|
||||
new cellswritten;
|
||||
|
||||
|
||||
// Validate index.
|
||||
if (!VolAnticampValidateIndex(dataIndex))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// Initialize and clear buffer.
|
||||
buffer[0] = 0;
|
||||
|
||||
|
||||
// Cache data.
|
||||
anticampcache = AnticampData[dataIndex];
|
||||
|
||||
|
||||
Format(linebuffer, sizeof(linebuffer), "Interval: %.2f\n", anticampcache[Anticamp_Interval]);
|
||||
cellswritten += StrCat(buffer, maxlen, linebuffer);
|
||||
|
||||
|
||||
VolAnticampActionToString(anticampcache[Anticamp_Action], valuebuffer, sizeof(valuebuffer));
|
||||
Format(linebuffer, sizeof(linebuffer), "Action: %s\n", valuebuffer);
|
||||
cellswritten += StrCat(buffer, maxlen, linebuffer);
|
||||
|
||||
|
||||
Format(linebuffer, sizeof(linebuffer), "Action amount: %.2f\n", anticampcache[Anticamp_Amount]);
|
||||
cellswritten += StrCat(buffer, maxlen, linebuffer);
|
||||
|
||||
|
||||
VolAnticampWarningToString(anticampcache[Anticamp_Warning], valuebuffer, sizeof(valuebuffer));
|
||||
Format(linebuffer, sizeof(linebuffer), "Warning type: %s\n", valuebuffer);
|
||||
cellswritten += StrCat(buffer, maxlen, linebuffer);
|
||||
|
||||
|
||||
strcopy(valuebuffer, sizeof(valuebuffer), anticampcache[Anticamp_Message]);
|
||||
Format(linebuffer, sizeof(linebuffer), "Warning message: \"%s\"\n", valuebuffer);
|
||||
cellswritten += StrCat(buffer, maxlen, linebuffer);
|
||||
|
||||
|
||||
return cellswritten;
|
||||
}
|
||||
|
||||
@ -613,7 +613,7 @@ VolAnticampActionToString(VolAnticampAction:actionType, String:buffer[], maxlen,
|
||||
return shortName ? strcopy(buffer, maxlen, "ignite") : strcopy(buffer, maxlen, "Ignite player");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -630,7 +630,7 @@ stock VolAnticampAction:VolAnticampStringToAction(const String:action[])
|
||||
{
|
||||
return Anticamp_NoAction;
|
||||
}
|
||||
|
||||
|
||||
if (StrEqual(action, "none", false))
|
||||
{
|
||||
return Anticamp_NoWarning;
|
||||
@ -651,7 +651,7 @@ stock VolAnticampAction:VolAnticampStringToAction(const String:action[])
|
||||
{
|
||||
return Anticamp_Ignite;
|
||||
}
|
||||
|
||||
|
||||
// No match.
|
||||
return Anticamp_NoAction;
|
||||
}
|
||||
@ -687,7 +687,7 @@ VolAnticampWarningToString(VolAnticampeWarningType:warningType, String:buffer[],
|
||||
return shortName ? strcopy(buffer, maxlen, "menu") : strcopy(buffer, maxlen, "Message in menu panel");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -704,7 +704,7 @@ stock VolAnticampeWarningType:VolAnticampStringToWarning(const String:warning[])
|
||||
{
|
||||
return Anticamp_NoWarning;
|
||||
}
|
||||
|
||||
|
||||
if (StrEqual(warning, "none", false))
|
||||
{
|
||||
return Anticamp_NoWarning;
|
||||
@ -721,7 +721,7 @@ stock VolAnticampeWarningType:VolAnticampStringToWarning(const String:warning[])
|
||||
{
|
||||
return Anticamp_Menu;
|
||||
}
|
||||
|
||||
|
||||
// No match.
|
||||
return Anticamp_NoWarning;
|
||||
}
|
||||
@ -748,7 +748,7 @@ bool:VolAnticampSetAttribute(dataIndex, const String:attribName[], const String:
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Check attribute names.
|
||||
if (StrEqual(attribName, "interval", false))
|
||||
{
|
||||
@ -783,7 +783,7 @@ bool:VolAnticampSetAttribute(dataIndex, const String:attribName[], const String:
|
||||
// Unsupported because of technical limits in command parser. Spaces
|
||||
// and quoted strings aren't supported yet.
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -792,22 +792,22 @@ bool:VolAnticampSetAttribute(dataIndex, const String:attribName[], const String:
|
||||
*
|
||||
* @param dataIndex Local data index.
|
||||
* @param interval Interval to set. A floating point number formatted as a
|
||||
* string.
|
||||
* string.
|
||||
* @return True if successfully set, false otherwise.
|
||||
*/
|
||||
bool:VolAnticampSetIntervalString(dataIndex, const String:interval[])
|
||||
{
|
||||
new Float:anticampinterval;
|
||||
|
||||
|
||||
// Check if string value is empty.
|
||||
if (strlen(interval) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Convert value.
|
||||
anticampinterval = StringToFloat(interval);
|
||||
|
||||
|
||||
// Apply value.
|
||||
AnticampData[dataIndex][Anticamp_Interval] = anticampinterval;
|
||||
return true;
|
||||
@ -827,7 +827,7 @@ bool:VolAnticampSetActionString(dataIndex, const String:action[])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Check effect string values and apply them to the volume.
|
||||
if (StrEqual(action, "none", false))
|
||||
{
|
||||
@ -854,7 +854,7 @@ bool:VolAnticampSetActionString(dataIndex, const String:action[])
|
||||
AnticampData[dataIndex][Anticamp_Action] = Anticamp_Ignite;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// The string value didn't match any valid action types.
|
||||
return false;
|
||||
}
|
||||
@ -864,22 +864,22 @@ bool:VolAnticampSetActionString(dataIndex, const String:action[])
|
||||
*
|
||||
* @param dataIndex Local data index.
|
||||
* @param amount Amount to set. A floating point number formatted as a
|
||||
* string.
|
||||
* string.
|
||||
* @return True if successfully set, false otherwise.
|
||||
*/
|
||||
bool:VolAnticampSetAmountString(dataIndex, const String:amount[])
|
||||
{
|
||||
new Float:actionamount;
|
||||
|
||||
|
||||
// Check if string value is empty.
|
||||
if (strlen(amount) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Convert value.
|
||||
actionamount = StringToFloat(amount);
|
||||
|
||||
|
||||
// Apply value.
|
||||
AnticampData[dataIndex][Anticamp_Amount] = actionamount;
|
||||
return true;
|
||||
@ -894,13 +894,13 @@ bool:VolAnticampSetAmountString(dataIndex, const String:amount[])
|
||||
*/
|
||||
bool:VolAnticampSetWarningString(dataIndex, const String:warning[])
|
||||
{
|
||||
|
||||
|
||||
// Check if string value is empty.
|
||||
if (strlen(warning) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Check effect string values and apply them to the volume.
|
||||
if (StrEqual(warning, "none", false))
|
||||
{
|
||||
@ -922,7 +922,7 @@ bool:VolAnticampSetWarningString(dataIndex, const String:warning[])
|
||||
AnticampData[dataIndex][Anticamp_Warning] = Anticamp_Menu;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// The string value didn't match any valid action types.
|
||||
return false;
|
||||
}
|
||||
|
@ -35,23 +35,23 @@ new VolEmptyAttributes[ClassEditableAttributes] = {
|
||||
-1, /** AlphaInitial */
|
||||
-1, /** AlphaDamaged */
|
||||
-1, /** AlphaDamage */
|
||||
|
||||
|
||||
"nochange", /** OverlayPath */
|
||||
-1, /** Nvgs */
|
||||
-1, /** Fov */
|
||||
|
||||
|
||||
-1, /** HasNapalm */
|
||||
-1.0, /** NapalmTime */
|
||||
Immunity_Invalid, /** ImmunityMode */
|
||||
-1, /** ImmunityAmount */
|
||||
-1, /** ImmunityCooldown */
|
||||
-1, /** NoFallDamage */
|
||||
|
||||
|
||||
-1.0, /** RegenInterval */
|
||||
-1, /** RegenAmount */
|
||||
-1, /** InfectGain */
|
||||
-1, /** KillBonus */
|
||||
|
||||
|
||||
-1.0, /** Speed */
|
||||
ZR_CLASS_KNOCKBACK_IGNORE, /** KnockBack */
|
||||
-1.0, /** JumpHeight */
|
||||
@ -73,7 +73,7 @@ enum VolClassEditMode
|
||||
enum VolTypeClassEdit
|
||||
{
|
||||
bool:VolClassEdit_InUse,
|
||||
|
||||
|
||||
VolClassEditMode:VolClassEdit_Mode,
|
||||
String:VolClassEdit_ClassName[VOL_CLASSNAME_SIZE],
|
||||
VolClassEdit_ClassData[ClassEditableAttributes]
|
||||
@ -115,12 +115,12 @@ VolClassEditGetFreeIndex()
|
||||
{
|
||||
// Mark as in use.
|
||||
VolClassEditData[dataindex][VolClassEdit_InUse] = true;
|
||||
|
||||
|
||||
// Unused index found.
|
||||
return dataindex;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Unused index not found.
|
||||
return -1;
|
||||
}
|
||||
@ -129,7 +129,7 @@ VolClassEditReset(dataIndex)
|
||||
{
|
||||
VolClassEditData[dataIndex][VolClassEdit_InUse] = false;
|
||||
VolClassEditData[dataIndex][VolClassEdit_Mode] = ClassEditMode_Attributes;
|
||||
|
||||
|
||||
strcopy(VolClassEditData[dataIndex][VolClassEdit_ClassName], 64, "");
|
||||
VolClassEditData[dataIndex][VolClassEdit_ClassData] = VolEmptyAttributes;
|
||||
}
|
||||
@ -160,7 +160,7 @@ VolClassEditSetAttribute(dataIndex, const String:attribName[], const String:attr
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* Class Editor Attributes */
|
||||
if (StrEqual(attribName, "mode", false))
|
||||
{
|
||||
@ -176,7 +176,7 @@ VolClassEditSetAttribute(dataIndex, const String:attribName[], const String:attr
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Model */
|
||||
else if (StrEqual(attribName, "alpha_initial", false))
|
||||
{
|
||||
@ -199,7 +199,7 @@ VolClassEditSetAttribute(dataIndex, const String:attribName[], const String:attr
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Hud */
|
||||
else if (StrEqual(attribName, "overlay_path", false))
|
||||
{
|
||||
@ -222,7 +222,7 @@ VolClassEditSetAttribute(dataIndex, const String:attribName[], const String:attr
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Effects */
|
||||
else if (StrEqual(attribName, "has_napalm", false))
|
||||
{
|
||||
@ -238,7 +238,7 @@ VolClassEditSetAttribute(dataIndex, const String:attribName[], const String:attr
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Player behavior */
|
||||
else if (StrEqual(attribName, "immunity_mode", false))
|
||||
{
|
||||
@ -324,7 +324,7 @@ VolClassEditSetAttribute(dataIndex, const String:attribName[], const String:attr
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Invalid attribute name or empty value.
|
||||
return false;
|
||||
}
|
||||
@ -340,28 +340,28 @@ VolClassEditSetAttribute(dataIndex, const String:attribName[], const String:attr
|
||||
VolClassEditDumpData(dataIndex, String:buffer[], maxlen)
|
||||
{
|
||||
#define CLASSEDIT_DUMP_FORMAT "%-19s %s\n"
|
||||
|
||||
|
||||
decl String:linebuffer[128];
|
||||
decl String:valuebuffer[256];
|
||||
new cache[VolTypeClassEdit];
|
||||
new cellswritten;
|
||||
|
||||
|
||||
// Validate index.
|
||||
if (!VolIsValidIndex(dataIndex))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// Initialize and clear buffer.
|
||||
buffer[0] = 0;
|
||||
|
||||
|
||||
// Cache data.
|
||||
cache = VolClassEditData[dataIndex];
|
||||
|
||||
|
||||
VolClassEditModeToString(cache[VolClassEdit_Mode], valuebuffer, sizeof(valuebuffer));
|
||||
Format(linebuffer, sizeof(linebuffer), CLASSEDIT_DUMP_FORMAT, "Mode:", valuebuffer);
|
||||
cellswritten += StrCat(buffer, maxlen, linebuffer);
|
||||
|
||||
|
||||
switch (cache[VolClassEdit_Mode])
|
||||
{
|
||||
case ClassEditMode_Name:
|
||||
@ -374,85 +374,85 @@ VolClassEditDumpData(dataIndex, String:buffer[], maxlen)
|
||||
VolClassEditIntToString(dataIndex, ClassEdit_AlphaInitial, valuebuffer, sizeof(valuebuffer));
|
||||
Format(linebuffer, sizeof(linebuffer), CLASSEDIT_DUMP_FORMAT, "Alpha initial:", valuebuffer);
|
||||
cellswritten += StrCat(buffer, maxlen, linebuffer);
|
||||
|
||||
|
||||
VolClassEditIntToString(dataIndex, ClassEdit_AlphaDamaged, valuebuffer, sizeof(valuebuffer));
|
||||
Format(linebuffer, sizeof(linebuffer), CLASSEDIT_DUMP_FORMAT, "Alpha damaged:", valuebuffer);
|
||||
cellswritten += StrCat(buffer, maxlen, linebuffer);
|
||||
|
||||
|
||||
VolClassEditIntToString(dataIndex, ClassEdit_AlphaDamage, valuebuffer, sizeof(valuebuffer));
|
||||
Format(linebuffer, sizeof(linebuffer), CLASSEDIT_DUMP_FORMAT, "Alpha damage:", valuebuffer);
|
||||
cellswritten += StrCat(buffer, maxlen, linebuffer);
|
||||
|
||||
|
||||
VolClassEditStringToHumanStr(dataIndex, ClassEdit_OverlayPath, valuebuffer, sizeof(valuebuffer));
|
||||
Format(linebuffer, sizeof(linebuffer), CLASSEDIT_DUMP_FORMAT, "Overlay path:", valuebuffer);
|
||||
cellswritten += StrCat(buffer, maxlen, linebuffer);
|
||||
|
||||
|
||||
VolClassEditIntToString(dataIndex, ClassEdit_Nvgs, valuebuffer, sizeof(valuebuffer));
|
||||
Format(linebuffer, sizeof(linebuffer), CLASSEDIT_DUMP_FORMAT, "NVGs:", valuebuffer);
|
||||
cellswritten += StrCat(buffer, maxlen, linebuffer);
|
||||
|
||||
|
||||
VolClassEditIntToString(dataIndex, ClassEdit_Fov, valuebuffer, sizeof(valuebuffer));
|
||||
Format(linebuffer, sizeof(linebuffer), CLASSEDIT_DUMP_FORMAT, "FOV:", valuebuffer);
|
||||
cellswritten += StrCat(buffer, maxlen, linebuffer);
|
||||
|
||||
|
||||
VolClassEditIntToString(dataIndex, ClassEdit_HasNapalm, valuebuffer, sizeof(valuebuffer));
|
||||
Format(linebuffer, sizeof(linebuffer), CLASSEDIT_DUMP_FORMAT, "Has napalm:", valuebuffer);
|
||||
cellswritten += StrCat(buffer, maxlen, linebuffer);
|
||||
|
||||
|
||||
VolClassEditFloatToString(dataIndex, ClassEdit_NapalmTime, valuebuffer, sizeof(valuebuffer));
|
||||
Format(linebuffer, sizeof(linebuffer), CLASSEDIT_DUMP_FORMAT, "Napalm time:", valuebuffer);
|
||||
cellswritten += StrCat(buffer, maxlen, linebuffer);
|
||||
|
||||
|
||||
ImmunityModeToString(VolClassEditData[dataIndex][ClassEdit_ImmunityMode], valuebuffer, sizeof(valuebuffer));
|
||||
Format(linebuffer, sizeof(linebuffer), CLASSEDIT_DUMP_FORMAT, "Immunity mode:", valuebuffer);
|
||||
cellswritten += StrCat(buffer, maxlen, linebuffer);
|
||||
|
||||
|
||||
VolClassEditIntToString(dataIndex, ClassEdit_ImmunityAmount, valuebuffer, sizeof(valuebuffer));
|
||||
Format(linebuffer, sizeof(linebuffer), CLASSEDIT_DUMP_FORMAT, "Immunity amount:", valuebuffer);
|
||||
cellswritten += StrCat(buffer, maxlen, linebuffer);
|
||||
|
||||
|
||||
VolClassEditIntToString(dataIndex, ClassEdit_ImmunityCooldown, valuebuffer, sizeof(valuebuffer));
|
||||
Format(linebuffer, sizeof(linebuffer), CLASSEDIT_DUMP_FORMAT, "Immunity cooldown:", valuebuffer);
|
||||
cellswritten += StrCat(buffer, maxlen, linebuffer);
|
||||
|
||||
|
||||
VolClassEditIntToString(dataIndex, ClassEdit_NoFallDamage, valuebuffer, sizeof(valuebuffer));
|
||||
Format(linebuffer, sizeof(linebuffer), CLASSEDIT_DUMP_FORMAT, "No fall damage:", valuebuffer);
|
||||
cellswritten += StrCat(buffer, maxlen, linebuffer);
|
||||
|
||||
|
||||
VolClassEditFloatToString(dataIndex, ClassEdit_RegenInterval, valuebuffer, sizeof(valuebuffer));
|
||||
Format(linebuffer, sizeof(linebuffer), CLASSEDIT_DUMP_FORMAT, "Regen interval:", valuebuffer);
|
||||
cellswritten += StrCat(buffer, maxlen, linebuffer);
|
||||
|
||||
|
||||
VolClassEditIntToString(dataIndex, ClassEdit_RegenAmount, valuebuffer, sizeof(valuebuffer));
|
||||
Format(linebuffer, sizeof(linebuffer), CLASSEDIT_DUMP_FORMAT, "Regen amount:", valuebuffer);
|
||||
cellswritten += StrCat(buffer, maxlen, linebuffer);
|
||||
|
||||
|
||||
VolClassEditIntToString(dataIndex, ClassEdit_InfectGain, valuebuffer, sizeof(valuebuffer));
|
||||
Format(linebuffer, sizeof(linebuffer), CLASSEDIT_DUMP_FORMAT, "Infect gain:", valuebuffer);
|
||||
cellswritten += StrCat(buffer, maxlen, linebuffer);
|
||||
|
||||
|
||||
VolClassEditIntToString(dataIndex, ClassEdit_KillBonus, valuebuffer, sizeof(valuebuffer));
|
||||
Format(linebuffer, sizeof(linebuffer), CLASSEDIT_DUMP_FORMAT, "Kill bonus:", valuebuffer);
|
||||
cellswritten += StrCat(buffer, maxlen, linebuffer);
|
||||
|
||||
|
||||
VolClassEditFloatToString(dataIndex, ClassEdit_Speed, valuebuffer, sizeof(valuebuffer));
|
||||
Format(linebuffer, sizeof(linebuffer), CLASSEDIT_DUMP_FORMAT, "Speed:", valuebuffer);
|
||||
cellswritten += StrCat(buffer, maxlen, linebuffer);
|
||||
|
||||
|
||||
VolClassEditFloatToString(dataIndex, ClassEdit_KnockBack, valuebuffer, sizeof(valuebuffer), ZR_CLASS_KNOCKBACK_IGNORE);
|
||||
Format(linebuffer, sizeof(linebuffer), CLASSEDIT_DUMP_FORMAT, "Knock back:", valuebuffer);
|
||||
cellswritten += StrCat(buffer, maxlen, linebuffer);
|
||||
|
||||
|
||||
VolClassEditFloatToString(dataIndex, ClassEdit_JumpHeight, valuebuffer, sizeof(valuebuffer));
|
||||
Format(linebuffer, sizeof(linebuffer), CLASSEDIT_DUMP_FORMAT, "Jump height:", valuebuffer);
|
||||
cellswritten += StrCat(buffer, maxlen, linebuffer);
|
||||
|
||||
|
||||
VolClassEditFloatToString(dataIndex, ClassEdit_JumpDistance, valuebuffer, sizeof(valuebuffer));
|
||||
Format(linebuffer, sizeof(linebuffer), CLASSEDIT_DUMP_FORMAT, "Jump distance:", valuebuffer);
|
||||
cellswritten += StrCat(buffer, maxlen, linebuffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return cellswritten;
|
||||
}
|
||||
|
||||
@ -477,10 +477,10 @@ VolClassEditApply(client, dataIndex)
|
||||
{
|
||||
// Cache volume attributes.
|
||||
new classindex = ClassGetIndex(VolClassEditData[dataIndex][VolClassEdit_ClassName]);
|
||||
|
||||
|
||||
// Save player's selected class.
|
||||
VolClassEditSelectedClass[client] = ClassGetActiveIndex(client);
|
||||
|
||||
|
||||
// Update cache with new attributes.
|
||||
ClassReloadPlayerCache(client, classindex);
|
||||
}
|
||||
@ -491,9 +491,9 @@ VolClassEditApply(client, dataIndex)
|
||||
VolClassEditUpdateAttributes(client, VolClassEditData[dataIndex][VolClassEdit_ClassData]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LogEvent(_, LogType_Normal, LOG_DEBUG, LogModule_Volfeatures, "ClassEdit", "Applied class data on client %d.", client);
|
||||
|
||||
|
||||
// Apply the updated attributes.
|
||||
ClassApplyAttributes(client);
|
||||
}
|
||||
@ -506,7 +506,7 @@ VolClassEditApply(client, dataIndex)
|
||||
VolClassEditRestore(client, dataIndex)
|
||||
{
|
||||
new classindex = ClassGetActiveIndex(client);
|
||||
|
||||
|
||||
switch (VolClassEditData[dataIndex][VolClassEdit_Mode])
|
||||
{
|
||||
case ClassEditMode_Name:
|
||||
@ -521,7 +521,7 @@ VolClassEditRestore(client, dataIndex)
|
||||
VolClassEditRestoreAttributes(client, classindex, VolClassEditData[dataIndex][VolClassEdit_ClassData]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Apply the restored attributes.
|
||||
if (ClassApplyAttributes(client))
|
||||
{
|
||||
@ -609,13 +609,13 @@ VolClassEditModeToString(VolClassEditMode:mode, String:buffer[], maxlen)
|
||||
return strcopy(buffer, maxlen, "Attributes");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a integer attribute and converts it to a human readable string.
|
||||
*
|
||||
*
|
||||
* Note: attribute is assumed to be a integer (cell) and is not type cheked!
|
||||
*
|
||||
* @param dataIndex Local data index.
|
||||
@ -627,9 +627,9 @@ VolClassEditIntToString(dataIndex, ClassEditableAttributes:attribute, String:buf
|
||||
{
|
||||
new intVal;
|
||||
new String:strVal[8];
|
||||
|
||||
|
||||
intVal = VolClassEditData[dataIndex][VolClassEdit_ClassData][attribute];
|
||||
|
||||
|
||||
// Check if the attribute is marked as ignored.
|
||||
if (intVal == -1)
|
||||
{
|
||||
@ -656,9 +656,9 @@ VolClassEditFloatToString(dataIndex, ClassEditableAttributes:attribute, String:b
|
||||
{
|
||||
new Float:floatVal;
|
||||
new String:strVal[8];
|
||||
|
||||
|
||||
floatVal = Float:VolClassEditData[dataIndex][VolClassEdit_ClassData][attribute];
|
||||
|
||||
|
||||
// Check if the attribute is marked as ignored.
|
||||
if (floatVal == minval)
|
||||
{
|
||||
@ -685,7 +685,7 @@ VolClassEditStringToHumanStr(dataIndex, ClassEditableAttributes:attribute, Strin
|
||||
{
|
||||
decl String:strVal[PLATFORM_MAX_PATH];
|
||||
strcopy(strVal, sizeof(strVal), String:VolClassEditData[dataIndex][VolClassEdit_ClassData][attribute]);
|
||||
|
||||
|
||||
// Check if the attribute is marked as ignored.
|
||||
if (StrEqual(strVal, "nochange", false))
|
||||
{
|
||||
@ -711,7 +711,7 @@ bool:VolClassEditSetMode(dataIndex, const String:value[])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (StrEqual(value, "name", false))
|
||||
{
|
||||
VolClassEditData[dataIndex][VolClassEdit_Mode] = ClassEditMode_Name;
|
||||
@ -722,7 +722,7 @@ bool:VolClassEditSetMode(dataIndex, const String:value[])
|
||||
VolClassEditData[dataIndex][VolClassEdit_Mode] = ClassEditMode_Attributes;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// No match.
|
||||
return false;
|
||||
}
|
||||
@ -741,11 +741,11 @@ bool:VolClassEditSetName(dataIndex, const String:value[])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
strcopy(VolClassEditData[dataIndex][VolClassEdit_ClassName], VOL_CLASSNAME_SIZE, value);
|
||||
|
||||
|
||||
// TODO: Validate name.
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -765,7 +765,7 @@ bool:VolClassEditSetAlphaInitial(dataIndex, const String:value[])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
VolClassEditData[dataIndex][VolClassEdit_ClassData][ClassEdit_AlphaInitial] = StringToInt(value);
|
||||
return true;
|
||||
}
|
||||
@ -786,7 +786,7 @@ bool:VolClassEditSetAlphaDamaged(dataIndex, const String:value[])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
VolClassEditData[dataIndex][VolClassEdit_ClassData][ClassEdit_AlphaDamaged] = StringToInt(value);
|
||||
return true;
|
||||
}
|
||||
@ -807,7 +807,7 @@ bool:VolClassEditSetAlphaDamage(dataIndex, const String:value[])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
VolClassEditData[dataIndex][VolClassEdit_ClassData][ClassEdit_AlphaDamage] = StringToInt(value);
|
||||
return true;
|
||||
}
|
||||
@ -828,7 +828,7 @@ bool:VolClassEditSetOverlayPath(dataIndex, const String:value[])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
strcopy(VolClassEditData[dataIndex][VolClassEdit_ClassData][ClassEdit_OverlayPath], PLATFORM_MAX_PATH, value);
|
||||
return true;
|
||||
}
|
||||
@ -849,7 +849,7 @@ bool:VolClassEditSetNvgs(dataIndex, const String:value[])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
VolClassEditData[dataIndex][VolClassEdit_ClassData][ClassEdit_Nvgs] = StringToInt(value);
|
||||
return true;
|
||||
}
|
||||
@ -870,7 +870,7 @@ bool:VolClassEditSetFov(dataIndex, const String:value[])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
VolClassEditData[dataIndex][VolClassEdit_ClassData][ClassEdit_Fov] = StringToInt(value);
|
||||
return true;
|
||||
}
|
||||
@ -891,7 +891,7 @@ bool:VolClassEditSetHasNapalm(dataIndex, const String:value[])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
VolClassEditData[dataIndex][VolClassEdit_ClassData][ClassEdit_HasNapalm] = StringToInt(value);
|
||||
return true;
|
||||
}
|
||||
@ -912,7 +912,7 @@ bool:VolClassEditSetNapalmTime(dataIndex, const String:value[])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
VolClassEditData[dataIndex][VolClassEdit_ClassData][ClassEdit_NapalmTime] = StringToFloat(value);
|
||||
return true;
|
||||
}
|
||||
@ -933,7 +933,7 @@ bool:VolClassEditSetImmunityMode(dataIndex, const String:value[])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
new ImmunityMode:mode = ImmunityStringToMode(value);
|
||||
VolClassEditData[dataIndex][VolClassEdit_ClassData][ClassEdit_ImmunityMode] = mode;
|
||||
return true;
|
||||
@ -955,7 +955,7 @@ bool:VolClassEditSetImmunityAmount(dataIndex, const String:value[])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
VolClassEditData[dataIndex][VolClassEdit_ClassData][ClassEdit_ImmunityAmount] = StringToInt(value);
|
||||
return true;
|
||||
}
|
||||
@ -976,7 +976,7 @@ bool:VolClassEditSetImmunityCooldown(dataIndex, const String:value[])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
VolClassEditData[dataIndex][VolClassEdit_ClassData][ClassEdit_ImmunityCooldown] = StringToInt(value);
|
||||
return true;
|
||||
}
|
||||
@ -997,7 +997,7 @@ bool:VolClassEditSetNoFallDamage(dataIndex, const String:value[])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
VolClassEditData[dataIndex][VolClassEdit_ClassData][ClassEdit_NoFallDamage] = StringToInt(value);
|
||||
return true;
|
||||
}
|
||||
@ -1018,7 +1018,7 @@ bool:VolClassEditSetRegenInterval(dataIndex, const String:value[])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
VolClassEditData[dataIndex][VolClassEdit_ClassData][ClassEdit_RegenInterval] = StringToFloat(value);
|
||||
return true;
|
||||
}
|
||||
@ -1039,7 +1039,7 @@ bool:VolClassEditSetRegenAmount(dataIndex, const String:value[])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
VolClassEditData[dataIndex][VolClassEdit_ClassData][ClassEdit_RegenAmount] = StringToInt(value);
|
||||
return true;
|
||||
}
|
||||
@ -1060,7 +1060,7 @@ bool:VolClassEditSetInfectGain(dataIndex, const String:value[])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
VolClassEditData[dataIndex][VolClassEdit_ClassData][ClassEdit_InfectGain] = StringToInt(value);
|
||||
return true;
|
||||
}
|
||||
@ -1081,7 +1081,7 @@ bool:VolClassEditSetKillBonus(dataIndex, const String:value[])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
VolClassEditData[dataIndex][VolClassEdit_ClassData][ClassEdit_KillBonus] = StringToInt(value);
|
||||
return true;
|
||||
}
|
||||
@ -1102,7 +1102,7 @@ bool:VolClassEditSetSpeed(dataIndex, const String:value[])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
VolClassEditData[dataIndex][VolClassEdit_ClassData][ClassEdit_Speed] = StringToFloat(value);
|
||||
return true;
|
||||
}
|
||||
@ -1123,7 +1123,7 @@ bool:VolClassEditSetKnockBack(dataIndex, const String:value[])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
VolClassEditData[dataIndex][VolClassEdit_ClassData][ClassEdit_KnockBack] = StringToFloat(value);
|
||||
return true;
|
||||
}
|
||||
@ -1144,7 +1144,7 @@ bool:VolClassEditSetJumpHeight(dataIndex, const String:value[])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
VolClassEditData[dataIndex][VolClassEdit_ClassData][ClassEdit_JumpHeight] = StringToFloat(value);
|
||||
return true;
|
||||
}
|
||||
@ -1165,7 +1165,7 @@ bool:VolClassEditSetJumpDistance(dataIndex, const String:value[])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
VolClassEditData[dataIndex][VolClassEdit_ClassData][ClassEdit_JumpDistance] = StringToFloat(value);
|
||||
return true;
|
||||
}
|
||||
@ -1183,133 +1183,133 @@ bool:VolClassEditSetJumpDistance(dataIndex, const String:value[])
|
||||
VolClassEditUpdateAttributes(client, const attributes[])
|
||||
{
|
||||
new numChanges;
|
||||
|
||||
|
||||
// Alpha initial.
|
||||
if (attributes[ClassEdit_AlphaInitial] > -1)
|
||||
{
|
||||
ClassPlayerCache[client][Class_AlphaInitial] = attributes[ClassEdit_AlphaInitial];
|
||||
numChanges++;
|
||||
}
|
||||
|
||||
|
||||
// Alpha damaged.
|
||||
if (attributes[ClassEdit_AlphaDamaged] > -1)
|
||||
{
|
||||
ClassPlayerCache[client][Class_AlphaDamaged] = attributes[ClassEdit_AlphaDamaged];
|
||||
numChanges++;
|
||||
}
|
||||
|
||||
|
||||
// Alpha damage.
|
||||
if (attributes[ClassEdit_AlphaDamage] > -1)
|
||||
{
|
||||
ClassPlayerCache[client][Class_AlphaDamage] = attributes[ClassEdit_AlphaDamage];
|
||||
numChanges++;
|
||||
}
|
||||
|
||||
|
||||
// Overlay path.
|
||||
if (!StrEqual(attributes[ClassEdit_OverlayPath], "nochange"))
|
||||
{
|
||||
strcopy(ClassPlayerCache[client][Class_OverlayPath], PLATFORM_MAX_PATH, attributes[ClassEdit_OverlayPath]);
|
||||
numChanges++;
|
||||
}
|
||||
|
||||
|
||||
// Nvgs.
|
||||
if (attributes[ClassEdit_Nvgs] > -1)
|
||||
{
|
||||
ClassPlayerCache[client][Class_Nvgs] = bool:attributes[ClassEdit_Nvgs];
|
||||
numChanges++;
|
||||
}
|
||||
|
||||
|
||||
// Napalm time.
|
||||
if (attributes[ClassEdit_NapalmTime] > -1.0)
|
||||
{
|
||||
ClassPlayerCache[client][Class_NapalmTime] = attributes[ClassEdit_NapalmTime];
|
||||
numChanges++;
|
||||
}
|
||||
|
||||
|
||||
// Immunity mode.
|
||||
if (attributes[ClassEdit_ImmunityMode] != Immunity_Invalid)
|
||||
{
|
||||
ClassPlayerCache[client][Class_ImmunityMode] = attributes[ClassEdit_ImmunityMode];
|
||||
numChanges++;
|
||||
}
|
||||
|
||||
|
||||
// Immunity amount.
|
||||
if (attributes[ClassEdit_ImmunityAmount] > -1)
|
||||
{
|
||||
ClassPlayerCache[client][Class_ImmunityAmount] = attributes[ClassEdit_ImmunityAmount];
|
||||
numChanges++;
|
||||
}
|
||||
|
||||
|
||||
// Immunity cooldown.
|
||||
if (attributes[ClassEdit_ImmunityCooldown] > -1)
|
||||
{
|
||||
ClassPlayerCache[client][Class_ImmunityCooldown] = attributes[ClassEdit_ImmunityCooldown];
|
||||
numChanges++;
|
||||
}
|
||||
|
||||
|
||||
// No fall damage.
|
||||
if (attributes[ClassEdit_NoFallDamage] > -1)
|
||||
{
|
||||
ClassPlayerCache[client][Class_NoFallDamage] = bool:attributes[ClassEdit_NoFallDamage];
|
||||
numChanges++;
|
||||
}
|
||||
|
||||
|
||||
// Health regen interval.
|
||||
if (attributes[ClassEdit_RegenInterval] > -1.0)
|
||||
{
|
||||
ClassPlayerCache[client][Class_HealthRegenInterval] = attributes[ClassEdit_RegenInterval];
|
||||
numChanges++;
|
||||
}
|
||||
|
||||
|
||||
// Health regen amount.
|
||||
if (attributes[ClassEdit_RegenAmount] > -1)
|
||||
{
|
||||
ClassPlayerCache[client][Class_HealthRegenAmount] = attributes[ClassEdit_RegenAmount];
|
||||
numChanges++;
|
||||
}
|
||||
|
||||
|
||||
// Infect gain.
|
||||
if (attributes[ClassEdit_InfectGain] > -1)
|
||||
{
|
||||
ClassPlayerCache[client][Class_HealthInfectGain] = attributes[ClassEdit_InfectGain];
|
||||
numChanges++;
|
||||
}
|
||||
|
||||
|
||||
// Kill bonus.
|
||||
if (attributes[ClassEdit_KillBonus] > -1)
|
||||
{
|
||||
ClassPlayerCache[client][Class_KillBonus] = attributes[ClassEdit_KillBonus];
|
||||
numChanges++;
|
||||
}
|
||||
|
||||
|
||||
// Speed.
|
||||
if (attributes[ClassEdit_Speed] > -1.0)
|
||||
{
|
||||
ClassPlayerCache[client][Class_Speed] = attributes[ClassEdit_Speed];
|
||||
numChanges++;
|
||||
}
|
||||
|
||||
|
||||
// Knock back.
|
||||
if (attributes[ClassEdit_KnockBack] > ZR_CLASS_KNOCKBACK_IGNORE)
|
||||
{
|
||||
ClassPlayerCache[client][Class_KnockBack] = attributes[ClassEdit_KnockBack];
|
||||
numChanges++;
|
||||
}
|
||||
|
||||
|
||||
// Jump height.
|
||||
if (attributes[ClassEdit_JumpHeight] > -1.0)
|
||||
{
|
||||
ClassPlayerCache[client][Class_JumpHeight] = attributes[ClassEdit_JumpHeight];
|
||||
numChanges++;
|
||||
}
|
||||
|
||||
|
||||
// Jump distance.
|
||||
if (attributes[ClassEdit_JumpDistance] > -1.0)
|
||||
{
|
||||
ClassPlayerCache[client][Class_JumpDistance] = attributes[ClassEdit_JumpDistance];
|
||||
numChanges++;
|
||||
}
|
||||
|
||||
|
||||
LogEvent(_, LogType_Normal, LOG_DEBUG, LogModule_Volfeatures, "ClassEdit", "Applied %d attribute(s).", numChanges);
|
||||
return numChanges;
|
||||
}
|
||||
@ -1326,28 +1326,28 @@ VolClassEditUpdateAttributes(client, const attributes[])
|
||||
VolClassEditRestoreAttributes(client, classindex, const attributes[])
|
||||
{
|
||||
new numChanges;
|
||||
|
||||
|
||||
// Alpha initial.
|
||||
if (attributes[ClassEdit_AlphaInitial] > -1)
|
||||
{
|
||||
ClassPlayerCache[client][Class_AlphaInitial] = ClassGetAlphaInitial(classindex, ZR_CLASS_CACHE_MODIFIED);
|
||||
numChanges++;
|
||||
}
|
||||
|
||||
|
||||
// Alpha damaged.
|
||||
if (attributes[ClassEdit_AlphaDamaged] > -1)
|
||||
{
|
||||
ClassPlayerCache[client][Class_AlphaDamaged] = ClassGetAlphaDamaged(classindex, ZR_CLASS_CACHE_MODIFIED);
|
||||
numChanges++;
|
||||
}
|
||||
|
||||
|
||||
// Alpha damage.
|
||||
if (attributes[ClassEdit_AlphaDamage] > -1)
|
||||
{
|
||||
ClassPlayerCache[client][Class_AlphaDamage] = ClassGetAlphaDamage(classindex, ZR_CLASS_CACHE_MODIFIED);
|
||||
numChanges++;
|
||||
}
|
||||
|
||||
|
||||
// Overlay path.
|
||||
if (!StrEqual(attributes[ClassEdit_OverlayPath], "nochange"))
|
||||
{
|
||||
@ -1356,98 +1356,98 @@ VolClassEditRestoreAttributes(client, classindex, const attributes[])
|
||||
strcopy(ClassPlayerCache[client][Class_OverlayPath], PLATFORM_MAX_PATH, path);
|
||||
numChanges++;
|
||||
}
|
||||
|
||||
|
||||
// Nvgs.
|
||||
if (attributes[ClassEdit_Nvgs] > -1)
|
||||
{
|
||||
ClassPlayerCache[client][Class_Nvgs] = ClassGetNvgs(classindex, ZR_CLASS_CACHE_MODIFIED);
|
||||
numChanges++;
|
||||
}
|
||||
|
||||
|
||||
// Napalm time.
|
||||
if (attributes[ClassEdit_NapalmTime] > -1.0)
|
||||
{
|
||||
ClassPlayerCache[client][Class_NapalmTime] = ClassGetNapalmTime(classindex, ZR_CLASS_CACHE_MODIFIED);
|
||||
numChanges++;
|
||||
}
|
||||
|
||||
|
||||
// Immunity mode.
|
||||
if (attributes[ClassEdit_ImmunityMode] != Immunity_Invalid)
|
||||
{
|
||||
ClassPlayerCache[client][Class_ImmunityMode] = ClassGetImmunityMode(classindex, ZR_CLASS_CACHE_MODIFIED);
|
||||
numChanges++;
|
||||
}
|
||||
|
||||
|
||||
// Immunity amount.
|
||||
if (attributes[ClassEdit_ImmunityAmount] > -1.0)
|
||||
{
|
||||
ClassPlayerCache[client][Class_ImmunityAmount] = ClassGetImmunityAmount(classindex, ZR_CLASS_CACHE_MODIFIED);
|
||||
numChanges++;
|
||||
}
|
||||
|
||||
|
||||
// No fall damage.
|
||||
if (attributes[ClassEdit_NoFallDamage] > -1)
|
||||
{
|
||||
ClassPlayerCache[client][Class_NoFallDamage] = ClassGetNoFallDamage(classindex, ZR_CLASS_CACHE_MODIFIED);
|
||||
numChanges++;
|
||||
}
|
||||
|
||||
|
||||
// Health regen interval.
|
||||
if (attributes[ClassEdit_RegenInterval] > -1.0)
|
||||
{
|
||||
ClassPlayerCache[client][Class_HealthRegenInterval] = ClassGetHealthRegenInterval(classindex, ZR_CLASS_CACHE_MODIFIED);
|
||||
numChanges++;
|
||||
}
|
||||
|
||||
|
||||
// Health regen amount.
|
||||
if (attributes[ClassEdit_RegenAmount] > -1)
|
||||
{
|
||||
ClassPlayerCache[client][Class_HealthRegenAmount] = ClassGetHealthRegenAmount(classindex, ZR_CLASS_CACHE_MODIFIED);
|
||||
numChanges++;
|
||||
}
|
||||
|
||||
|
||||
// Infect gain.
|
||||
if (attributes[ClassEdit_InfectGain] > -1)
|
||||
{
|
||||
ClassPlayerCache[client][Class_HealthInfectGain] = ClassGetHealthInfectGain(classindex, ZR_CLASS_CACHE_MODIFIED);
|
||||
numChanges++;
|
||||
}
|
||||
|
||||
|
||||
// Kill bonus.
|
||||
if (attributes[ClassEdit_KillBonus] > -1)
|
||||
{
|
||||
ClassPlayerCache[client][Class_KillBonus] = ClassGetKillBonus(classindex, ZR_CLASS_CACHE_MODIFIED);
|
||||
numChanges++;
|
||||
}
|
||||
|
||||
|
||||
// Speed.
|
||||
if (attributes[ClassEdit_Speed] > -1.0)
|
||||
{
|
||||
ClassPlayerCache[client][Class_Speed] = ClassGetSpeed(classindex, ZR_CLASS_CACHE_MODIFIED);
|
||||
numChanges++;
|
||||
}
|
||||
|
||||
|
||||
// Knock back.
|
||||
if (attributes[ClassEdit_KnockBack] > ZR_CLASS_KNOCKBACK_IGNORE)
|
||||
{
|
||||
ClassPlayerCache[client][Class_KnockBack] = ClassGetKnockback(classindex, ZR_CLASS_CACHE_MODIFIED);
|
||||
numChanges++;
|
||||
}
|
||||
|
||||
|
||||
// Jump height.
|
||||
if (attributes[ClassEdit_JumpHeight] > -1.0)
|
||||
{
|
||||
ClassPlayerCache[client][Class_JumpHeight] = ClassGetJumpHeight(classindex, ZR_CLASS_CACHE_MODIFIED);
|
||||
numChanges++;
|
||||
}
|
||||
|
||||
|
||||
// Jump distance.
|
||||
if (attributes[ClassEdit_JumpDistance] > -1.0)
|
||||
{
|
||||
ClassPlayerCache[client][Class_JumpDistance] = ClassGetJumpDistance(classindex, ZR_CLASS_CACHE_MODIFIED);
|
||||
numChanges++;
|
||||
}
|
||||
|
||||
|
||||
LogEvent(_, LogType_Normal, LOG_DEBUG, LogModule_Volfeatures, "ClassEdit", "Applied %d attribute(s).", numChanges);
|
||||
return numChanges;
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ public Action:VolAddVolumeCommand(client, argc)
|
||||
{
|
||||
decl String:buffer[640];
|
||||
buffer[0] = 0;
|
||||
|
||||
|
||||
// Check if privileged.
|
||||
if (!ZRIsClientPrivileged(client, OperationType_Configuration))
|
||||
{
|
||||
@ -92,11 +92,11 @@ public Action:VolAddVolumeCommand(client, argc)
|
||||
StrCat(buffer, sizeof(buffer), " effect=none|wireframe|smoke\n");
|
||||
StrCat(buffer, sizeof(buffer), " effect_color=0,0,0\n");
|
||||
StrCat(buffer, sizeof(buffer), " enabled=1");
|
||||
|
||||
|
||||
ReplyToCommand(client, buffer);
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
|
||||
new Float:x1;
|
||||
new Float:y1;
|
||||
new Float:z1;
|
||||
@ -110,41 +110,41 @@ public Action:VolAddVolumeCommand(client, argc)
|
||||
new volindex;
|
||||
new dataindex;
|
||||
new paramcount;
|
||||
|
||||
|
||||
decl String:params[512];
|
||||
decl String:argbuffer[256];
|
||||
|
||||
|
||||
params[0] = 0;
|
||||
|
||||
|
||||
// Get a free volume index.
|
||||
volindex = VolGetFreeVolume();
|
||||
|
||||
|
||||
// Validate index.
|
||||
if (!VolIsValidIndex(volindex))
|
||||
{
|
||||
ReplyToCommand(client, "Cannot add volume. Maximum number of volumes reached.");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Get positions.
|
||||
GetCmdArg(1, argbuffer, sizeof(argbuffer));
|
||||
x1 = StringToFloat(argbuffer);
|
||||
|
||||
|
||||
GetCmdArg(2, argbuffer, sizeof(argbuffer));
|
||||
y1 = StringToFloat(argbuffer);
|
||||
|
||||
|
||||
GetCmdArg(3, argbuffer, sizeof(argbuffer));
|
||||
z1 = StringToFloat(argbuffer);
|
||||
|
||||
|
||||
GetCmdArg(4, argbuffer, sizeof(argbuffer));
|
||||
x2 = StringToFloat(argbuffer);
|
||||
|
||||
|
||||
GetCmdArg(5, argbuffer, sizeof(argbuffer));
|
||||
y2 = StringToFloat(argbuffer);
|
||||
|
||||
|
||||
GetCmdArg(6, argbuffer, sizeof(argbuffer));
|
||||
z2 = StringToFloat(argbuffer);
|
||||
|
||||
|
||||
// Check if both locations are equal.
|
||||
if (FloatCompare(x1, x2) == 0)
|
||||
{
|
||||
@ -157,7 +157,7 @@ public Action:VolAddVolumeCommand(client, argc)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Sort out max and min values so 1-values are smaller.
|
||||
if (FloatCompare(x1, x2) == 1)
|
||||
{
|
||||
@ -180,7 +180,7 @@ public Action:VolAddVolumeCommand(client, argc)
|
||||
z1 = z2;
|
||||
z2 = floatbuffer;
|
||||
}
|
||||
|
||||
|
||||
// Copy coordinates to location vectors.
|
||||
min[0] = x1;
|
||||
min[1] = y1;
|
||||
@ -188,31 +188,31 @@ public Action:VolAddVolumeCommand(client, argc)
|
||||
max[0] = x2;
|
||||
max[1] = y2;
|
||||
max[2] = z2;
|
||||
|
||||
|
||||
// Get volume type.
|
||||
GetCmdArg(7, argbuffer, sizeof(argbuffer));
|
||||
voltype = VolGetTypeFromString(argbuffer);
|
||||
|
||||
|
||||
// Validate volume type.
|
||||
if (voltype == VolFeature_Invalid)
|
||||
{
|
||||
ReplyToCommand(client, "Cannot add volume. Invalid volume type: %s", argbuffer);
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
|
||||
// Get free data index for the specified type.
|
||||
dataindex = VolGetFreeDataIndex(voltype);
|
||||
|
||||
|
||||
// Validate data index.
|
||||
if (dataindex < 0)
|
||||
{
|
||||
ReplyToCommand(client, "Cannot add volume. Out of free data indexes for type \"%s\"", argbuffer);
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
|
||||
// Add volume.
|
||||
volindex = VolAdd(volindex, min, max, voltype, dataindex);
|
||||
|
||||
|
||||
// Get additional parameters if they exist.
|
||||
if (argc >= 8)
|
||||
{
|
||||
@ -221,14 +221,14 @@ public Action:VolAddVolumeCommand(client, argc)
|
||||
{
|
||||
GetCmdArg(arg, argbuffer, sizeof(argbuffer));
|
||||
StrCat(params, sizeof(params), argbuffer);
|
||||
|
||||
|
||||
// Add space, except on the last parameter.
|
||||
if (arg < argc)
|
||||
{
|
||||
StrCat(params, sizeof(params), " ");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Set attributes.
|
||||
paramcount = VolSetAttributes(volindex, params);
|
||||
}
|
||||
@ -237,7 +237,7 @@ public Action:VolAddVolumeCommand(client, argc)
|
||||
// No attributes set.
|
||||
paramcount = 0;
|
||||
}
|
||||
|
||||
|
||||
if (paramcount < 1)
|
||||
{
|
||||
Format(buffer, sizeof(buffer), "No additional attributes set.");
|
||||
@ -246,10 +246,10 @@ public Action:VolAddVolumeCommand(client, argc)
|
||||
{
|
||||
Format(buffer, sizeof(buffer), "Additional attributes set: %d", paramcount);
|
||||
}
|
||||
|
||||
|
||||
// Send enable event to volume.
|
||||
VolOnEnabled(volindex);
|
||||
|
||||
|
||||
ReplyToCommand(client, "Added volume at index %d. %s", volindex, buffer);
|
||||
return Plugin_Handled;
|
||||
}
|
||||
@ -261,42 +261,42 @@ public Action:VolRemoveVolumeCommand(client, argc)
|
||||
{
|
||||
decl String:arg[16];
|
||||
new volindex;
|
||||
|
||||
|
||||
// Check if privileged.
|
||||
if (!ZRIsClientPrivileged(client, OperationType_Configuration))
|
||||
{
|
||||
TranslationReplyToCommand(client, "No access to command");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
|
||||
if (argc < 1)
|
||||
{
|
||||
// Write syntax info.
|
||||
ReplyToCommand(client, "Removes an existing volume in the map. Usage: zr_vol_remove <volume index>");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
|
||||
// Get volume index.
|
||||
GetCmdArg(1, arg, sizeof(arg));
|
||||
volindex = StringToInt(arg);
|
||||
|
||||
|
||||
// Validate index.
|
||||
if (!VolIsValidIndex(volindex))
|
||||
{
|
||||
ReplyToCommand(client, "Invalid volume index.");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
|
||||
// Check if volume exist.
|
||||
if (!Volumes[volindex][Vol_InUse])
|
||||
{
|
||||
ReplyToCommand(client, "Volume %d doesn't exist.", volindex);
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
|
||||
// Remove volume.
|
||||
VolRemove(volindex);
|
||||
|
||||
|
||||
ReplyToCommand(client, "Successfully disabled and removed volume %d.", volindex);
|
||||
return Plugin_Handled;
|
||||
}
|
||||
@ -310,14 +310,14 @@ public Action:VolListCommand(client, argc)
|
||||
decl String:linebuffer[128];
|
||||
decl String:valuebuffer[32];
|
||||
decl String:arg[16];
|
||||
|
||||
|
||||
buffer[0] = 0;
|
||||
linebuffer[0] = 0;
|
||||
|
||||
|
||||
new volindex;
|
||||
new volcount;
|
||||
new volcache[VolumeAttributes];
|
||||
|
||||
|
||||
if (argc < 1)
|
||||
{
|
||||
// No volume specified. Display syntax and list volumes.
|
||||
@ -325,7 +325,7 @@ public Action:VolListCommand(client, argc)
|
||||
StrCat(buffer, sizeof(buffer), "ID: Type: Min loc: Max loc:\n");
|
||||
StrCat(buffer, sizeof(buffer), "--------------------------------------------------------------------------------");
|
||||
ReplyToCommand(client, buffer);
|
||||
|
||||
|
||||
// Loop through all indexes.
|
||||
for (volindex = 0; volindex < ZR_VOLUMES_MAX; volindex++)
|
||||
{
|
||||
@ -334,7 +334,7 @@ public Action:VolListCommand(client, argc)
|
||||
{
|
||||
// Cache volume data.
|
||||
volcache = Volumes[volindex];
|
||||
|
||||
|
||||
// Add to list.
|
||||
VolTypeToString(volcache[Vol_Type], valuebuffer, sizeof(valuebuffer), true);
|
||||
Format(linebuffer, sizeof(linebuffer), "%-4d %-15s %-8.2f %-8.2f %-8.2f %-8.2f %-8.2f %-8.2f",
|
||||
@ -346,12 +346,12 @@ public Action:VolListCommand(client, argc)
|
||||
volcache[Vol_xMax],
|
||||
volcache[Vol_yMax],
|
||||
volcache[Vol_zMax]);
|
||||
|
||||
|
||||
ReplyToCommand(client, linebuffer);
|
||||
volcount++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Format(linebuffer, sizeof(linebuffer), "\nTotal volumes: %d", volcount);
|
||||
ReplyToCommand(client, linebuffer);
|
||||
return Plugin_Handled;
|
||||
@ -359,73 +359,73 @@ public Action:VolListCommand(client, argc)
|
||||
else
|
||||
{
|
||||
// Dump data for the specified volume.
|
||||
|
||||
|
||||
// Get volume index.
|
||||
GetCmdArg(1, arg, sizeof(arg));
|
||||
volindex = StringToInt(arg);
|
||||
|
||||
|
||||
// Validate index.
|
||||
if (!VolIsValidIndex(volindex))
|
||||
{
|
||||
ReplyToCommand(client, "The specified volume index is invalid: %d", volindex);
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
|
||||
// Check if unused.
|
||||
if (!VolInUse(volindex))
|
||||
{
|
||||
ReplyToCommand(client, "The specified volume doesn't exist: %d.", volindex);
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
|
||||
// Cache volume data.
|
||||
volcache = Volumes[volindex];
|
||||
|
||||
|
||||
// Dump generic volume data.
|
||||
Format(linebuffer, sizeof(linebuffer), "Volume data at index %d:\n", volindex);
|
||||
StrCat(buffer, sizeof(buffer), linebuffer);
|
||||
StrCat(buffer, sizeof(buffer), "--------------------------------------------------------------------------------");
|
||||
ReplyToCommand(client, buffer);
|
||||
|
||||
|
||||
// Clear buffer.
|
||||
buffer[0] = 0;
|
||||
|
||||
|
||||
Format(linebuffer, sizeof(linebuffer), "ID: %d\n", volindex);
|
||||
StrCat(buffer, sizeof(buffer), linebuffer);
|
||||
|
||||
|
||||
Format(linebuffer, sizeof(linebuffer), "Enabled: %d\n", volcache[Vol_Enabled]);
|
||||
StrCat(buffer, sizeof(buffer), linebuffer);
|
||||
|
||||
|
||||
VolTypeToString(volcache[Vol_Type], valuebuffer, sizeof(valuebuffer));
|
||||
Format(linebuffer, sizeof(linebuffer), "Type: %s\n", valuebuffer);
|
||||
StrCat(buffer, sizeof(buffer), linebuffer);
|
||||
|
||||
|
||||
Format(linebuffer, sizeof(linebuffer), "Min loc: %-8.2f %-8.2f %-8.2f\n", volcache[Vol_xMin], volcache[Vol_yMin], volcache[Vol_zMin]);
|
||||
StrCat(buffer, sizeof(buffer), linebuffer);
|
||||
|
||||
|
||||
Format(linebuffer, sizeof(linebuffer), "Max loc: %-8.2f %-8.2f %-8.2f\n", volcache[Vol_xMax], volcache[Vol_yMax], volcache[Vol_zMax]);
|
||||
StrCat(buffer, sizeof(buffer), linebuffer);
|
||||
|
||||
|
||||
VolEffectToString(volcache[Vol_Effect], valuebuffer, sizeof(valuebuffer));
|
||||
Format(linebuffer, sizeof(linebuffer), "Effect: %s\n", valuebuffer);
|
||||
StrCat(buffer, sizeof(buffer), linebuffer);
|
||||
|
||||
|
||||
Format(linebuffer, sizeof(linebuffer), "Effect color: %d, %d, %d\n", volcache[Vol_EffectColor][0], volcache[Vol_EffectColor][1], volcache[Vol_EffectColor][2]);
|
||||
StrCat(buffer, sizeof(buffer), linebuffer);
|
||||
|
||||
|
||||
VolTeamToString(volcache[Vol_TeamFilter], valuebuffer, sizeof(valuebuffer));
|
||||
Format(linebuffer, sizeof(linebuffer), "Team filter: %s\n", valuebuffer);
|
||||
StrCat(buffer, sizeof(buffer), linebuffer);
|
||||
|
||||
|
||||
Format(linebuffer, sizeof(linebuffer), "Trigger delay: %.2f", volcache[Vol_TriggerDelay]);
|
||||
StrCat(buffer, sizeof(buffer), linebuffer);
|
||||
|
||||
|
||||
// Print generic attributes.
|
||||
ReplyToCommand(client, buffer);
|
||||
|
||||
|
||||
// Clear buffer.
|
||||
buffer[0] = 0;
|
||||
|
||||
|
||||
// Get type spesific attributes.
|
||||
switch (volcache[Vol_Type])
|
||||
{
|
||||
@ -438,13 +438,13 @@ public Action:VolListCommand(client, argc)
|
||||
VolClassEditDumpData(volcache[Vol_DataIndex], buffer, sizeof(buffer));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Print type spesific attributes if any.
|
||||
if (strlen(buffer) > 0)
|
||||
{
|
||||
ReplyToCommand(client, buffer);
|
||||
}
|
||||
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
||||
}
|
||||
@ -453,41 +453,41 @@ public Action:VolDumpStatesCommand(client, argc)
|
||||
{
|
||||
decl String:target[64];
|
||||
new targetclient;
|
||||
|
||||
|
||||
// Check if privileged.
|
||||
if (!ZRIsClientPrivileged(client, OperationType_Generic))
|
||||
{
|
||||
TranslationReplyToCommand(client, "No access to command");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
|
||||
if (argc < 1)
|
||||
{
|
||||
ReplyToCommand(client, "Dumps volume states for the specified player. Usage: zr_vol_dumpstates <index|targetname>");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
|
||||
// Get target.
|
||||
GetCmdArg(1, target, sizeof(target));
|
||||
targetclient = FindTarget(client, target);
|
||||
|
||||
|
||||
// Validate target.
|
||||
if (targetclient <= 0)
|
||||
{
|
||||
// Note: FindTarget automatically print error messages.
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
|
||||
// Print header.
|
||||
ReplyToCommand(client, "Volume ID: Player in volume:\n----------------------------------------");
|
||||
|
||||
|
||||
// Get player states.
|
||||
new bool:statebuffer[ZR_VOLUMES_MAX];
|
||||
VolGetPlayerStates(targetclient, statebuffer, sizeof(statebuffer));
|
||||
|
||||
|
||||
// Set language.
|
||||
SetGlobalTransTarget(client);
|
||||
|
||||
|
||||
// Loop through each volume.
|
||||
for (new volumeindex = 0; volumeindex < ZR_VOLUMES_MAX; volumeindex++)
|
||||
{
|
||||
@ -498,7 +498,7 @@ public Action:VolDumpStatesCommand(client, argc)
|
||||
ReplyToCommand(client, "%-11d %t", volumeindex, statebuffer[volumeindex] ? "Yes" : "No");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
@ -522,30 +522,30 @@ VolAdd(volumeIndex = -1, Float:locMin[3], Float:locMax[3], VolumeFeatureTypes:vo
|
||||
// Get a free volume index.
|
||||
volumeIndex = VolGetFreeVolume();
|
||||
}
|
||||
|
||||
|
||||
// Validate index.
|
||||
if (VolIsValidIndex(volumeIndex))
|
||||
{
|
||||
// Mark volume as enabled and in use.
|
||||
Volumes[volumeIndex][Vol_Enabled] = true;
|
||||
Volumes[volumeIndex][Vol_InUse] = true;
|
||||
|
||||
|
||||
// Set location data.
|
||||
Volumes[volumeIndex][Vol_xMin] = locMin[0];
|
||||
Volumes[volumeIndex][Vol_yMin] = locMin[1];
|
||||
Volumes[volumeIndex][Vol_zMin] = locMin[2];
|
||||
|
||||
|
||||
Volumes[volumeIndex][Vol_xMax] = locMax[0];
|
||||
Volumes[volumeIndex][Vol_yMax] = locMax[1];
|
||||
Volumes[volumeIndex][Vol_zMax] = locMax[2];
|
||||
|
||||
|
||||
// Set type.
|
||||
Volumes[volumeIndex][Vol_Type] = volumeType;
|
||||
Volumes[volumeIndex][Vol_DataIndex] = dataIndex;
|
||||
|
||||
|
||||
// Update number of volumes.
|
||||
VolumeCount++;
|
||||
|
||||
|
||||
// Return the new index.
|
||||
return volumeIndex;
|
||||
}
|
||||
@ -569,7 +569,7 @@ bool:VolRemove(volumeIndex)
|
||||
{
|
||||
// Trigger event to clean up data and stop timers.
|
||||
VolOnDisabled(volumeIndex);
|
||||
|
||||
|
||||
// Clear feature data.
|
||||
switch (Volumes[volumeIndex][Vol_Type])
|
||||
{
|
||||
@ -578,10 +578,10 @@ bool:VolRemove(volumeIndex)
|
||||
VolAnticampReset(Volumes[volumeIndex][Vol_DataIndex]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Clear volume data.
|
||||
VolClear(volumeIndex);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@ -600,20 +600,20 @@ VolClear(volumeIndex)
|
||||
{
|
||||
Volumes[volumeIndex][Vol_Enabled] = false;
|
||||
Volumes[volumeIndex][Vol_InUse] = false;
|
||||
|
||||
|
||||
Volumes[volumeIndex][Vol_xMin] = 0.0;
|
||||
Volumes[volumeIndex][Vol_yMin] = 0.0;
|
||||
Volumes[volumeIndex][Vol_zMin] = 0.0;
|
||||
|
||||
|
||||
Volumes[volumeIndex][Vol_xMax] = 0.0;
|
||||
Volumes[volumeIndex][Vol_yMax] = 0.0;
|
||||
Volumes[volumeIndex][Vol_zMax] = 0.0;
|
||||
|
||||
|
||||
Volumes[volumeIndex][Vol_Effect] = VolEffect_None;
|
||||
Volumes[volumeIndex][Vol_EffectColor][0] = 0;
|
||||
Volumes[volumeIndex][Vol_EffectColor][1] = 0;
|
||||
Volumes[volumeIndex][Vol_EffectColor][2] = 0;
|
||||
|
||||
|
||||
new dataindex = Volumes[volumeIndex][Vol_DataIndex];
|
||||
if (dataindex >= 0)
|
||||
{
|
||||
@ -629,10 +629,10 @@ VolClear(volumeIndex)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Volumes[volumeIndex][Vol_Type] = VolFeature_Invalid;
|
||||
Volumes[volumeIndex][Vol_DataIndex] = -1;
|
||||
|
||||
|
||||
Volumes[volumeIndex][Vol_TeamFilter] = VolTeam_All;
|
||||
Volumes[volumeIndex][Vol_TriggerDelay] = 0.0;
|
||||
}
|
||||
@ -664,39 +664,39 @@ VolSetAttributes(volumeIndex, const String:attributes[])
|
||||
new dataindex;
|
||||
decl String:attribName[64];
|
||||
decl String:attribValue[256];
|
||||
|
||||
|
||||
// Validate volume index.
|
||||
if (!VolIsValidIndex(volumeIndex))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
// Count attributes.
|
||||
attribCount = GetParameterCount(attributes);
|
||||
|
||||
|
||||
// Check if empty.
|
||||
if (!attribCount)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
// Get volumetric feature type.
|
||||
voltype = Volumes[volumeIndex][Vol_Type];
|
||||
|
||||
|
||||
// Get feature data index.
|
||||
dataindex = Volumes[volumeIndex][Vol_DataIndex];
|
||||
|
||||
|
||||
// Loop through all attributes.
|
||||
for (new attrib = 0; attrib < attribCount; attrib++)
|
||||
{
|
||||
// Get attribute name.
|
||||
GetParameterName(attribName, sizeof(attribName), attributes, attrib);
|
||||
|
||||
|
||||
// Get attribute value.
|
||||
GetParameterValue(attribValue, sizeof(attribValue), attributes, attribName);
|
||||
|
||||
|
||||
LogEvent(_, LogType_Normal, LOG_DEBUG, LogModule_Volfeatures, "Set attribute", "Got parameter: \"%s\" = \"%s\"", attribName, attribValue);
|
||||
|
||||
|
||||
// Check generic attributes.
|
||||
if (StrEqual(attribName, "teamfilter", false))
|
||||
{
|
||||
@ -738,7 +738,7 @@ VolSetAttributes(volumeIndex, const String:attributes[])
|
||||
successfulCount++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Pass attribute onto the volumetric feature attribute handler.
|
||||
else
|
||||
{
|
||||
@ -761,7 +761,7 @@ VolSetAttributes(volumeIndex, const String:attributes[])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Return number of successfully attributes set.
|
||||
return successfulCount;
|
||||
}
|
||||
|
@ -39,9 +39,9 @@ VolOnPlayerEnter(client, volumeIndex)
|
||||
// Volumetric features disabled.
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LogEvent(_, LogType_Normal, LOG_DEBUG, LogModule_Volfeatures, "Event", "Player %N entered volume %d.", client, volumeIndex);
|
||||
|
||||
|
||||
// Forward event to features.
|
||||
new VolumeFeatureTypes:voltype = Volumes[volumeIndex][Vol_Type];
|
||||
switch (voltype)
|
||||
@ -67,9 +67,9 @@ VolOnPlayerLeave(client, volumeIndex)
|
||||
// Volumetric features disabled.
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LogEvent(_, LogType_Normal, LOG_DEBUG, LogModule_Volfeatures, "Event", "Player %N left volume %d.", client, volumeIndex);
|
||||
|
||||
|
||||
// Forward event to features.
|
||||
new VolumeFeatureTypes:voltype = Volumes[volumeIndex][Vol_Type];
|
||||
switch (voltype)
|
||||
@ -98,7 +98,7 @@ VolOnPlayerSpawn(client)
|
||||
// Volumetric features disabled.
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Cache player location.
|
||||
VolUpdatePlayerLocation(client);
|
||||
}
|
||||
@ -118,13 +118,13 @@ VolOnPlayerDeath(client)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Check if volume is disabled.
|
||||
if (!Volumes[volindex][Vol_Enabled])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Check if player is inside the volume.
|
||||
if (VolPlayerInVolume[client][volindex])
|
||||
{
|
||||
@ -144,7 +144,7 @@ VolOnPlayerDisconnect(client)
|
||||
{
|
||||
// Disable trigger delay counters.
|
||||
VolResetCountDown(client);
|
||||
|
||||
|
||||
// Trigger death event to clean up.
|
||||
VolOnPlayerDeath(client);
|
||||
}
|
||||
@ -160,10 +160,10 @@ VolOnRoundStart()
|
||||
// Volumetric features disabled.
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Start main timer.
|
||||
VolStartUpdateTimer();
|
||||
|
||||
|
||||
// Start volumes.
|
||||
VolEnableVolumes();
|
||||
}
|
||||
@ -175,7 +175,7 @@ VolOnRoundEnd()
|
||||
{
|
||||
// Stop main timer.
|
||||
VolStopUpdateTimer();
|
||||
|
||||
|
||||
// Stop volumes.
|
||||
VolDisableVolumes();
|
||||
}
|
||||
@ -201,9 +201,9 @@ VolOnDisabled(volumeIndex)
|
||||
// Volumetric features disabled.
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
new VolumeFeatureTypes:voltype = Volumes[volumeIndex][Vol_Type];
|
||||
|
||||
|
||||
// Forward stop event to features.
|
||||
switch (voltype)
|
||||
{
|
||||
@ -230,9 +230,9 @@ VolOnEnabled(volumeIndex)
|
||||
// Volumetric features disabled.
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
new VolumeFeatureTypes:voltype = Volumes[volumeIndex][Vol_Type];
|
||||
|
||||
|
||||
// Forward enable event to features.
|
||||
switch (voltype)
|
||||
{
|
||||
|
@ -38,25 +38,25 @@ enum VolumeAttributes
|
||||
/* General */
|
||||
bool:Vol_Enabled, /** Volume state. */
|
||||
bool:Vol_InUse, /** Marks if the volume is used. */
|
||||
|
||||
|
||||
/* Location */
|
||||
Float:Vol_xMin, /** Minimum x position. */
|
||||
Float:Vol_xMax, /** Maximum x position. */
|
||||
|
||||
|
||||
Float:Vol_yMin, /** Minimum y position. */
|
||||
Float:Vol_yMax, /** Maximum y position. */
|
||||
|
||||
|
||||
Float:Vol_zMin, /** Minimum z position. */
|
||||
Float:Vol_zMax, /** Maximum z position. */
|
||||
|
||||
|
||||
/* Style */
|
||||
VolumeEffects:Vol_Effect, /** Visual effect to apply on the volume. */
|
||||
Vol_EffectColor[3], /** Render color of the effect. RGB colors. */
|
||||
|
||||
|
||||
/* Data */
|
||||
VolumeFeatureTypes:Vol_Type, /** The volumetric feature type. */
|
||||
Vol_DataIndex, /** Index in remote feature array. */
|
||||
|
||||
|
||||
/* Behaviour */
|
||||
VolumeTeamFilters:Vol_TeamFilter, /** Team filtering. Trigger by certain teams, or all. */
|
||||
Float:Vol_TriggerDelay, /** Trigger delay. How many seconds players have to stay to trigger volume events. */
|
||||
@ -169,11 +169,11 @@ VolInit()
|
||||
{
|
||||
// Clear all volumes.
|
||||
VolClearAll();
|
||||
|
||||
|
||||
// Initialize sub features.
|
||||
VolAnticampInit();
|
||||
VolClassEditInit();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize volumetric feature settings.
|
||||
@ -192,7 +192,7 @@ VolDisable()
|
||||
VolEnabled = false;
|
||||
VolStopUpdateTimer();
|
||||
VolDisableVolumes();
|
||||
|
||||
|
||||
LogEvent(_, LogType_Normal, LOG_DEBUG, LogModule_Volfeatures, "Disabled", "Volfeatures disabled.");
|
||||
}
|
||||
|
||||
@ -204,7 +204,7 @@ VolEnable()
|
||||
VolEnabled = true;
|
||||
VolStartUpdateTimer();
|
||||
VolEnableVolumes();
|
||||
|
||||
|
||||
LogEvent(_, LogType_Normal, LOG_DEBUG, LogModule_Volfeatures, "Enabled", "Volfeatures enabled.");
|
||||
}
|
||||
|
||||
@ -220,7 +220,7 @@ VolDisableVolumes()
|
||||
{
|
||||
// Mark as disabled.
|
||||
Volumes[volindex][Vol_Enabled] = false;
|
||||
|
||||
|
||||
// Trigger player left volume event if inside a volume.
|
||||
for (new client = 1; client <= MaxClients; client++)
|
||||
{
|
||||
@ -229,7 +229,7 @@ VolDisableVolumes()
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Check if player is inside the volume.
|
||||
if (VolPlayerInVolume[client][volindex])
|
||||
{
|
||||
@ -238,7 +238,7 @@ VolDisableVolumes()
|
||||
VolOnPlayerLeave(client, volindex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Trigger disabled event.
|
||||
VolOnDisabled(volindex);
|
||||
}
|
||||
@ -274,22 +274,22 @@ bool:VolStartUpdateTimer()
|
||||
// Volumetric features disabled.
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Stop timer if it exist.
|
||||
VolStopUpdateTimer();
|
||||
|
||||
|
||||
// Get update interval.
|
||||
new Float:interval = GetConVarFloat(g_hCvarsList[CVAR_VOL_UPDATE_INTERVAL]);
|
||||
|
||||
|
||||
// Validate interval.
|
||||
if (interval > 0.0)
|
||||
{
|
||||
// Create a new timer.
|
||||
hVolUpdateTimer = CreateTimer(interval, Event_VolUpdateTimer, _, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
|
||||
|
||||
|
||||
// Also start the trigger delay timer.
|
||||
VolStartTriggerTimer();
|
||||
|
||||
|
||||
// Volumetric features started.
|
||||
return true;
|
||||
}
|
||||
@ -312,10 +312,10 @@ VolStopUpdateTimer()
|
||||
KillTimer(hVolUpdateTimer);
|
||||
hVolUpdateTimer = INVALID_HANDLE;
|
||||
}
|
||||
|
||||
|
||||
// Also stop trigger delay timer.
|
||||
VolStopTriggerTimer();
|
||||
|
||||
|
||||
// Reset all trigger delay counters.
|
||||
VolResetCountDown();
|
||||
}
|
||||
@ -329,16 +329,16 @@ bool:VolStartTriggerTimer()
|
||||
{
|
||||
// Make sure existing timer is killed.
|
||||
VolStopTriggerTimer();
|
||||
|
||||
|
||||
// Get trigger interval and cache it.
|
||||
VolTriggerInterval = GetConVarFloat(g_hCvarsList[CVAR_VOL_TRIGGER_INTERVAL]);
|
||||
|
||||
|
||||
// Validate interval.
|
||||
if (VolTriggerInterval > 0.0)
|
||||
{
|
||||
// Start the timer.
|
||||
hVolTriggerTimer = CreateTimer(VolTriggerInterval, Event_VolTriggerTimer, _, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
|
||||
|
||||
|
||||
// Trigger timer started.
|
||||
return true;
|
||||
}
|
||||
@ -418,7 +418,7 @@ VolUpdatePlayerLocation(client = -1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Save location in array.
|
||||
GetClientAbsOrigin(client, VolPlayerLoc[client]);
|
||||
}
|
||||
@ -433,12 +433,12 @@ VolUpdatePlayerChanges()
|
||||
{
|
||||
new bool:volumeStates[ZR_VOLUMES_MAX];
|
||||
new bool:volumeNewStates[ZR_VOLUMES_MAX];
|
||||
|
||||
|
||||
new bool:newState;
|
||||
new bool:oldState;
|
||||
|
||||
|
||||
new Float:trigger_delay;
|
||||
|
||||
|
||||
// Loop through all players.
|
||||
for (new client = 1; client <= MaxClients; client++)
|
||||
{
|
||||
@ -448,16 +448,16 @@ VolUpdatePlayerChanges()
|
||||
// Skip client.
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Get the current volume states based on player location cache.
|
||||
VolGetPlayerStates(client, volumeStates, sizeof(volumeStates));
|
||||
|
||||
|
||||
// Update player location cache.
|
||||
GetClientAbsOrigin(client, VolPlayerLoc[client]);
|
||||
|
||||
|
||||
// Get new volume states.
|
||||
VolGetPlayerStates(client, volumeNewStates, sizeof(volumeNewStates));
|
||||
|
||||
|
||||
// Loop through each volume and compare states.
|
||||
for (new volumeIndex = 0; volumeIndex < ZR_VOLUMES_MAX; volumeIndex++)
|
||||
{
|
||||
@ -467,30 +467,30 @@ VolUpdatePlayerChanges()
|
||||
// Skip volume.
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Check team filtering on the volume.
|
||||
if (!VolTeamFilterMatch(client, volumeIndex))
|
||||
{
|
||||
// Team filter mismatch.
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
newState = volumeNewStates[volumeIndex];
|
||||
oldState = volumeStates[volumeIndex];
|
||||
|
||||
|
||||
// Check for no change.
|
||||
if (newState == oldState)
|
||||
{
|
||||
// No change. Skip to next volume.
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Check if client entered the volume.
|
||||
if (newState && !oldState)
|
||||
{
|
||||
// Get trigger delay value.
|
||||
trigger_delay = Volumes[volumeIndex][Vol_TriggerDelay];
|
||||
|
||||
|
||||
// Check if the volume has a trigger delay.
|
||||
if (trigger_delay > 0.0)
|
||||
{
|
||||
@ -501,18 +501,18 @@ VolUpdatePlayerChanges()
|
||||
{
|
||||
// Update cache.
|
||||
VolPlayerInVolume[client][volumeIndex] = true;
|
||||
|
||||
|
||||
// No trigger delay, trigger event instantly.
|
||||
VolOnPlayerEnter(client, volumeIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Check if client left the volume.
|
||||
else if (!newState && oldState)
|
||||
{
|
||||
// Make sure count down value is reset.
|
||||
VolPlayerCountDown[client][volumeIndex] = -1.0;
|
||||
|
||||
|
||||
// Only trigger left volume event if player already is in the
|
||||
// volume, so volumes with trigger delay won't get a left event
|
||||
// before the enter event.
|
||||
@ -520,7 +520,7 @@ VolUpdatePlayerChanges()
|
||||
{
|
||||
// Update cache.
|
||||
VolPlayerInVolume[client][volumeIndex] = false;
|
||||
|
||||
|
||||
// Trigger event.
|
||||
VolOnPlayerLeave(client, volumeIndex);
|
||||
}
|
||||
@ -543,7 +543,7 @@ public Action:Event_VolUpdateTimer(Handle:timer)
|
||||
public Action:Event_VolTriggerTimer(Handle:timer)
|
||||
{
|
||||
new Float:countDown;
|
||||
|
||||
|
||||
// Loop through all players.
|
||||
for (new client = 1; client <= MaxClients; client++)
|
||||
{
|
||||
@ -556,29 +556,29 @@ public Action:Event_VolTriggerTimer(Handle:timer)
|
||||
// Not in use or enabled, skip volume.
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Get count down value.
|
||||
countDown = VolPlayerCountDown[client][volumeIndex];
|
||||
|
||||
|
||||
// Check if volume trigger delay is enabled.
|
||||
if (countDown > 0.0)
|
||||
{
|
||||
// Substract by trigger interval.
|
||||
countDown -= VolTriggerInterval;
|
||||
|
||||
|
||||
// Check if time is up.
|
||||
if (countDown <= 0.0)
|
||||
{
|
||||
// Update cache.
|
||||
VolPlayerInVolume[client][volumeIndex] = true;
|
||||
|
||||
|
||||
// Trigger volume enter event.
|
||||
VolOnPlayerEnter(client, volumeIndex);
|
||||
|
||||
|
||||
// Reset count down value.
|
||||
VolPlayerCountDown[client][volumeIndex] = -1.0;
|
||||
}
|
||||
|
||||
|
||||
// Update count down value and continue.
|
||||
VolPlayerCountDown[client][volumeIndex] = countDown;
|
||||
}
|
||||
@ -592,7 +592,7 @@ public Action:Event_VolTriggerTimer(Handle:timer)
|
||||
public VolEnabledChanged(Handle:cvar, const String:oldvalue[], const String:newvalue[])
|
||||
{
|
||||
new bool:isEnabled = bool:StringToInt(newvalue);
|
||||
|
||||
|
||||
if (isEnabled)
|
||||
{
|
||||
// Volumetric features is enabled.
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Zombie:Reloaded
|
||||
*
|
||||
* File: volgenericattributes.inc
|
||||
* Type: Module
|
||||
* Type: Module
|
||||
* Description: Functions for getting or setting general volume attributes.
|
||||
*
|
||||
* Copyright (C) 2009-2013 Greyscale, Richard Helgeby
|
||||
@ -36,13 +36,13 @@
|
||||
stock bool:VolSetTeamString(volumeIndex, const String:team[])
|
||||
{
|
||||
new VolumeTeamFilters:teamfilter;
|
||||
|
||||
|
||||
// Check if string value is empty.
|
||||
if (strlen(team) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Convert value.
|
||||
if (StrEqual(team, "all", false))
|
||||
{
|
||||
@ -56,11 +56,11 @@ stock bool:VolSetTeamString(volumeIndex, const String:team[])
|
||||
{
|
||||
teamfilter = VolTeam_Zombies;
|
||||
}
|
||||
|
||||
|
||||
// Apply value.
|
||||
Volumes[volumeIndex][Vol_TeamFilter] = teamfilter;
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -101,7 +101,7 @@ stock VolTeamToString(VolumeTeamFilters:team, String:buffer[], maxlen, bool:shor
|
||||
return shortName ? strcopy(buffer, maxlen, "zombies") : strcopy(buffer, maxlen, "Zombies");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -110,22 +110,22 @@ stock VolTeamToString(VolumeTeamFilters:team, String:buffer[], maxlen, bool:shor
|
||||
*
|
||||
* @param volumeIndex The volume index to apply to.
|
||||
* @param delay The delay to apply. A floating point number formatted
|
||||
* as a string.
|
||||
* as a string.
|
||||
* @return True if successfully set, false otherwise.
|
||||
*/
|
||||
stock bool:VolSetDelayString(volumeIndex, const String:delay[])
|
||||
{
|
||||
new Float:triggerdelay;
|
||||
|
||||
|
||||
// Check if string value is empty.
|
||||
if (strlen(delay) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Convert value.
|
||||
triggerdelay = StringToFloat(delay);
|
||||
|
||||
|
||||
// Apply value.
|
||||
Volumes[volumeIndex][Vol_TriggerDelay] = triggerdelay;
|
||||
return true;
|
||||
@ -157,7 +157,7 @@ stock bool:VolSetEffectString(volumeIndex, const String:effect[])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Check effect string values and apply them to the volume.
|
||||
if (StrEqual(effect, "none", false))
|
||||
{
|
||||
@ -174,7 +174,7 @@ stock bool:VolSetEffectString(volumeIndex, const String:effect[])
|
||||
Volumes[volumeIndex][Vol_Effect] = VolEffect_Smoke;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// The string value didn't match any valid effects.
|
||||
return false;
|
||||
}
|
||||
@ -217,7 +217,7 @@ stock VolEffectToString(VolumeEffects:effect, String:buffer[], maxlen, bool:shor
|
||||
return shortName ? strcopy(buffer, maxlen, "smoke") : strcopy(buffer, maxlen, "Smoke");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -233,21 +233,21 @@ stock bool:VolSetEffectColorString(volumeIndex, const String:effect_color[])
|
||||
{
|
||||
new String:colors[3][3];
|
||||
new red, green, blue;
|
||||
|
||||
|
||||
// Check if string value is empty.
|
||||
if (strlen(effect_color) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Split values into a string array.
|
||||
ExplodeString(effect_color, ",", colors, 3, 3);
|
||||
|
||||
|
||||
// Convert values.
|
||||
red = StringToInt(colors[0]);
|
||||
green = StringToInt(colors[1]);
|
||||
blue = StringToInt(colors[2]);
|
||||
|
||||
|
||||
// Apply values.
|
||||
Volumes[volumeIndex][Vol_EffectColor][0] = red;
|
||||
Volumes[volumeIndex][Vol_EffectColor][1] = green;
|
||||
@ -285,9 +285,9 @@ stock bool:VolSetEnabledString(volumeIndex, const String:enabled[])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
new bool:val = bool:StringToInt(enabled);
|
||||
|
||||
|
||||
// Check yes or no values first.
|
||||
if (StrEqual(enabled, "yes", false))
|
||||
{
|
||||
@ -297,7 +297,7 @@ stock bool:VolSetEnabledString(volumeIndex, const String:enabled[])
|
||||
{
|
||||
val = false;
|
||||
}
|
||||
|
||||
|
||||
// Check if the new value is different from the current.
|
||||
if (Volumes[volumeIndex][Vol_Enabled] != val)
|
||||
{
|
||||
@ -311,7 +311,7 @@ stock bool:VolSetEnabledString(volumeIndex, const String:enabled[])
|
||||
VolOnDisabled(volumeIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Apply converted value.
|
||||
Volumes[volumeIndex][Vol_Enabled] = val;
|
||||
return true;
|
||||
|
@ -40,7 +40,7 @@ bool:IsPointInLocation(Float:point[3], Float:min[3], Float:max[3])
|
||||
new Float:posX = point[0];
|
||||
new Float:posY = point[1];
|
||||
new Float:posZ = point[2];
|
||||
|
||||
|
||||
// Check if within x boundaries.
|
||||
if ((posX >= min[0]) && (posX <= max[0]))
|
||||
{
|
||||
@ -55,7 +55,7 @@ bool:IsPointInLocation(Float:point[3], Float:min[3], Float:max[3])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// The point is outside the location boundaries.
|
||||
return false;
|
||||
}
|
||||
@ -121,7 +121,7 @@ VolGetFreeVolume()
|
||||
return volumeIndex;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// No free volumes found.
|
||||
return -1;
|
||||
}
|
||||
@ -145,7 +145,7 @@ VolGetFreeDataIndex(VolumeFeatureTypes:volumeType)
|
||||
return VolClassEditGetFreeIndex();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// No match.
|
||||
return -1;
|
||||
}
|
||||
@ -161,10 +161,10 @@ VolGetFreeDataIndex(VolumeFeatureTypes:volumeType)
|
||||
bool:VolTeamFilterMatch(client, volumeIndex)
|
||||
{
|
||||
new VolumeTeamFilters:filter;
|
||||
|
||||
|
||||
// Chache filter value.
|
||||
filter = Volumes[volumeIndex][Vol_TeamFilter];
|
||||
|
||||
|
||||
switch (filter)
|
||||
{
|
||||
case VolTeam_All:
|
||||
@ -183,7 +183,7 @@ bool:VolTeamFilterMatch(client, volumeIndex)
|
||||
return InfectIsClientInfected(client);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Invalid filter value.
|
||||
return false;
|
||||
}
|
||||
@ -213,10 +213,10 @@ VolGetPlayerStates(client, bool:buffer[], maxlen)
|
||||
{
|
||||
new volumeBuffer[VolumeAttributes];
|
||||
new volCount;
|
||||
|
||||
|
||||
new Float:volMinBuffer[3];
|
||||
new Float:volMaxBuffer[3];
|
||||
|
||||
|
||||
// Loop through all available volumes.
|
||||
for (new volumeIndex = 0; volumeIndex < ZR_VOLUMES_MAX && volumeIndex < maxlen; volumeIndex++)
|
||||
{
|
||||
@ -224,17 +224,17 @@ VolGetPlayerStates(client, bool:buffer[], maxlen)
|
||||
{
|
||||
// Chache volume to avoid re-indexing.
|
||||
volumeBuffer = Volumes[volumeIndex];
|
||||
|
||||
|
||||
// Get min positions.
|
||||
volMinBuffer[0] = volumeBuffer[Vol_xMin];
|
||||
volMinBuffer[1] = volumeBuffer[Vol_yMin];
|
||||
volMinBuffer[2] = volumeBuffer[Vol_zMin];
|
||||
|
||||
|
||||
// Get max positions.
|
||||
volMaxBuffer[0] = volumeBuffer[Vol_xMax];
|
||||
volMaxBuffer[1] = volumeBuffer[Vol_yMax];
|
||||
volMaxBuffer[2] = volumeBuffer[Vol_zMax];
|
||||
|
||||
|
||||
// Check the cached player location.
|
||||
if (IsPointInLocation(VolPlayerLoc[client], volMinBuffer, volMaxBuffer))
|
||||
{
|
||||
@ -249,7 +249,7 @@ VolGetPlayerStates(client, bool:buffer[], maxlen)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return volCount;
|
||||
}
|
||||
|
||||
@ -266,7 +266,7 @@ VolumeFeatureTypes:VolGetTypeFromString(const String:volType[])
|
||||
{
|
||||
return VolFeature_Invalid;
|
||||
}
|
||||
|
||||
|
||||
// Match types.
|
||||
if (StrEqual(volType, "anticamp", false))
|
||||
{
|
||||
@ -276,7 +276,7 @@ VolumeFeatureTypes:VolGetTypeFromString(const String:volType[])
|
||||
{
|
||||
return VolFeature_ClassEdit;
|
||||
}
|
||||
|
||||
|
||||
// No match.
|
||||
return VolFeature_Invalid;
|
||||
}
|
||||
@ -308,6 +308,6 @@ VolTypeToString(VolumeFeatureTypes:volType, String:buffer[], maxlen, bool:shortN
|
||||
return shortName ? strcopy(buffer, maxlen, "classedit") : strcopy(buffer, maxlen, "Class Editor");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user