AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   Bet (https://forums.alliedmods.net/showthread.php?t=116085)

vilaemail 01-19-2010 16:13

Bet
 
2 Attachment(s)
Bet
v2.2

by Filip Viličić (Vilicic)
[IMG]http://img143.**************/img143/7462/unclaimedmoney200cs0122.jpg[/IMG]

Notes to plugin approver:
Plugin still under development.
Please put as author: Filip Vilicic.
Thanks.
The story:
I made this plugin about 9 months ago and it had a lot of bugs. Then 3 months ago I worked again on it and fixed a lot of bugs and upgraded whole plugin. Then I used it on one server and after a few suggestions fixed (hopefully) all bugs. I made 15-20 plugins, but this is first one I made publicly available. Others are either small helpful plugins that could not be generalized and published or have bugs and I am to lazy to get rid of them. Anyway, I hope you like the plugin. Cheers.
Short description:
Player can bet which team will win. After successful placing of a bet, player will loose money (amount of a bet), and at and of the round (if player placed bet for the winning team) he will get deserved money. The amount player will get is determined by odds system. There are two odds systems available:
  • New (How to set-up) (What is the formula? :))
    Calculation is based on number of alive players, their stats and time left in current round. Player stats is made of three components:
    • Frags
    • Deaths
    • Health
  • Old (How to set-up)
    Calculation is based only on number of alive players
Installation:
  • Text file goes in "addons\amxmodx\data\lang\" folder
  • The sma file must be compiled locally/online and the output .amxx file will go in "addons\amxmodx\plugins\" folder
  • Add "bet.amxx" line in "addons\amxmodx\configs\plugins.ini"
Usage:
Simply follow installation instructions. If you would like to customize plugin or use advanced commands read further.

Cvar list:
  • bet_oddssystem <0|1> (def. 1) - Determinates what odds calculating system to use, new or old one. Comparison.
    To set-up new odds system:
    • bet_oddssystem 1
    To set-up old odds system:
    • bet_oddssystem 0
  • bet_chatenabled <0|1> (def. 1) - Will clients interaction with bet plugin be public (printed in chat)
  • bet_mustbedead <0|1> (def. 1) - If set to zero player can bet when alive, if set to one player can't bet when alive.
  • bet_adsenabled <0|1> (def. 1) - If set to one player will see help on how to bet after each death, if set to zero he will not see it.
Command list:
  • amx_advertisebet - Advertises plugin to all players immediately. Takes no parameters. Needs ADMIN_CVAR access.
  • say /advertisebet - Advertises plugin to all players immediately. Takes no parameters. Needs ADMIN_CVAR access.
Detailed description:
For a player to place a successful bet he/she must satisfy these conditions:
  • Bet is properly formatted
  • Both teams are alive (at least one team member is alive)
  • Player placing bet is dead
  • Player placing bet has more (or same) amount of money that is provided
Player that dies gets this message (sort of advertising the script):
"^x01 ^x03 **Type ^x04 ^"bet^" ^x03 for help with betting! Type ^x04 ^"odds^" ^x03 for chances to win! **"

Proper full bet is:

bet TEAM AMOUNT

Examples:
  • bet ct 500
  • bet t all
  • bet t half
Plugin responses to following bet's are:
  • bet -> Use ^"bet team amount^" to bet. Examples: ^"bet t all^" or ^"bet ct 250^" or ^"bet t half^"
  • bet t OR bet ct -> Amount not provided. Please type ^"bet^" to get further help.
  • bet lol OR bet lol 100 -> Invalid team name ^"%s^". Please use t or ct to target a team.
  • bet ct lol -> Invalid amount ^"%s^". Please use all, half or any other numeric amount.
  • bet ct 15000 (while having 5000) -> You have $ %d, you can not bet $ %d.
  • If player is alive -> You can only bet if you are dead.
  • If one of the teams is dead -> You can not bet when one of the teams is dead!
  • If player has no money -> You don't have money to bet with!
  • If bet is already placed -> You have already placed your bet!
  • bet t all -> Bet placed. Odds are %d to %d You stand to win $ %d on top of your $ %d bet.
  • odds -> Odds are %d to %d. OR Odds are %d to %d if you bet for terrorists.
