User
Pass
2FA
 
 

[rezolvat][Problema]Bet

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Freakz Forum Index -> Trash Bin -> CS 2006-2019 (Archived) -> Plugins - Help / Support
Author Message1229
Catalin Stan

[Mentally Stable]



Status: Offline
(since 03-09-2014 13:29)
Joined: 21 Jul 2014
Posts: 56, Topics: 21
Location: Oriunde

Reputation: -42.1
Votes: 3

     
Post Posted: 26-08-2014, 21:44:40 | Translate post to: ... (Click for more languages)

»Nume*: bet
»Descriere problema*: nu stiu ce sa fac il compilez si nu mere.. ajutati.ma
»Poze: va dau direct sma-ul

/********************************************************************
******************** [ DEFINES, VARIABLES, HEADERS ] ***********************
********************************************************************/

#include <amxmodx>
#include <fakemeta>
#include <color_chat.inl>

new g_MaxPlayers

new g_iBet[33]
new g_iBetTeam[33]

new g_isTerroristWin
new g_isCounterTerroristWin

new g_iCvarRatio

new g_sSaid[81]
new g_sCommand[24]
new g_sTeam[24]
new g_sMoney[24]
new g_sCheck[2]

new const g_cstrike_offset_money = 115
new const g_offset_linux = 5

stock fm_cs_get_user_money(index)
return get_pdata_int(index, g_cstrike_offset_money, g_offset_linux)

stock fm_cs_set_user_money(index, money)
set_pdata_int(index, g_cstrike_offset_money, money, g_offset_linux)

/********************************************************************
*************************** [ FORWARDS ] ******************************
********************************************************************/

public plugin_init()
{
register_plugin("Betting", "1.0", "Hattrick")

register_concmd("say", "cmdBet", ADMIN_ALL, "<team> <dolars>")
register_concmd("say_team", "cmdBet", ADMIN_ALL, "<team> <dolars>")

register_logevent("LogEvent_RoundStart", 2, "1=Round_Start")
register_logevent("LogEvent_RoundEnd", 2, "1=Round_End")

register_event("SendAudio", "Event_TerroristWin", "a", "2=%!MRAD_terwin")
register_event("SendAudio", "Event_CounterTerroristWin", "a", "2=%!MRAD_ctwin")
register_event("SendAudio", "Event_RoundDraw", "a", "2=%!MRAD_rounddraw")

g_MaxPlayers = get_maxplayers()

g_iCvarRatio = register_cvar("amx_betting_ratio", "0.32", FCVAR_SERVER)

set_task(230.0, "FuncAnnounce", 342346, _, _, "b")

color_chat_init()
}

public client_disconnect(id)
{
g_iBet[id] = 0
g_iBetTeam[id] = 0
}

/********************************************************************
*************************** [ LOG EVENTS ] ******************************
********************************************************************/

public LogEvent_RoundStart()
{
for (new id = 1; id <= g_MaxPlayers; id++)
{
if (is_user_connected(id) && g_iBet[id])
{
g_iBet[id] = 0
g_iBetTeam[id] = 0
}
}

g_isTerroristWin = 0
g_isCounterTerroristWin = 0
}

public LogEvent_RoundEnd()
set_task(1.0, "FuncCheck", 234324)

/********************************************************************
***************************** [ EVENTS ] ********************************
********************************************************************/

public Event_TerroristWin()
g_isTerroristWin = 1

public Event_CounterTerroristWin()
g_isCounterTerroristWin = 1

public Event_RoundDraw()
{
g_isTerroristWin = 0
g_isCounterTerroristWin = 0
}

/********************************************************************
*************************** [ COMMANDS ] ******************************
********************************************************************/

