Raised This Month: $51 Target: $400
 12% 

Bet


Post New Thread Reply   
 
Thread Tools Display Modes
kobatz
Junior Member
Join Date: Mar 2008
Old 01-20-2010 , 07:33   Re: Bet v1.1
Reply With Quote #11

Very nice,will test it ;) Tnx
kobatz is offline
rdrag
New Member
Join Date: Jan 2010
Old 01-20-2010 , 09:20   Re: Bet v1.1
Reply With Quote #12

Here is my russian translation:
Quote:
[ru]
TEAM_DEAD = Вы не можете делать ставки, когда вся команда мертва!
TEAM_DEAD_ODDS = Одна из команд мертва!
SAME_ODDS = Шансы: %d к %d.
DIFF_ODDS = Шансы %d к %d если вы сделаете ставку на террористов.
BET_HELP = Чтобы сделать ставку, напишите в чат ^"bet <команда> <кол-во денег>^".
NO_AMOUNT = Не задано кол-во денег. Напишите ^"bet^" для получения помощи.
INVALID_TEAM = Неверное название команды ^"%s^". Используйте "t" или "ct".
NO_MONEY = У вас не хватает денег!
INVALID_AMOUNT = Неверная сумма ^"%s^". Используйте "all", "half" или численное значение.
BIGGER_BET = У вас на счету $%d, поэтому вы не можете поставить $%d.
PLAYER_ALIVE = Вы можете делать ставки, когда мертвы!
ALREADY_PLACED = Вы уже сделали ставку!
BET_PLACED = Ставка сделана. Ваши шансы %d к %d. Вы выиграете $%d сверх вашей ставки $%d.
BET_WIN = Вы выиграли $%d.
BET_LOST = Вы проиграли $%d.

Last edited by rdrag; 01-20-2010 at 09:26. Reason: problems with codepage
rdrag is offline
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 01-20-2010 , 10:15   Re: Bet v1.1
Reply With Quote #13

Nice. I need a good bet plugin in the near future. Will take a look at it later.

German:
Code:
[de]
TEAM_DEAD = Du kannst nicht setzen wenn eines der Teams bereits tot ist!
TEAM_DEAD_ODDS = Eines der Teams ist tot!
SAME_ODDS = Die Chancen stehen %d zu %d.
DIFF_ODDS = Die Chancen stehen %d zu %d wenn du auf die Terroristen setzt.
BET_HELP = Benutze ^"bet team amount^" um zu setzen. Beispiele: ^"bet t all^" oder ^"bet ct 250^" oder ^"bet t half^"
NO_AMOUNT = Betrag nicht angegeben. Bitte tippe ^"bet^" ein um die Hilfe aufzurufen.
INVALID_TEAM = Falscher Team Name ^"%s^". Bitte benutze t oder ct um ein Team zu wählen.
NO_MONEY = Du hast kein Geld um zu setzen!
INVALID_AMOUNT = Falscher Betrag ^"%s^". Bitte benutze all, half oder eine Zahl als Mengenangabe.
BIGGER_BET = Du hast %d$, du kannst keine %d$ setzen.
PLAYER_ALIVE = Du kannst nur setzen wenn du tot bist.
ALREADY_PLACED = Du hast bereits gesetzt.
BET_PLACED = Wetteinsatz gesetzt. Chancen stehen %d zu %d. Du kannst %d$ zusaetzlich zu deinem Einsatz von %d$ gewinnen.
BET_WIN = Du hast %d$ gewonnen.
BET_LOST = Du hast deinen Wetteinsatz von %d$ verloren.
/edit: Code suggestions
- compare_array -> equali. Why do you code an own implementation when you got equal(i). equali is in fact better because you don't force people to only write lowercase.
- Hook "say bet " instead of "say". You halt the function if the first word is not bet anyway.
- in function FindOdds you can do switch(cs_get_user_team(x)) directly. The team variable is not necessary.
- You are actually commenting which code blocks are closed at what point. This relates to the poor, or at least inconsistent, indentation. You should rethink that.
- You should check whether the user is alive directly after you know that he wants to place the bet. You did a lot of stuff that you don't need when you find out hes alive in the Bet function.
- In the Bet function you are again checking whether FindOdds returns 0. The functions will execute one after another without a delay, impossible that the situation changes between the two FindOdds calls.

There are probably more possibilities to improve.
__________________
In Flames we trust!

Last edited by Nextra; 01-20-2010 at 10:34.
Nextra is offline
vilaemail
Member
Join Date: Jan 2009
Location: Tu i tamo, svuda pomalo
Old 01-20-2010 , 13:53   Re: Bet v1.1
Reply With Quote #14

Quote:
Originally Posted by Nextra View Post
Nice. I need a good bet plugin in the near future. Code suggestions
- compare_array -> equali. Why do you code an own implementation when you got equal(i). equali is in fact better because you don't force people to only write lowercase.
- Hook "say bet " instead of "say". You halt the function if the first word is not bet anyway.
- in function FindOdds you can do switch(cs_get_user_team(x)) directly. The team variable is not necessary.
- You are actually commenting which code blocks are closed at what point. This relates to the poor, or at least inconsistent, indentation. You should rethink that.
- You should check whether the user is alive directly after you know that he wants to place the bet. You did a lot of stuff that you don't need when you find out hes alive in the Bet function.
- In the Bet function you are again checking whether FindOdds returns 0. The functions will execute one after another without a delay, impossible that the situation changes between the two FindOdds calls.