At the end of the round player receives one of the following messages:
  • You won $ %d.
  • You lost your $ %d bet.
For curious ones, the correct formula for new odds system is (currently):
  • All players are "worth" between 0.5 and 2.0.
  • Only alive players worth is calculated
  • Each player with negative frags has starting worth of 0.0 (eg. real worth will be 0.5)
  • Each player with frags+deaths <= 4 has starting worth of 1.0 else his starting worth will be = frags / (deaths + 1)
  • Starting worth is changed based on players health and we get the real worth of player.
    [Health]; [Real worth]
    • 1 - 10; Starting worth * 0.25
    • 11 - 20; Starting worth * 0.35
    • 21 - 40; Starting worth * 0.5
    • 41 - 60; Starting worth * 0.75
    • 61 - 80; Starting worth
    • 81 - 100;Starting worth * 1.25
  • If real worth is less than 0.5 it is changed to 0.5 and if real worth is larger than 2.0 it is changed to 2.0
  • All Real worth's are summed up together to get Simple odds (float)
  • From simple odds we get real odds (the ones that are used).
  • If round is ended or freezetime is active real odds are simple odds else formula tests if map is de_ and if bomb is planted. Based on that we have three cases:
    1. Map is not de_
      [Time remaining]; [Real odds]
      • 0 - 5; CT odds * 5
      • 6 - 10; CT odds * 2
      • 11 - 15; CT odds * 1.5
      • 16 - 30; CT odds * 1.15
      • 31+; No change
    2. Map is de_ and c4 is planted:
      [Time until explosion]; [Real odds]
      • 0 - 5; T odds * 2
      • 6 - 10; T odds * 1.5
      • 11 - 25; No change
      • 26+; CT odds * 1.2
    3. Map is de_ and c4 is not planted:
      [Time remaining]; [Real odds]
      • 0 - 5; CT odds * 5
      • 6 - 10; CT odds * 2
      • 11 - 15; CT odds * 1.5
      • 16 - 30; CT odds * 1.15
      • 31+; No change
  • Real odds are then used as odds.
Formula is still to be improved. Suggestions are welcome.
Mods supported:
  • Counter-Strike 1.6
To do:
  • Translate to other languages.
  • Add few more things to new odds system.

Contributors:

Appeal:
If any of you know language that is not supported please translate it.

List of missing translations:
  • Turkish (tr)
  • French (fr)
  • Swedish (sv)
  • Danish (da)
  • Poland (pl)
  • Spanish (es)
  • Brazil Portuguese (bp)
  • Finish (fi)
  • l33t (ls)
  • Bulgarian (bg)
  • Hungarian (hu)
  • Lithuania (lt)
  • Macedonian (mk)
Change log:
v2.2
  • New odds system upgraded. It now checks if c4 is planted and time before c4 explosion or if c4 is not planted time before round end (Thanks to: ConnorMcLeod)
  • Code reorganized
v2.1
  • Odds system improved (odds are divided by their greatest common divisor)
  • Added CsTeams type specifier when declaring team variable
  • Improved code performance when calculating odds (Code first checks if user is in spectators before calculating).
v2.0
  • Added new odds system
  • Added cvar for choosing odds system (bet_oddssystem)
Old change log:
Code:

v1.7b and v1.7c
  • Changed code so compiler  won't throw pointless warning (since rules say that code must not have  warnings no matter how wrong or right they are)

  • Fixed compiler  warnings and useless int tags.

  • Added Romanian translation

v1.7a
  • Optimized  cvar checking

  • Changed cvar bet_addsenabled to  bet_adsenabled

  • Minor code changes

