Raised This Month: $32 Target: $400
 8% 

TeamBets 2.6 (Mani Conversion)


Post New Thread Reply   
 
Thread Tools Display Modes
shanapu
Veteran Member
Join Date: Apr 2015
Location: .de
Old 12-03-2017 , 09:52   Re: TeamBets 2.6 (Mani Conversion)
Reply With Quote #221

Quote:
Originally Posted by 8guawong View Post
i think you edited the plugin

but the old code

PHP Code:
if ((iMoney GetMoney(i) + g_iPlayerBetData[i][BET_AMOUNT] + g_iPlayerBetData[i][BET_WIN]) > g_iConfig_mp_maxmoneyiMoney g_iConfig_mp_maxmoney;
SetMoney(i,iMoney); 
g_iConfig_mp_maxmoney is always 0
so if they won their credits will be set to 0
haha, ok. I found this issues quickly.
Cause you quoted SetMoney() I thought there is another issue, it didn't let me sleep.
__________________
coding & free software
shanapu is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 12-03-2017 , 10:03   Re: TeamBets 2.6 (Mani Conversion)
Reply With Quote #222

Quote:
Originally Posted by shanapu View Post
haha, ok. I found this issues quickly.
Cause you quoted SetMoney() I thought there is another issue, it didn't let me sleep.
haha sorry at first i didn't look too closely as well XD
__________________
8guawong is offline
Muscle Brazil
Senior Member
Join Date: Apr 2009
Location: Brazil
Old 12-05-2017 , 04:19   Re: TeamBets 2.6 (Mani Conversion)
Reply With Quote #223

it is possible after the death of the player appears a menu for the same bet as it was in cs 1.6

screenshot
Muscle Brazil is offline
The Solid lad
Senior Member
Join Date: Oct 2018
Old 11-02-2018 , 01:35   Re: TeamBets 2.6 (Mani Conversion)
Reply With Quote #224

Translated to hungarian.

*EDIT: Refined translations to be more understandable to the simpletons playing on hungarian servers.
Attached Files
File Type: txt plugin.teambets.txt (1.6 KB, 172 views)

Last edited by The Solid lad; 11-02-2018 at 12:34.
The Solid lad is offline
The Solid lad
Senior Member
Join Date: Oct 2018
Old 11-03-2018 , 09:25   Re: TeamBets 2.6 (Mani Conversion)
Reply With Quote #225

The plugin does not announce 1 vs X situations. Only announces 1v1.
The Solid lad is offline
eliteroyal
AlliedModders Donor
Join Date: Dec 2016
Location: Moldova
Old 02-17-2019 , 08:48   Re: TeamBets 2.6 (Mani Conversion)
Reply With Quote #226

Does this work with csgo?
__________________
PEACE FROM MOLDOVA

Last edited by eliteroyal; 02-17-2019 at 08:48.
eliteroyal is offline
Obyboby
Veteran Member
Join Date: Sep 2013
Old 02-18-2019 , 03:11   Re: TeamBets 2.6 (Mani Conversion)
Reply With Quote #227

Quote:
Originally Posted by eliteroyal View Post
Does this work with csgo?
I'm using this version here on my server and it works fine (except the !pot feature)
__________________
Obyboby is offline
eliteroyal
AlliedModders Donor
Join Date: Dec 2016
Location: Moldova
Old 02-20-2019 , 13:21   Re: TeamBets 2.6 (Mani Conversion)
Reply With Quote #228

Quote:
Originally Posted by Obyboby View Post
I'm using this version here on my server and it works fine (except the !pot feature)
It works bro, how can i make so people can see what we bet?
when i type bet t/ct all the text doesnt show, is it possible to show?
__________________
PEACE FROM MOLDOVA

Last edited by eliteroyal; 02-20-2019 at 13:21.
eliteroyal is offline
Obyboby
Veteran Member
Join Date: Sep 2013
Old 02-21-2019 , 03:17   Re: TeamBets 2.6 (Mani Conversion)
Reply With Quote #229

Quote:
Originally Posted by eliteroyal View Post
It works bro, how can i make so people can see what we bet?
when i type bet t/ct all the text doesnt show, is it possible to show?
No clue, sorry. I've tried to change this plugin in the past but it's a bit weird and I am no developer so I couldn't figure out how to make the desired changes.
I would like a menu that appears when you die in which you can select your bet, and maybe show it to other players, but I don't know how to do that.
__________________
Obyboby is offline
alphaearth
Senior Member
Join Date: Feb 2018
Location: Turkey
Old 03-01-2019 , 23:05   Re: TeamBets 2.6 (Mani Conversion)
Reply With Quote #230

Quote:
Originally Posted by Wilczek View Post
Try this one:

PHP Code:
/**
 * teambets.sp
 * Adds team betting. After dying, a player can bet on which team will win. 
 */

#include <sourcemod>

#pragma semicolon 1

#define PLUGIN_VERSION "2.7.2"

public Plugin:myinfo 
{
    
name "Team Bets",
    
author "VieuxGnome fork GrimReaper - ferret",
    
description "Bet on Team to Win For CS:Go",
    
version PLUGIN_VERSION,
    
url "http://forums.alliedmods.net/showthread.php?t=85914"
};

#define LIFE_ALIVE 0
new g_iLifeState = -1;
new 
g_iAccount = -1;

#define BET_AMOUNT 0
#define BET_WIN 1
#define BET_TEAM 2

new g_bEnabled false;
new 
g_bHooked false;

new 
g_iPlayerBetData[MAXPLAYERS 1][3];
new 
bool:g_bPlayerBet[MAXPLAYERS 1] = {false, ...};
new 
bool:g_bBombPlanted false;
new 
bool:g_bBombDefused false;
new 
bool:g_bOneVsMany false;
new 
g_iOneVsManyPot;
new 
g_iOneVsManyTeam;
new 
g_iWinnerLastRnd;
new 
g_iConfig_mp_maxmoney;
int g_iInPotTotal;

new 
Handle:g_hSmBet INVALID_HANDLE;
new 
Handle:g_hSmBetDeadOnly INVALID_HANDLE;
new 
Handle:g_hSmBetOneVsMany INVALID_HANDLE;
new 
Handle:g_hSmBetAnnounce INVALID_HANDLE;
new 
Handle:g_hSmBetAdvert INVALID_HANDLE;
new 
Handle:g_hSmBetPlanted INVALID_HANDLE;
        
public 
OnPluginStart()
{
    
g_iAccount FindSendPropOffs("CCSPlayer""m_iAccount");
    
g_iLifeState FindSendPropOffs("CBasePlayer""m_lifeState");
    new 
Handle:CvarHandle;
    if ((
CvarHandle FindConVar("mp_maxmoney")) != INVALID_HANDLE)
        
g_iConfig_mp_maxmoney     GetConVarInt(CvarHandle);
    if (
g_iAccount == -|| g_iLifeState == -1)
    {
        
g_bEnabled false;
        
PrintToServer("[TeamBets] - Unable to start, cannot find necessary send prop offsets.");
        return;
    }
    
    
LoadTranslations("common.phrases");
    
LoadTranslations("plugin.teambets");    

    
CreateConVar("sm_teambets_version"PLUGIN_VERSION"TeamBets Version"FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
    
    
RegConsoleCmd("say"Command_Say);
    
RegConsoleCmd("say_team"Command_Say);
    
RegConsoleCmd("pot"Command_Pot);
    
    
g_hSmBet CreateConVar("sm_bet""1""Enable team betting? (0 off, 1 on, def. 1)");    
    
g_hSmBetDeadOnly CreateConVar("sm_bet_deadonly""1""Only dead players can bet. (0 off, 1 on, def. 1)");    
    
g_hSmBetOneVsMany CreateConVar("sm_bet_onevsmany""0""The winner of a 1 vs X fight gets the losing pot (def. 0)");    
    
g_hSmBetAnnounce CreateConVar("sm_bet_announce""0""Announce 1 vs 1 situations (0 off, 1 on, def. 0)");
    
g_hSmBetAdvert CreateConVar("sm_bet_advert""1""Advertise plugin instructions on client connect? (0 off, 1 on, def. 1)");
    
g_hSmBetPlanted CreateConVar("sm_bet_planted""0""Prevent betting if the bomb has been planted. (0 off, 1 on, def. 0)");
    
    
HookConVarChange(g_hSmBetConVarChange_SmBet);

    
g_bEnabled true;
    
    
CreateTimer(5.0Timer_DelayedHooks);

    
AutoExecConfig(true"teambets");
}

public 
Action:Timer_DelayedHooks(Handle:timer)
{
    if (
g_bEnabled)
    {
        
HookEvent("round_end"Event_RoundEndEventHookMode_Post);
        
HookEvent("player_death"Event_PlayerDeathEventHookMode_Post);
        
HookEvent("bomb_planted"Event_PlantedEventHookMode_PostNoCopy);
        
HookEvent("bomb_defused"Event_DefusedEventHookMode_Post);    
        
HookEvent("round_start"Event_RoundStartEventHookMode_Post);    
        
g_bHooked true;

        
PrintToServer("[TeamBets] - Loaded");
    }
}

public 
ConVarChange_SmBet(Handle:convar, const String:oldValue[], const String:newValue[])
{
    new 
iNewVal StringToInt(newValue);
    
    if (
g_bEnabled && iNewVal != 1)
    {
        if (
g_bHooked)
        {
            
UnhookEvent("round_end"Event_RoundEnd);
            
UnhookEvent("player_death"Event_PlayerDeath);
            
UnhookEvent("bomb_planted"Event_Planted);
            
UnhookEvent("bomb_defused"Event_Defused);
            
UnhookEvent("round_start"Event_RoundStart);
            
g_bHooked false;
        }
        
        
g_bEnabled false;
    }
    else if (!
g_bEnabled && iNewVal == 1)
    {
        if (!
g_bHooked)
        {
            
HookEvent("round_end"Event_RoundEndEventHookMode_Post);
            
HookEvent("player_death"Event_PlayerDeathEventHookMode_Post);
            
HookEvent("bomb_planted"Event_PlantedEventHookMode_PostNoCopy);    
            
HookEvent("bomb_defused"Event_DefusedEventHookMode_Post);    
            
HookEvent("round_start"Event_RoundStartEventHookMode_Post);
            
g_bHooked true;            
        }
        
        
g_bEnabled true;        
    }
}

public 
Event_Planted(Handle:event, const String:name[], bool:dontBroadcast)
{
    if (!
g_bEnabled)
        return ;
    
    if (
GetConVarInt(g_hSmBetPlanted) == 1)
    {
        
g_bBombPlanted true;
    }
}

public 
Event_Defused(Handle:event, const String:name[], bool:dontBroadcast)
{
    if (!
g_bEnabled)
        return ;
        
    
g_bBombDefused true;
}
        

public 
Action:Command_Say(clientargs)
{
    if (!
g_bEnabled)
        return 
Plugin_Continue;
    
    new 
String:szText[192];
    
GetCmdArgString(szTextsizeof(szText));
    
    new 
startarg 0;
    if (
szText[0] == '"')
    {
        
startarg 1;
        
/* Strip the ending quote, if there is one */
        
new szTextlen strlen(szText);
        if (
szText[szTextlen-1] == '"')
        {
            
szText[szTextlen-1] = '\0';
        }
    }
    
    new 
String:szParts[3][16];
      
ExplodeString(szText[startarg], " "szParts316);

     if (
strcmp(szParts[0],"bet",false) == 0)
    {
        if (
g_bBombPlanted == true || g_bBombDefused == true)
        {
            
PrintToChat(client"\x04-\x04[TeamBets]\x01 %t""No bets after bomb planted");
            return 
Plugin_Handled;
        }
    
        if (
GetClientTeam(client) <= 1)
        {
            
PrintToChat(client"\x04-\x04[TeamBets]\x01 %t""Must Be On A Team To Vote");
            return 
Plugin_Handled;
        }
        
        if (
g_bPlayerBet[client])
        {
            
PrintToChat(client"\x04-\x04[TeamBets]\x01 %t""Already Betted");
            return 
Plugin_Handled;    
        }

        if (
GetConVarInt(g_hSmBetDeadOnly) == && IsAlive(client))
        {
            
PrintToChat(client"\x04-\x04[TeamBets]\x01 %t""Must Be Dead To Vote");
            return 
Plugin_Handled;
        }
    
        if (
strcmp(szParts[1],"ct",false) != && strcmp(szParts[1],"t"false) != 0)
        {
            
PrintToChat(client"\x04-\x04[TeamBets]\x01 %t""Invalid Team for Bet");
            return 
Plugin_Handled;
        }

        if (
strcmp(szParts[1],"ct",false) == || strcmp(szParts[1],"t"false) == 0)
        {
    
            new 
iAmount 0;
            new 
iBank GetMoney(client);
    
            if (
IsCharNumeric(szParts[2][0]))
            {
                
iAmount StringToInt(szParts[2]);
            }
            else if (
strcmp(szParts[2],"all",false) == 0)
            {
                
iAmount iBank;
            }
            if (
strcmp(szParts[2],"half"false) == 0)
            {
                
iAmount = (iBank 2) + 1;
            }
            if (
strcmp(szParts[2],"third"false) == 0)
            {
                
iAmount = (iBank 3) + 1;
            }

            if (
iAmount 1)
            {
                
PrintToChat(client"\x04-\x04[TeamBets]\x01 %t""Invalid Bet Amount");
                return 
Plugin_Handled;
            }        
    
            if (
iAmount iBank || iBank 1)
            {
                
PrintToChat(client"\x04-\x04[TeamBets]\x01 %t""Not Enough Money");
                return 
Plugin_Handled;
            }
    
            new 
iOdds[2] = {00}, iTeam;
            new 
iMaxClients GetMaxClients();

            for (new 
1<= iMaxClientsi++)
            {
                if (
IsClientInGame(i) && IsAlive(i))
                {
                    
iTeam GetClientTeam(i);
                    if (
iTeam == 2// 2 = t, 3 = ct
                    
{
                        
iOdds[0]++;
                    }
                    else if (
iTeam == 3)
                    {
                        
iOdds[1]++;            
                    }
                }
            }
    
            if (
iOdds[0] < || iOdds[1] < 1)
            {
                
PrintToChat(client"\x04-\x04[TeamBets]\x01 %t""Players Are Dead");
                return 
Plugin_Continue;        
            }
    
            
g_iPlayerBetData[client][BET_AMOUNT] = iAmount;
            
g_iPlayerBetData[client][BET_TEAM] = (strcmp(szParts[1],"t",false) == 3); // 2 = t, 3 = ct
            
g_iInPotTotal += iAmount;
    
            new 
iWin;
    
            if (
g_iPlayerBetData[client][BET_TEAM] == 2// 2 = t, 3 = ct
            
{
                
iWin RoundToNearest((float(iOdds[1]) / float(iOdds[0])) * float(iAmount));
                
PrintToChat(client"\x04-\x04[TeamBets]\x01 %t""Bet Made"iOdds[1], iOdds[0], iWing_iPlayerBetData[client][BET_AMOUNT]);        
            }
            else
            {
                
iWin RoundToNearest((float(iOdds[0]) / float(iOdds[1])) * float(iAmount));
                
PrintToChat(client"\x04-\x04[TeamBets]\x01 %t""Bet Made"iOdds[0], iOdds[1], iWing_iPlayerBetData[client][BET_AMOUNT]);
            }

            
g_iPlayerBetData[client][BET_WIN] = iWin;
            
g_bPlayerBet[client] = true;
    
            if (
g_bOneVsMany && g_iOneVsManyTeam != g_iPlayerBetData[client][BET_TEAM])
            { 
                
g_iOneVsManyPot += iAmount;
            }

            
SetMoney(clientiBank iAmount);

            return 
Plugin_Handled;
        }
    }
    
    return 
Plugin_Continue;
}

public 
Action Command_Pot(clientargs)
{
    if (!
g_bEnabled)
        return 
Plugin_Continue;
        
    if (
IsClientInGame(client) && !IsFakeClient(client))
        
PrintToChat(client"\x04-\x04[TeamBets]\x01 %t""In Pot Total"g_iInPotTotal);
    
    return 
Plugin_Continue;
}

public 
bool:OnClientConnect(clientString:rejectmsg[], maxlen)
{
    if (!
g_bEnabled)
        return 
true;    
    
    
g_iPlayerBetData[client][BET_AMOUNT] = 0;
    
g_iPlayerBetData[client][BET_TEAM] = 0;
    
g_iPlayerBetData[client][BET_WIN] = 0;
    
g_bPlayerBet[client] = false;
    
    
CreateTimer(15.0Timer_Advertiseclient);
    
    return 
true;
}

public 
Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    if (!
g_bEnabled)
        return;    
    
    if (
GetConVarInt(g_hSmBetAnnounce) == && GetConVarInt(g_hSmBetOneVsMany) < 2// We don't care about player deaths
        
return;

    new 
iMaxClients GetMaxClients();
    new 
iTeamiTeams[2] = {00}, iTPlayeriCTPlayer;
    
    for (new 
1<= iMaxClientsi++)
    {
        if (
IsClientInGame(i) && IsAlive(i))
        {
            
iTeam GetClientTeam(i);
            if (
iTeam == 2)
            {
                
iTeams[0]++;
                if (
iTPlayer == 0) { iTPlayer i; }
            }
            else if (
iTeam == 3)
            {
                
iTeams[1]++;
                if (
iCTPlayer == 0) { iCTPlayer i; }
            }
        }    
    }

    if (
iTeams[0] == && iTeams[1] == && !g_bOneVsMany && GetConVarInt(g_hSmBetAnnounce) > 0)
    {
        
PrintToChatAll("\x04-\x04[TeamBets]\x01 %T""One Vs One"LANG_SERVER);
        return;
    }
    
    if (
GetConVarInt(g_hSmBetOneVsMany) > 1)
    {
        new 
String:pname[64];
        
        if ((
iTeams[0] == && iTeams[1] > GetConVarInt(g_hSmBetOneVsMany)) || (iTeams[1] == && iTeams[0] > GetConVarInt(g_hSmBetOneVsMany)) && !g_bOneVsMany)
        {
            
g_bOneVsMany true;
            
g_iOneVsManyPot 0;
            
            if (
iTeams[0] == 1)
            {
                
GetClientName(iTPlayerpname64);
                
g_iOneVsManyTeam 2;
            }
            else
            {
                
GetClientName(iCTPlayerpname64);
                
g_iOneVsManyTeam 3;
            }
            
            
PrintToChatAll("\x04-\x04[TeamBets]\x01 %T""One Vs Many Start"LANG_SERVERpname, (iTeams[1] == "Terrorist" "Counter-Terrorist"));
        }
        else if (
iTeams[0] == && iTeams[1] == && g_bOneVsMany && g_iOneVsManyTeam == 2)
        {
            
GetClientName(iTPlayerpname64);
            
PrintToChatAll("\x04-\x04[TeamBets]\x01 %T""One Vs Many Winner"LANG_SERVERpnameg_iOneVsManyPot);
            
SetMoney(iTPlayerGetMoney(iTPlayer) + g_iOneVsManyPot);
        }
        else if (
iTeams[1] == && iTeams[0] == && g_bOneVsMany && g_iOneVsManyTeam == 3)
        {
            
GetClientName(iCTPlayerpname64);
            
PrintToChatAll("\x04-\x04[TeamBets]\x01 %T""One Vs Many Winner"LANG_SERVERpnameg_iOneVsManyPot);
            
SetMoney(iCTPlayerGetMoney(iCTPlayer) + g_iOneVsManyPot);        
        }
    }
}

public 
Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    if (!
g_bEnabled)
        return ;            
        
    
g_bBombPlanted false;
    
g_bBombDefused false;
    new 
iMaxClients GetMaxClients();
    new 
iMoney 0;
    for (new 
1<= iMaxClientsi++)
    {
        if (
IsClientInGame(i) && g_bPlayerBet[i])
        {
            if (
g_iWinnerLastRnd == g_iPlayerBetData[i][BET_TEAM])
            {
                if ((
iMoney GetMoney(i) + g_iPlayerBetData[i][BET_AMOUNT] + g_iPlayerBetData[i][BET_WIN]) > g_iConfig_mp_maxmoneyiMoney g_iConfig_mp_maxmoney;
                
SetMoney(i,iMoney);
                
PrintToChat(i"\x04-\x04[TeamBets]\x05 %t""Bet Won"g_iPlayerBetData[i][BET_WIN], g_iPlayerBetData[i][BET_AMOUNT]);
            }
            else
            {
                
PrintToChat(i"\x04-\x04[TeamBets]\x02 %t""Bet Lost"g_iPlayerBetData[i][BET_AMOUNT]);
            }
        }
        
g_bPlayerBet[i] = false;
    }
}

public 
Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
    if (!
g_bEnabled)
        return ;        

    new 
iWinner GetEventInt(event"winner");        
    
g_iWinnerLastRnd iWinner;
    
g_bOneVsMany false;
    
g_iOneVsManyPot 0;
    
g_iInPotTotal 0;
}

public 
Action:Timer_Advertise(Handle:timerany:client)
{
    if (
GetConVarInt(g_hSmBetAdvert) == 1)
        {
            if (
IsClientInGame(client))
                
PrintToChat(client"\x04-\x04[TeamBets]\x01 %t""Advertise Bets");
            else if (
IsClientConnected(client))
                
CreateTimer(15.0Timer_Advertiseclient);
        }
}
 
public 
bool:IsAlive(client)
{
    if (
g_iLifeState != -&& GetEntData(clientg_iLifeState1) == LIFE_ALIVE)
        return 
true;
 
    return 
false;


public 
SetMoney(clientamount)
{
    if (
g_iAccount != -1)
        
SetEntData(clientg_iAccountamount);
}

public 
GetMoney(client)
{
    if (
g_iAccount != -1)
        return 
GetEntData(clientg_iAccount);

    return 
0;

Translations:
PHP Code:
    "In Pot Total"
    
{
        
"#format"        "{1:d}"
        "en"            "There are 
${1} in the pot."
    

Chat trigger - !pot
Based on this version.
error log:
L 03/02/2019 - 07:02:27: SourceMod error session started
L 03/02/2019 - 07:02:27: Info (map "de_dust2_old") (file "errors_20190302.log")
L 03/02/2019 - 07:02:27: [SM] Exception reported: Language phrase "Advertise Bets" not found (arg 4)
L 03/02/2019 - 07:02:27: [SM] Blaming: teambets_csgo.smx
L 03/02/2019 - 07:02:27: [SM] Call stack trace:
L 03/02/2019 - 07:02:27: [SM] [0] PrintToChat
L 03/02/2019 - 07:02:27: [SM] [1] Line 450, C:\Users\User\Desktop\sourcemod++\addons\sour cemod\scripting\teambets_csgo.sp::Timer_Adver tise
__________________
alphaearth 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 10:38.


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