Raised This Month: $66 Target: $400
 16% 

Bet


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Fun Stuff        Approver:   Hawk552 (427)
vilaemail
Member
Join Date: Jan 2009
Location: Tu i tamo, svuda pomalo
Old 01-19-2010 , 17:13   Bet
Reply With Quote #1

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).
Attached Files
File Type: txt bet.txt (8.6 KB, 9852 views)
File Type: sma Get Plugin or Get Source (bet.sma - 16271 views - 18.3 KB)

Last edited by vilaemail; 02-07-2010 at 14:55. Reason: Upgrading to v2.2
vilaemail is offline
DarkGod
SourceMod DarkCrab
Join Date: Jul 2007
Location: Sweden
Old 01-19-2010 , 17:16   Re: Betting script
Reply With Quote #2

$ goes before the amount, not after.

Nice to see a new bet plugin which has a lot of features that people have sought for.
__________________
DarkGod is offline
Send a message via AIM to DarkGod Send a message via MSN to DarkGod
vilaemail
Member
Join Date: Jan 2009
Location: Tu i tamo, svuda pomalo
Old 01-19-2010 , 17:21   Re: Betting script
Reply With Quote #3

Quote:
Originally Posted by DarkGod View Post
$ 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).

Last edited by vilaemail; 01-19-2010 at 17:30. Reason: Fixing typing mistake
vilaemail is offline
KadiR
Unnecessary Member
Join Date: Aug 2008
Location: Zürich / Switzerland
Old 01-19-2010 , 17:28   Re: Betting script
Reply With Quote #4

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

Btw, nice plugin!
KadiR is offline
vilaemail
Member
Join Date: Jan 2009
Location: Tu i tamo, svuda pomalo
Old 01-19-2010 , 17:28   Re: Betting script
Reply With Quote #5

Quote:
Originally Posted by KadiR View Post
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
vilaemail is offline
crazyeffect
Veteran Member
Join Date: Jul 2008
Location: Belgium
Old 01-19-2010 , 17:33   Re: Bet v1.1
Reply With Quote #6

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.
__________________
crazyeffect is offline
Send a message via MSN to crazyeffect
vilaemail
Member
Join Date: Jan 2009
Location: Tu i tamo, svuda pomalo
Old 01-19-2010 , 17:44   Re: Bet v1.1
Reply With Quote #7

Thanks. Your translation has been added.
vilaemail is offline
laziboi72
Senior Member
Join Date: Aug 2009
Location: deathrun_temple
Old 01-19-2010 , 17:59   Re: Bet v1.1
Reply With Quote #8

NICELY DONE!
__________________
Taking a break from modding dunno when i will be back

FAIL, RIGHT HERE
laziboi72 is offline
just75100
Member
Join Date: Oct 2008
Old 01-20-2010 , 07:31   Re: Bet v1.1
Reply With Quote #9

https://forums.alliedmods.net/showthread.php?p=677382

why?
just75100 is offline
floatman
Senior Member
Join Date: Oct 2009
Location: nowhere.
Old 01-20-2010 , 07:35   Re: Bet v1.1
Reply With Quote #10

amxmodx and amxmisc aren't modules!
__________________

floatman is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:59.


Powered by vBulletin®
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Theme made by Freecode