Raised This Month: $ Target: $400
 0% 

10,000 Cash Each Round for players with a custom admin FLAG??


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
[UC]Darkwolf
Member
Join Date: Jul 2007
Old 06-06-2009 , 04:16   10,000 Cash Each Round for players with a custom admin FLAG??
Reply With Quote #1

I'm right in the middle of trying to make a transition from Mani Mod and would like to see if I can get a script made to, give 10,000 cash each and every round for players with a custom admin flag (such as "s") or an immunity level. Either one would work.. But I think an admin flag would be more appropriate. Any help would be greatly appreciated! Thanks so much.
Jason
[UC]Darkwolf is offline
[UC]Darkwolf
Member
Join Date: Jul 2007
Old 06-06-2009 , 09:14   Re: 10,000 Cash Each Round for players with a custom admin FLAG??
Reply With Quote #2

Hmm ok -- So I came across this .sp file -- but how can adding a custom admin flag be implemented?





/*
Extra Cash
Adds 16000 to every player on spawn

*/


#include <sourcemod>

#define VERSION "0.2"

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","Set s Amount OF Money Given On Spawn",FCVAR_NOTIFY);
HookEvent("player_spawn" , Spawn);
}

public Spawn(Handle: event , const String: name[] , bool: dontBroadcast)
{
new clientID = GetEventInt(event,"userid");
new client = GetClientOfUserId(clientID);
if(GetConVarInt(Switch))
{
SetMoney(client,GetConVarInt(Cash));
}
}

public SetMoney(client, amount)
{
if (g_iAccount != -1)
{
SetEntData(client, g_iAccount, amount);
}
}
[UC]Darkwolf is offline
MikeJS
Senior Member
Join Date: Nov 2008
Old 06-06-2009 , 12:30   Re: 10,000 Cash Each Round for players with a custom admin FLAG??
Reply With Quote #3

Code:
/* 
    Extra Cash
        Adds 16000 to every player on spawn 
        
*/


#include <sourcemod>

#define VERSION "0.2"

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","Sets Amount OF Money Given On Spawn",FCVAR_NOTIFY);
    HookEvent("player_spawn" , Spawn);
}

public Spawn(Handle: event , const String: name[] , bool: dontBroadcast)
{
    new clientID = GetEventInt(event,"userid");
    new client = GetClientOfUserId(clientID);
    if(GetConVarInt(Switch) && GetUserFlagBits(client)&ADMFLAG_CUSTOM1)
    {
        SetMoney(client,GetConVarInt(Cash));
    }
}

public SetMoney(client, amount)
{
    if (g_iAccount != -1)
    {
        SetEntData(client, g_iAccount, amount);
    }    
}
__________________

Last edited by MikeJS; 06-07-2009 at 07:30. Reason: fail formatting, thanks Peace-Maker for the correction
MikeJS is offline
[UC]Darkwolf
Member
Join Date: Jul 2007
Old 06-07-2009 , 06:26   Re: 10,000 Cash Each Round for players with a custom admin FLAG??
Reply With Quote #4

Hmmm -- I tried this but for some reason it gives money to everyone still..
[UC]Darkwolf is offline
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 06-07-2009 , 07:05   Re: 10,000 Cash Each Round for players with a custom admin FLAG??
Reply With Quote #5

Code:
if(GetConVarInt(Switch) && (GetUserFlagBits(client) & ADMFLAG_CUSTOM1))
GetUserFlagBits() is the right funciton.
__________________
Peace-Maker is offline
[UC]Darkwolf
Member
Join Date: Jul 2007
Old 06-07-2009 , 08:41   Re: 10,000 Cash Each Round for players with a custom admin FLAG??
Reply With Quote #6

Thank you so much man -- Works perfect. I was wondering if there was a way to set it so that it does not give money on the first 2 rounds?
[UC]Darkwolf 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 18:44.


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