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

[REQ][CSS] add Money


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Böhser Onkel Leo
Member
Join Date: Jun 2010
Location: near Bielefeld, Germany
Old 08-04-2011 , 04:55   [REQ][CSS] add Money
Reply With Quote #1

Hey!
Could someone change the extra cash plugin from Peoples Army? I need a plugin that add the money and not set to a specific amount.

https://forums.alliedmods.net/showthread.php?t=59079

Leo
__________________
SRY for my bad english!!!!
Böhser Onkel Leo is offline
Send a message via ICQ to Böhser Onkel Leo
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 08-04-2011 , 06:54   Re: [REQ][CSS] add Money
Reply With Quote #2

Try this, compile here http://www.sourcemod.net/compiler.php
PHP Code:
/* 
    Extra Cash
        Adds 16000 to every player on spawn 
        
*/


#include <sourcemod>

#define VERSION "0.3"

new g_iAccount = -1;
new 
Handle:Switch;
new 
Handle:Cash;

public 
Plugin:myinfo 
{
    
name "Extra Cash",
    
author "Peoples Army",
    
description "Adds Extra Cash On Each Spawn",
    
version VERSION,
    
url "www.sourcemod.net"
}

public 
OnPluginStart()
{
    
g_iAccount FindSendPropOffs("CCSPlayer""m_iAccount");
    Switch = 
CreateConVar("extra_Cash_on","1","1 turns plugin on 0 is off",FCVAR_NOTIFY);
    
Cash CreateConVar("extra_cash_amount","16000","Add Amount OF Money Given On Spawn",FCVAR_NOTIFY);
    
HookEvent("player_spawn" Spawn);
}

public 
Spawn(Handleevent , const Stringname[] , booldontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event,"userid"));

    if(
GetConVarInt(Switch) && GetClientTeam(client) > 1)
    {
        
AddMoney(client,GetConVarInt(Cash));
    }
}

public 
AddMoney(clientamount)
{
    if (
g_iAccount != -1)
    {
        new 
cash GetEntData(clientg_iAccount);
        
SetEntData(clientg_iAccountcash amount);
    }    

*edit
I change it when ALIVE player spawn, then he get extra fund.
*update, check now team. Tested and seems player is alive when spectate

Last edited by Bacardi; 08-08-2011 at 09:12.
Bacardi is offline
Despirator
Senior Member
Join Date: Jun 2011
Location: Kazakhstan ->Shymkent
Old 08-05-2011 , 15:36   Re: [REQ][CSS] add Money
Reply With Quote #3

if a player spawns certainly he is alive and is in game))
Despirator is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 08-06-2011 , 08:57   Re: [REQ][CSS] add Money
Reply With Quote #4

Quote:
Originally Posted by Despirator View Post
if a player spawns certainly he is alive and is in game))
When player join server, he spawn first time in team = 0 and dead, what I remember,
and I still added check is client in game before is player alive prevent errors.

But what ever

*update
Yeah, seems player joinning server and spawn team = 0, is alive... change code to check team index

Last edited by Bacardi; 08-08-2011 at 09:13.
Bacardi is offline
Böhser Onkel Leo
Member
Join Date: Jun 2010
Location: near Bielefeld, Germany
Old 08-14-2011 , 03:22   Re: [REQ][CSS] add Money
Reply With Quote #5

Bacardi.. i just love you like homer loves donuts!

Thx thx thx...

Leo
__________________
SRY for my bad english!!!!
Böhser Onkel Leo is offline
Send a message via ICQ to Böhser Onkel Leo
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 12:36.


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