public cmdBet(id)
{
read_args(g_sSaid, charsmax(g_sSaid))
remove_quotes(g_sSaid)

g_sCommand[0] = '^0'
g_sTeam[0] = '^0'
g_sMoney[0] = '^0'
g_sCheck[0] = '^0'

parse(g_sSaid, g_sCommand, charsmax(g_sCommand), g_sTeam, charsmax(g_sTeam), g_sMoney, charsmax(g_sMoney), g_sCheck, charsmax(g_sCheck))

if (g_sCheck[0] == 0)
{
if (!equali(g_sCommand, "bet") || !equali(g_sCommand, "Bet") || !equali(g_sCommand, "BET"))
return PLUGIN_CONTINUE

if (g_iBet[id])
{
ColorChat(id, RED, "[AMXX]^x01 You have already placed a bet this round.")
return PLUGIN_HANDLED
}

if (is_user_alive(id))
{
ColorChat(id, RED, "[AMXX]^x01 You must be dead to place a bet.")
return PLUGIN_HANDLED
}

if (get_user_team(id) == 3)
{
ColorChat(id, RED, "[AMXX]^x01 You must be 't' or 'ct' to place a bet.")
return PLUGIN_HANDLED
}

if (fm_cs_get_user_money(id) == 0)
{
ColorChat(id, RED, "[AMXX]^x01 You do not have enough money for that bet.")
return PLUGIN_HANDLED
}

if (!g_sTeam[0])
{
ColorChat(id, RED, "[AMXX]^x01 You can write in chat^x04 bet <team> <dolars>^x01. Teams are:^x03 T^x01 and^x03 CT^x01.")
return PLUGIN_HANDLED
}

if (FuncGetCTs() == 0 || FuncGetTs() == 0)
{
ColorChat(id, RED, "[AMXX]^x01 You can't bet when either team is empty.")
return PLUGIN_HANDLED
}

if (FuncGetAliveCTs() == 0 || FuncGetAliveTs() == 0)
{
ColorChat(id, RED, "[AMXX]^x01 You can't bet when either team is dead.")
return PLUGIN_HANDLED
}

if (g_sTeam[0] == 'c' || g_sTeam[0] == 'C' || g_sTeam[0] == '2')
{
new iMoney

if (g_sMoney[0] == 'a' || g_sMoney[0] == 'A')
iMoney = fm_cs_get_user_money(id)
else
iMoney = str_to_num(g_sMoney)

if (!iMoney)
{
ColorChat(id, RED, "[AMXX]^x01 You can't bet^x04 0 $^x01.")
return PLUGIN_HANDLED
}

if (iMoney > fm_cs_get_user_money(id))
{
ColorChat(id, RED, "[AMXX]^x01 You're trying to bet a too large amount. Your money are:^x04 %d $^x01.", fm_cs_get_user_money(id))
return PLUGIN_HANDLED
}

g_iBet[id] = iMoney
g_iBetTeam[id] = 2
new x = floatround(iMoney * get_pcvar_float(g_iCvarRatio))
ColorChat(id, RED, "[AMXX]^x01 You have bet^x04 %d $^x01 on^x04 COUNTER-TERRORISTS^x01. You will receive/lost^x04 %d $^x01.", iMoney, x)
}

if (g_sTeam[0] == 't' || g_sTeam[0] == 'T' || g_sTeam[0] == '1')
{
new iMoney

if (g_sMoney[0] == 'a' || g_sMoney[0] == 'A')
iMoney = fm_cs_get_user_money(id)
else
iMoney = str_to_num(g_sMoney)

if (!iMoney)
{
ColorChat(id, RED, "[AMXX]^x01 You can't bet^x04 0 $^x01.")
return PLUGIN_HANDLED
}

if (iMoney > fm_cs_get_user_money(id))
{
ColorChat(id, RED, "[AMXX]^x01 You're trying to bet a too large amount. Your money are:^x04 %d $^x01.", fm_cs_get_user_money(id))
return PLUGIN_HANDLED
}

g_iBet[id] = iMoney
g_iBetTeam[id] = 1
new x = floatround(iMoney * get_pcvar_float(g_iCvarRatio))
ColorChat(id, RED, "[AMXX]^x01 You have bet^x04 %d $^x01 on^x04 TERRORISTS^x01. You will receive/lost^x04 %d $^x01.", iMoney, x)
}
}
return PLUGIN_CONTINUE
}

/********************************************************************
*************************** [ FUNCTIONS ] *******************************
********************************************************************/

