Skocz do zawartości

  • Zaloguj korzystając z Facebooka Zaloguj korzystając z Twittera Zaloguj przez Steam Zaloguj poprzez Google      Logowanie »   
  • Rejestracja

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

randcvar


  • 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:7179
  • Lokalizacja:AMXX.PL
Offline

Napisano 26.02.2013 18:23

Just like the description says, randomizes existing cvars as defined in ...addonssourcemodconfigsrandcvars.cfg file,and then removes itself from memory. I've had a need for something like this and couldn't find anything close enough worth tailoring.Installation depends on how you want to use the plugin.If you want it called for every map, just put randcvar.smx in ...addonssourcemodpluginsand randcvars.cfg in ...addonssourcemodconfigs. Remember that the plugin removes itself from memory after it executes.The plugin recognizes 3 different types of defintions in the cfg file: F (float), I (integer),and L (list). The F type returns a float between the defined low and high values,to the defined precision.The I type returns an integer between the defined low and high values.The L type returns a random string from the listed items.Below is an example.cfg, which is also attached as randcvars.cfg.The first entry is for the cvar mp_roundtime.It's a type F, so it will return a float value between 2.00 (lo) and 3.50 (hi),with 2 decimal places (prec).The second entry is for the cvar bot_difficulty.It's a type I, so it will return an integer value between 0 (lo) and 3 (hi).The third and last entry is for the cvar sm_gg_cfgdirname.It's a type L, so it will return a string value from the listed item.The items are read into key values per the count, so if the count isless than the number of items, items numbered greater than countwill be disregarded. In other words if you have 8 list items, but onlyspecify a count of 2, only the first 2 items will be considered. Ifcount is greater then the number of listed items, the returned stringwill either be the last listed item, or an empty string. For bestresults, your count should always match the number of listed items.This is just an example file to illustrate how the plugin is used.Without a cfg file, the plugin does nothing. Code: //Rename this file to randcvars.cfg and place in ...addonssourcemodconfigs//If there are any errors in the structure, the plugin will abort at that point"Randomized_Cvars"{ "mp_roundtime" //cvar name. Cvar must already exist, plugin does not create new Cvars { "type" "F" //Valid types are F (float), I (integer), and L (list) "prec" "2" //Precision - and interger value representing the number of digits to return // to the right of the decimal point (used only for type F) 1-99 are valid "lo" "2.00" //Lowest possible value to return (used only for types F and I) "hi" "3.50" //Highest possible value to return (used only for types F and I) } "bot_difficulty" //cvar name. Cvar must already exist, plugin does not create new Cvars { "type" "I" //Valid types are F (float), I (integer), and L (list) "lo" "0" //Lowest possible value to return (used only for types F and I) "hi" "3" //Highest possible value to return (used only for types F and I) } "sm_gg_cfgdirname" //cvar name. Cvar must already exist, plugin does not create new Cvars { "type" "L" //Valid types are F (float), I (integer), and L (list) "count" "3" //Number of items in the list (used only in type L). "item 1" "gungame1" //A list item (used only in type L) "item 2" "gungame2" //A list item (used only in type L) "item 3" "gungame3" //A list item (used only in type L) }}It is open source, so tailor to your needs at will :D Attached Files Dołączona grafika Get Plugin or Get Source (randcvar.sp - 7.4 KB) Dołączona grafika randcvars.cfg (1.4 KB)

Wyświetl pełny artykuł




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

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