v1.7
  • Made  bet_addsenabled and bet_mustbedead cvars.

  • Made amx_advertisebet  and say /advertisebet commands

  • Updated cvar handling

  • Fixed  say clcmd registration (flags where 0. Changed to ADMIN_USER )

  • Added  Russian and Chinese translation

v1.6
  • Reorganized code

  • Fixed most of the compiler  warnings  (tag mismatch)

  • Updated translations (sk, cz)

v1.5a
  • Changed g_messageTable to const

  • Fixed minor  printing  bug

v1.5
  • Added cvar bet_chatenabled (def. 1)

v1.4
  • Reordered code

  • Optimized code

  • Optimized memory usage

  • Removed Russian translation

v1.3b
  • Improved code performance.

  • Removed some unnecessary  code.

v1.3  and v1.3a
  • Improved code performance.

  • Made code more consistent.

  • Fixed minor bug.

v1.2
  • Updated  translations  (ru, de).

  • Improved code performance.

v1.1
  • Fixed minor typing mistake.

  • Updated translations (nl).


Misc:
Plugin is made by Filip Vilicic (Viličić). And that's me (the guy who is posting).

DarkGod 01-19-2010 16:16

Re: Betting script
 
$ goes before the amount, not after.

Nice to see a new bet plugin which has a lot of features that people have sought for.

vilaemail 01-19-2010 16:21

Re: Betting script
 
Quote:

Originally Posted by DarkGod (Post 1060377)
$ goes before the amount, not after.

Nice to see a new bet plugin which has a lot of features that people have sought for.

Hi! Thanks for a suggestion. It has been fixed. Plugin is now uploaded (attached).

KadiR 01-19-2010 16:28

Re: Betting script
 
You don't need a zip file.
Just upload the .sma and the .txt file seperately here.

Btw, nice plugin!

vilaemail 01-19-2010 16:28

Re: Betting script
 
Quote:

Originally Posted by KadiR (Post 1060398)
You don't need a zip file.
Just upload the .sma and the .txt file seperately here.

Btw, nice plugin!

Thanks, I never published any plugins so I am a little confused :wink:

crazyeffect 01-19-2010 16:33

Re: Bet v1.1
 
Quote:

[nl]
TEAM_DEAD = Je kan niet gokken als er al een team dood is!
TEAM_DEAD_ODDS = Een van de teams is dood!
SAME_ODDS = Kansen zijn %d tegen %d.
DIFF_ODDS = Kansen zijn %d tegen %d als je voor de Terroristem gokt.
BET_HELP = Gebruik ^"bet team amount^" om te gokken. Voorbeelden: ^"bet t all^", ^"bet ct 250^" of ^"bet t half^"
NO_AMOUNT = Hoeveelheid is niet toegestaan. Schrijf ^"bet^" in de chat voor hulp.
INVALID_TEAM = Ongeldige naam van een team: ^"%s^". Gelieve 't' of 'ct' te gebruiken.
NO_MONEY = Je hebt geen geld om mee te gokken!
INVALID_AMOUNT = Ongeldige hoeveelheid: ^"%s^". Gelieve 'all', 'half' of 'any' te gebruiken.
BIGGER_BET = Je hebt $%d, je kan niet voor $%d gokken.
PLAYER_ALIVE = Je kan alleen gokken als je dood bent.
ALREADY_PLACED = Je hebt reeds een gok gewaagd!
BET_PLACED = Gok geplaatst. Kansen zijn %d tegen %d. Je kan $%d winnen bovenop je $%d gok.
BET_WIN = Jij won $%d.
BET_LOST = Je verloor je $%d gok.

vilaemail 01-19-2010 16:44

Re: Bet v1.1
 
Thanks. Your translation has been added.

laziboi72 01-19-2010 16:59

Re: Bet v1.1
 
NICELY DONE!

just75100 01-20-2010 06:31

Re: Bet v1.1
 
https://forums.alliedmods.net/showthread.php?p=677382

why?

floatman 01-20-2010 06:35

Re: Bet v1.1
 
amxmodx and amxmisc aren't modules!


All times are GMT -4. The time now is 05:00.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.