public FuncCheck()
{
for (new id = 1; id <= g_MaxPlayers; id++)
{
if (!is_user_connected(id) || !g_iBet[id])
continue

if (g_isTerroristWin && g_iBetTeam[id] == 1)
{
new x = floatround(g_iBet[id] * get_pcvar_float(g_iCvarRatio))
fm_cs_set_user_money(id, fm_cs_get_user_money(id) + x)
ColorChat(id, RED, "[AMXX]^x01 You won^x04 %d $^x01 from last betting.", x)
}

if (g_isTerroristWin && g_iBetTeam[id] == 2)
{
new x = floatround(g_iBet[id] * get_pcvar_float(g_iCvarRatio))
fm_cs_set_user_money(id, fm_cs_get_user_money(id) - x)
ColorChat(id, RED, "[AMXX]^x01 You lose^x04 %d $^x01 from last betting.", x)
}

if (g_isCounterTerroristWin && g_iBetTeam[id] == 1)
{
new x = floatround(g_iBet[id] * get_pcvar_float(g_iCvarRatio))
fm_cs_set_user_money(id, fm_cs_get_user_money(id) - x)
ColorChat(id, RED, "[AMXX]^x01 You lose^x04 %d $^x01 from last betting.", x)
}

if (g_isCounterTerroristWin && g_iBetTeam[id] == 2)
{
new x = floatround(g_iBet[id] * get_pcvar_float(g_iCvarRatio))
fm_cs_set_user_money(id, fm_cs_get_user_money(id) + x)
ColorChat(id, RED, "[AMXX]^x01 You won^x04 %d $^x01 from last betting.", x)
}

if (!g_isTerroristWin && !g_isCounterTerroristWin)
ColorChat(id, RED, "[AMXX]^x01 No one team had won! The bets will be canceled.")
}
}

FuncGetTs()
{
static x
x = 0

for (new id = 1; id <= g_MaxPlayers; id++)
{
if (!is_user_connected(id) || !(get_user_team(id) == 1))
continue

x++
}
return x
}

FuncGetCTs()
{
static x
x = 0

for (new id = 1; id <= g_MaxPlayers; id++)
{
if (!is_user_connected(id) || !(get_user_team(id) == 2))
continue

x++
}
return x
}

FuncGetAliveTs()
{
static x
x = 0

for (new id = 1; id <= g_MaxPlayers; id++)
{
if (!is_user_connected(id) || !(get_user_team(id) == 1) || !is_user_alive(id))
continue

x++
}
return x
}

FuncGetAliveCTs()
{
static x
x = 0

for (new id = 1; id <= g_MaxPlayers; id++)
{
if (!is_user_connected(id) || !(get_user_team(id) == 2) || !is_user_alive(id))
continue

x++
}
return x
}

public FuncAnnounce()
ColorChat(0, RED, "[AMXX]^x01 You can write in chat^x04 bet <team> <dolars>^x01 for betting on one team!")


http://i.imgur.com/UVw1jzW.png
0 0
  
Back to top
View user's profile Send private message Yahoo! Messenger ID
EDUTz

[HardcoreAmxxScripter]



Status: Offline
(since 15-08-2021 16:34)
Joined: 27 Dec 2010
Posts: 4306, Topics: 244
Location: Jud. Miserupia, sat Bagadanc

Reputation: 4085
Votes: 179

         
Post Posted: 26-08-2014, 21:57:24 | Translate post to: ... (Click for more languages)

daca sunteti tampiti si stergeti ca boii ...
Spoiler:




Pentru pluginuri complicate le fac cu $$ pe paypal/psc. PM

0 0
  
Back to top
View user's profile Send private message Yahoo! Messenger ID
Catalin Stan

[Mentally Stable]



Status: Offline
(since 03-09-2014 13:29)
Joined: 21 Jul 2014
Posts: 56, Topics: 21
Location: Oriunde

Reputation: -42.1
Votes: 3

     
Post Posted: 26-08-2014, 22:40:20 | Translate post to: ... (Click for more languages)

tot nu merge pe server!!!

http://i.imgur.com/UVw1jzW.png
0 0
  
Back to top
View user's profile Send private message Yahoo! Messenger ID
Alexandru800

[Mentally Stable]



Status: Offline
(since 31-08-2014 09:43)
Joined: 31 Aug 2014
Posts: 22, Topics: 3
Location: Romania

Reputation: 31.4
Votes: 1

Post Posted: 31-08-2014, 11:17:32 | Translate post to: ... (Click for more languages)

L-ai bagat corect in plugins.ini?
0 0
  
Back to top
View user's profile Send private message

  Topic locked


Topic is closed, you cannot post any messages in it anymore

Locked by EDUTz, 15 September 2014 15:45



 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Freakz Forum Index -> Trash Bin -> CS 2006-2019 (Archived) -> Plugins - Help / Support  


The time now is 14-12-2024, 22:39:55
Copyright info

Based on phpBB ro/com
B

 
 
 







I forgot my password


This message appears only once, so
like us now until it's too late ! :D
x