Skocz do zawartości

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Zdjęcie

Objective Reset + Timer Control [V 0.1]


  • Nie możesz napisać tematu
  • Zaloguj się, aby dodać odpowiedź
Brak odpowiedzi do tego tematu

#1 Adminek AMXX.PL

    Admin :)

  • Bot

Reputacja: 156
Profesjonalista

  • Postów:7 476
  • Lokalizacja:AMXX.PL
Offline

Napisano 08.08.2015 10:54

Objective Reset + Timer Control
Release: 08.08.2015 | Last Update: 08.08.2015

Table of Contents
  • Description
  • Requirements
  • Installation
  • Commands
  • Cvars
  • API
  • Credits
  • Changelog
  • Downloads
Description top

I've worked in the last few weeks at one of my friends request, and it turned in a quite useful and nice plugin, so I decided to post it here. Basically, this plugin have two interconnected parts.

1.Reset the objective

  • Reset the objective:
  • The ideea is that you can reset current round progress as it was at the beginning of the round. For mod like furien/fun/classic it is a nice addon.
  • All default objectives are supported(and can also work in maps with more than one objective):
  • Bomb: if planted, c4 will be removed and given a random player and the round will continue as per usual.
  • Hostages: hostages will be resetted to their old position, no matter if they were rescued/killed/somewhere in the map. When resetting, the number of rescue hostages is set to 0.
  • Vip: when the cmd is used another vip is choosed and he is send to spawn point. The old vip will become a normal player(so he can't trigger round end by reaching escape zone) and the new one get all attributes of a VIP.
  • Escape: I'm not quite sure about that one since I never played es_ maps before, if you want the plugin to do more on that scenario let me know. What it does for now is to reset the number of escapers and send them to tero base.
  • Timer: Reset the round timer as it was when round started(based on mp_roundtime cvar or mp_freezetime if in freezetime). The timer reset is handled as objective, but the command to alter the timer(add/remove seconds) not.

[*]Control the round timer: the ideea is to make changes to round timer that will take effects immediately, it also support freeze time. If someone use the command in freezetime, then freeze will be alterated, else the round time will.

[/list]


Requirements top

You need the fallowing things to get this working:

  • Orpheu module.
  • An updated server without dproto.
    It may work into your outdated server, but if it doesn't, I won't help, it can't do it even if I want to. Older builds require other signatures.

Installation top

To install the plugin:

  • Download the resources from this post. You need to get the source and compile it locally.
  • Put ObjectiveReset.amxx in addons/amxmodx/plugins
  • Open addons/amxmodx/configs/plugins.ini and add at the end of this file ObjectiveReset.amxx
  • You can put the sma file into addons/amxmodx/sources but this is not mandatory.
  • Copy the content of addons/amxmodx/configs/orpheu from the archive to the same folder in your server(functions go to functions, memory to memory, and virtualFunctions to virtualFunctions)
  • Restart the server/change map.
To install orpheu:
  • Download orpheu_files-2.5.1.zip and extrat the arhive.
  • Copy orpheu_amxx.dll/orpheu_amxx_i386.so depending on your operation system into addons/amxmodx/modules
  • The module will be auto-loaded, you don't need to add it into modules.ini
To compile locally:
  • First way:
    • Download AMX Mod X for windows/linux from main site
    • Extract somewhere the arhive and remember the folder!
    • Copy the content from include folder from the orpheu arhive into addons/amxmodx/scripting/include( in the folder created in the step 2 ).
    • Get objective_reset.inc that is attached in the archive and put it inside include.
    • Download the source of the plugin( ObjectiveReset_linux.sma) from this post and drag it over the compile.exe(scripting folder from the arhive created at step 2)
    • It will create a new folder called compiled. Open it and you will find your compiled plugin( ObjectiveReset_linux.amxx )
  • Second way:
    • Go to http://spider.limetech.org/
    • Copy/paste the code from the .sma file into the website.
    • Under the big blue Compile button you see a box which Drop .inc files here
    • Then press Compile and Download

Commands top

  • ResetObjective
    • Valid types are:


      Code: timer/Timer/1
      bomb/Bomb/2
      vip/Vip/3
      hostages/Hostages/4
      escape/Escape/5
      detect/Detect/6
    • I've explained above what all of this resets, the name are intuitive. If you specify detect, then the objective will be auto-detected. In case of maps with more than one objective, the first found one will be returned.
    • For auto detection, the order of checking is: bomb -> hostages -> vip -> escape -> timer. In case no objective is found timer will be resetted.
    • Only the first letter is needed, so you can write b/h/v/e/d or the numbers and it will work.
    • Examples:


      Code: ResetObjective b //reset bomb objective
      ResetObjective h //reset hostage objective
      ResetObjective t //reset timer objective
      ResetObjective e //reset escape objective
      ResetObjective d //automatically detect and reset the objective
  • SetRoundTime
    • Param Time: this is the time(in seconds) that you want to set/add.
    • Param Add: if 1 the time will be added to current round time, else it will set this time.
    • When adding you can specify negative values so it will work like substracting.
    • Examples:


      Code: SetRoundTime 10 0 //sets round time/freeze time to 10 seconds
      SetRoundTime 10 1 //add 10 seconds to current round time/ freeze time
      SetRoundTime -10 1 //substract 10 seconds from current round time/freeze time
    • Changes take place immediately!
    • If you try to specify a negative value when setting it will be handled as positive value.
  • GetRoundTime
    • This will print in player console the remained time from the round, in seconds.

Cvars top

  • OR_ShowChatMessage: 1 to notify players in chat that the objective was resetted/0 to do not.
  • OR_SendHookableCalls: If you don't know what you are doing, avoid this cvar please. This plugin calls some of game functions to do what id does, this functions may be hooked by other plugins. If this cvar is set to 1, every plugin that hook one of the function will know about this call and execute it's one code, if not it will be ignored. My reasoning behind this cvar was that you may run some incompatible plugins that supercede the hooks or whatever and you may want them to work at the same time, without interfering. As oposite, you may want your plugins to receive this calls and do something. Default value is 0. If 1 other plugins are noticed, if 0 they are not.
  • OR_SendReliableMessages: as above, please don't touch this cvar is you don't understand it's purpose or if it is not needed. A reliable message is send to player on reliable channel, and if you send too many messages the client will be disconnected. An unreliable message won't disconnect the client and won't be simply send if something went wrong(but you will get some gameplaye problems as round time not being updated correctly). If you experience some problems set this cvar to 0. 1 for reliable messages, 0 for unreliable.

API top

I will start by leaving here the include file:


PHP Code:


#if defined _objective_reset_included
#endinput
#endif
#define _objective_reset_included

enum
{
Obj_InvalidObjective,
Obj_ResetTimer,
Obj_ResetBomb,
Obj_ResetVip,
Obj_ResetHostages,
Obj_ResetEscape,
Obj_DetectObjective
}

/**
* Reset the current objective(for objective index see the above enum)
*
* @param Objective The objective to restart.
* @return 1 if operation was succesfull, 0 otherwise
*/
native ResetObjective(Objective)

/**
* Alter the round time value.
*
* @param Time The time that will be used.
* @param Add If 1 the time will be added to current time, 0 means set.
* @return 1 if operation was succesfull, 0 otherwise
*/
native SetRoundTime(const Time, const Add)

/**
* Return the value of round time/freeze time in seconds
*
* @param No params
* @return Round time in seconds or -1 on failure
*/
native GetRoundTime()

/**
* Send when an objective was resetted
*
* @param Objective The objective that was resetted.
* @return Forward does not care about the return value
*/
forward OnObjectiveReset(const Objective)

/**
* Send when time is changed.
*
* @param TimeType 1 if in freezetime, 0 otherwise
* @param OldRoundTime The round time before change occured.
* @param NewRoundTime The round time after change occured.
* @param RemainedTime The remained time from the round.
* @return Forward does not care about the return value
*/
forward OnRoundTimeChanged(const TimeType, const OldRoundTime, const NewRoundTime, const RemainedTime)
I believe everything is well documented and I won't explain again. Only one note, when using natives the message are still printed, but they go into server console, with one exception.

Credits top

  • Nubo: ideea + testing
  • ANTICHRISTUS: made wp for some maps so I was able to test

ChangeLog top

  • V 0.1: Initial release

Downloads <a href="#top">top

  • V 0.1-



Attached Files Dołączona grafikaObjective Reset.zip (13.0 KB) Dołączona grafikaobjective_reset.inc (1.7 KB) Dołączona grafikaGet Plugin or Get Source (ObjectiveReset.sma - 23.3 KB)

Wyświetl pełny artykuł




Użytkownicy przeglądający ten temat: 0

0 użytkowników, 0 gości, 0 anonimowych