Welcome to The Forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads

Minigames Votecash


Splizes
 Share

Recommended Posts

We were playing bigcity earlier and I found out about votecash from zild3d however, the command was broken and did not work.

So therefore I am suggesting that you implement this: (or something else if crosshair wants to rewrite it)

import es, playerlib

vc_cash = 16000
vc_voted = []

info = es.AddonInfo()
info['name'] = "Vote Cash"
info['basename'] = "votecash"
info['version'] = "0.0"
info['author'] = "Splizes"
info['url'] = "http://www.hellsgamers.com/"
info['description'] = "Gives a pre-defined amount of cash when players vote on it."

es.ServerVar(info['basename'], info['version'], info['description']).makepublic()

def player_say(ev):
   global vc_cash, vc_voted
   if ev['text'] == "votecash" or ev['text']  == "!votecash":
       user = int(ev['userid'])
       if user not in vc_voted:
           VotesNeeded = (len(playerlib.getPlayerList('#human')) / 2)
           vc_voted.append(user)
           es.msg('#multi', '#default[#lightgreenVoteCash#default] #lightgreen%s #defaulthas voted to increase all players cash to #lightgreen%s#default! [%s/%s]'%(es.getplayername(user), vc_cash, len(vc_voted), VotesNeeded))
           if len(vc_voted) >= VotesNeeded:
               del vc_voted[:]
               es.msg('#multi', '#default[#lightgreenVoteCash#default] The vote to increase all players cash to %s has passed, enjoy your cash.'%(vc_cash))
               for player in playerlib.getUseridList('#human'):
                   playerlib.getPlayer(player).cash = vc_cash
       elif user in vc_voted:
           es.tell(user, '#multi', '#default[#lightgreenVoteCash#default] You have already voted to increase all players cash to #lightgreen%s'% vc_cash)

Thanks to f4ithl3ss for helping me test :D

votecash.zip

Edited by Splizes
changed the ammount of votes back to what it should be from testing
Link to comment
Share on other sites

Prius requests I restrict the maps this was able to use, so here it is although this is untested, it should work.

import es, playerlib

vc_cash = 16000
vc_voted = []
vc_maps_allowed = ["mg_breakship_b12", "mg_re_fy_big_city_v10", "tron_jbeta6"]

info = es.AddonInfo()
info['name'] = "Vote Cash"
info['basename'] = "votecash"
info['version'] = "0.1"
info['author'] = "Splizes"
info['url'] = "http://www.hellsgamers.com/"
info['description'] = "Gives a pre-defined amount of cash when players vote on it."

es.ServerVar(info['basename'], info['version'], info['description']).makepublic()

def player_say(ev):
   global vc_cash, vc_voted, vc_maps_allowed
   if ev['text'] == "votecash" or ev['text']  == "!votecash":
       user = int(ev['userid'])
       if es.server_var["eventscripts_currentmap"] in vc_maps_allowed:
           if user not in vc_voted:
               VotesNeeded = (len(playerlib.getPlayerList('#human')) / 2)
               vc_voted.append(user)
               es.msg('#multi', '#default[#lightgreenVoteCash#default] #lightgreen%s #defaulthas voted to increase all players cash to #lightgreen%s#default! [%s/%s]'%(es.getplayername(user), vc_cash, len(vc_voted), VotesNeeded))
               if len(vc_voted) >= VotesNeeded:
                   del vc_voted[:]
                   es.msg('#multi', '#default[#lightgreenVoteCash#default] The vote to increase all players cash to %s has passed, enjoy your cash.'%(vc_cash))
                   for player in playerlib.getUseridList('#human'):
                       playerlib.getPlayer(player).cash = vc_cash
           elif user in vc_voted:
               es.tell(user, '#multi', '#default[#lightgreenVoteCash#default] You have already voted to increase all players cash to #lightgreen%s'% vc_cash)

Edited by Splizes
Link to comment
Share on other sites

Here's the code I wrote for our NTF Office a while ago...you can build off it =P

 

 

#include <sourcemod>
#include <sdktools>

#pragma semicolon 1
new Handle:g_hInterval;
new Handle:g_hTimer;
#define PLUGIN_VERSION "1.3.3.7"

public Plugin:myinfo = 
{
name = "Cr(+)sshair's [HG $]",
author = "Cr(+)sshair",
description = "Type !$ or !money to receive cash!",
version = PLUGIN_VERSION,
url = "http://www.hellsgamers.com/"
};


new g_iAccount = -1;

public OnMapStart() {


g_hTimer          = CreateTimer(GetConVarInt(g_hInterval) * 1.0, Timer_Show, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
}


public OnPluginStart()
{
g_iAccount = FindSendPropOffs("CCSPlayer", "m_iAccount");

CreateConVar("hg_$_version", PLUGIN_VERSION, "HG$ Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED);
g_hInterval       = CreateConVar("hg_timer", "65",                 "");


RegConsoleCmd( "say", Command_money );
RegConsoleCmd( "say_team", Command_money );

}

public Action:Timer_Show(Handle:timer) 
{
PrintToChatAll( "\x04[HG $] Type !$ or !money to fill your wallet!" );
}

public Action:Command_money(client, args)
{
decl String:Said[ 128 ];

GetCmdArgString( Said, sizeof( Said ) - 1 );
StripQuotes( Said );
TrimString( Said );

if( StrEqual( Said, "!$" ) || StrEqual( Said, "!money" ) )
{

new iAmount;
iAmount = 16000;

	SetMoney(client, iAmount);

}

return Plugin_Continue;
}

public SetMoney(client, amount)
{
if (g_iAccount != -1)
	SetEntData(client, g_iAccount, amount);
	PrintToChat(client, "\x04[HG $] You now have $16000!");
}

Edited by Cr(+)sshair
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share