There are probably more possibilities to improve.
-will use equali, thanks.
-say bet can not be hooked. look here: http://forums.alliedmods.net/showthread.php?t=103434
-Team variable IS necessary because I am checking which team he placed bet on (not the team he is on!)
-OK
-OK
-Incorrect! I am checking FindOdds in sayBet only if user typed odds! But if he/she typed bet, findOdds will never be tested before the Bet function (if user typed odds the code will never enter Bet function). And I must test in Bet function because that's the only way to get the actual odds for betting!

Thanks for constructive comments, I hope for more of them in future.

Thank you all for translations!

Last edited by vilaemail; 01-20-2010 at 14:05.
vilaemail is offline
vilaemail
Member
Join Date: Jan 2009
Location: Tu i tamo, svuda pomalo
Old 01-20-2010 , 14:07   Re: Bet v1.1
Reply With Quote #15

Quote:
Originally Posted by just75100 View Post
I don't see anywhere that plugin as a submission neither as an approved plugin. Also I had no prior knowledge of that thread until now.
vilaemail is offline
ditmesteam
Senior Member
Join Date: Oct 2009
Old 01-20-2010 , 14:20   Re: Bet v1.2
Reply With Quote #16

This is old bug log
L 01/20/2010 - 16:18:18: [AMXX] Run time error 10 (plugin "bet.amxx") (native "cs_get_user_money") - debug not enabled!
You made new version. Thank you so much!
ditmesteam is offline
vilaemail
Member
Join Date: Jan 2009
Location: Tu i tamo, svuda pomalo
Old 01-20-2010 , 14:22   Re: Bet v1.2
Reply With Quote #17

Quote:
Originally Posted by ditmesteam View Post
This is old bug log
L 01/20/2010 - 16:18:18: [AMXX] Run time error 10 (plugin "bet.amxx") (native "cs_get_user_money") - debug not enabled!
You made new version. Thank you so much!
That bug is not fixed, because I am not aware of it. Please enable debug and give me the error log. Thanks.
vilaemail is offline
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 01-20-2010 , 14:23   Re: Bet v1.1
Reply With Quote #18

Quote:
Originally Posted by vilaemail View Post
-say bet can not be hooked. look here: http://forums.alliedmods.net/showthread.php?t=103434
-Team variable IS necessary because I am checking which team he placed bet on (not the team he is on!)
-Incorrect! I am checking FindOdds in sayBet only if user typed odds! But if he/she typed bet, findOdds will never be tested before the Bet function (if user typed odds the code will never enter Bet function). And I must test in Bet function because that's the only way to get the actual odds for betting!

Thanks for constructive comments, I hope for more of them in future.

Thank you all for translations!
- OK, sorry. I wasn't aware of that and figured it could be a proper optimization. Thats for clearing that up.
- No. You do not need it in the FindOdds function. See below to how you can change the function.
- You are right, I didn't look at the code too close here.

PHP Code:
    for (i=0i<playerCounti++)
    {
        
//player = Players[i]  - no need for this
        //team = cs_get_user_team(Players[i]) - no need for this either
        
switch(cs_get_user_team(Players[i]))
        {
            case 
CS_TEAM_T:
            {
                
aliveT++
            }
            case 
CS_TEAM_CT:
            {
                
aliveCT++
            }
        }
    } 
More suggestions (though minimal ones):
- You could use static arrays in the say function as it is called quite frequently.
- What purpose does the "critical" variable have? I do not see why it is necessary.
- In giveMoney you use id and player to hold the same variable. Remove one of them.
- Using equali you can remove strtolower on the arguments.
- There are some instances where you declare a variable and then assign it on the next line. You use both styles and you could decide on either doing it separately or on one line.
PHP Code:
new userMoney
userMoney 
cs_get_user_money(id)
// -->
new userMoney cs_get_user_money(id
__________________
In Flames we trust!
Nextra is offline
ditmesteam
Senior Member
Join Date: Oct 2009
Old 01-20-2010 , 14:29   Re: Bet v1.2
Reply With Quote #19

Sorry vilaemail , I am wrong with older plugin: http://forums.alliedmods.net/showthr...t=71382&page=2
Your plugin will new plugin for BET AMXX. I will try it and write result later! Thank you for your plugin!
ditmesteam is offline
vilaemail
Member
Join Date: Jan 2009
Location: Tu i tamo, svuda pomalo
Old 01-20-2010 , 14:49   Re: Bet v1.2
Reply With Quote #20

Quote:
Originally Posted by Nextra View Post
- OK, sorry. I wasn't aware of that and figured it
- No. You do not need it in the FindOdds function. See below to how you can change the function.

More suggestions (though minimal ones):
- You could use static arrays in the say function as it is called quite frequently.
- What purpose does the "critical" variable have? I do not see why it is necessary.
- In giveMoney you use id and player to hold the same variable. Remove one of them.
- Using equali you can remove strtolower on the arguments.
- There are some instances where you declare a variable and then assign it on the next line. You use both styles and you could decide on either doing it separately or on one line.
PHP Code:
new userMoney
userMoney 
cs_get_user_money(id)
// -->
new userMoney cs_get_user_money(id
-Implemented
-I am not quite sure what do you think. This variables (now constants):
PHP Code:
static const CT[3] = "ct"
static const T[2] = "t"
static const ALL[4] = "all"
static const HALF[5] = "half"
static const BET[4] = "bet"
static const ODDS[5] = "odds" 
-As seen on AMX Mod X documentation if a message is started before other one is completed server will crash. So if (teoreticaly) two players die at same point and two functions are called at same point it could result in server crash. Ofcourse it is possible AMXX does not work that way (it processes two same type events one after another).
-Done.
-Done.
-Made code consistent.

Again, thanks, hope for more suggestions

Last edited by vilaemail; 01-20-2010 at 15:02.
vilaemail is offline
Reply



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 19:24.


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