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

Clantag benefits


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sw33T3R
AlliedModders Donor
Join Date: Mar 2014
Old 06-23-2017 , 10:06   Clantag benefits
Reply With Quote #1

Hello
I'd like 2 request a small plugin
If a player has a "CSGO" clan tag, he will receive 100$ on round start

Anyone can help?
Sw33T3R is offline
xines
Veteran Member
Join Date: Aug 2013
Location: Denmark
Old 06-23-2017 , 12:06   Re: Clantag benefits
Reply With Quote #2

Wrote this real quick.
PHP Code:
#define PLUGIN_TAG "CSGO"

public void OnPluginStart()
{    
    
HookEvent("round_start"Event_RoundStart);
}

public 
Action Event_RoundStart(Event event, const char[] namebool dontBroadcast)
{
    for(
int i 1<= MaxClientsi++)
        if (
IsValidClient(i)) CheckTag(i);
}

void CheckTag(int client)
{
    
//Clear Variables
    
char sTag[256];
    
    
//Get Client Clan Tag
    
CS_GetClientClanTag(clientsTagsizeof(sTag));
    
    
//If Client Clan Tag Contains input from PLUGIN_TAG
    
if(StrContains(sTagPLUGIN_TAG) != -1)
        
SetEntProp(clientProp_Send"m_iAccount"GetClientCash(client) + 100);
}

int GetClientCash(int client)
{
    return 
GetEntProp(clientProp_Send"m_iAccount");
}

stock bool IsValidClient(int client)
{
    return (
<= client <= MaxClients && IsClientInGame(client));

__________________
xines is offline
Sw33T3R
AlliedModders Donor
Join Date: Mar 2014
Old 06-23-2017 , 13:01   Re: Clantag benefits
Reply With Quote #3

Quote:
Originally Posted by xines View Post
Wrote this real quick.
PHP Code:
#define PLUGIN_TAG "CSGO"

public void OnPluginStart()
{    
    
HookEvent("round_start"Event_RoundStart);
}

public 
Action Event_RoundStart(Event event, const char[] namebool dontBroadcast)
{
    for(
int i 1<= MaxClientsi++)
        if (
IsValidClient(i)) CheckTag(i);
}

void CheckTag(int client)
{
    
//Clear Variables
    
char sTag[256];
    
    
//Get Client Clan Tag
    
CS_GetClientClanTag(clientsTagsizeof(sTag));
    
    
//If Client Clan Tag Contains input from PLUGIN_TAG
    
if(StrContains(sTagPLUGIN_TAG) != -1)
        
SetEntProp(clientProp_Send"m_iAccount"GetClientCash(client) + 100);
}

int GetClientCash(int client)
{
    return 
GetEntProp(clientProp_Send"m_iAccount");
}

stock bool IsValidClient(int client)
{
    return (
<= client <= MaxClients && IsClientInGame(client));

Thanks, i love u man ♥
Sw33T3R is offline
Obyboby
Veteran Member
Join Date: Sep 2013
Old 07-20-2017 , 13:00   Re: Clantag benefits
Reply With Quote #4

Quote:
Originally Posted by xines View Post
Wrote this real quick.
PHP Code:
#define PLUGIN_TAG "CSGO"

public void OnPluginStart()
{    
    
HookEvent("round_start"Event_RoundStart);
}

public 
Action Event_RoundStart(Event event, const char[] namebool dontBroadcast)
{
    for(
int i 1<= MaxClientsi++)
        if (
IsValidClient(i)) CheckTag(i);
}

void CheckTag(int client)
{
    
//Clear Variables
    
char sTag[256];
    
    
//Get Client Clan Tag
    
CS_GetClientClanTag(clientsTagsizeof(sTag));
    
    
//If Client Clan Tag Contains input from PLUGIN_TAG
    
if(StrContains(sTagPLUGIN_TAG) != -1)
        
SetEntProp(clientProp_Send"m_iAccount"GetClientCash(client) + 100);
}

int GetClientCash(int client)
{
    return 
GetEntProp(clientProp_Send"m_iAccount");
}

stock bool IsValidClient(int client)
{
    return (
<= client <= MaxClients && IsClientInGame(client));

I can't compile it... but the compile window closes itself so fast that I can't actually understand the reason. :C
__________________
Obyboby is offline
vortex.
AlliedModders Donor
Join Date: Jan 2017
Location: OnGameFrame()
Old 07-20-2017 , 13:06   Re: Clantag benefits
Reply With Quote #5

Add includes;
PHP Code:
#include <sourcemod>
#include <cstrike> 
__________________
vortex. is offline
Obyboby
Veteran Member
Join Date: Sep 2013
Old 07-20-2017 , 13:13   Re: Clantag benefits
Reply With Quote #6

Quote:
Originally Posted by vortex. View Post
Add includes;
PHP Code:
#include <sourcemod>
#include <cstrike> 
It worked!!!
I was a bit confused because the other user thanked the developer and it looked like it worked for him. :p
Thanks!
It's not working right now but maybe I need a map change for it to be active..let's see.

EDIT: works perfectly now.
How can I add a message that is displayed if the player gets the bonus?
Something like
ROund start
"You got $100 bonus for using the clantag blah blah"

EDIT2: the bonus is not awarded after half time, I also need to fix that :p
__________________

Last edited by Obyboby; 07-20-2017 at 13:33.
Obyboby is offline
Obyboby
Veteran Member
Join Date: Sep 2013
Old 07-20-2017 , 13:51   Re: Clantag benefits
Reply With Quote #7

Posting a new reply to avoid clutter.

Code:
#include <sourcemod> 
#include <cstrike>  
#include <multicolors>

#define PLUGIN_TAG "ezgamingita"

public void OnPluginStart()
{   
    HookEvent("round_start", Event_RoundStart);
}

public Action Event_RoundStart(Event event, const char[] name, bool dontBroadcast)
{
    for(int i = 1; i <= MaxClients; i++)
        if (IsValidClient(i)) CheckTag(i);
}

void CheckTag(int client)
{
    //Clear Variables
    char sTag[256];
    
    //Get Client Clan Tag
    CS_GetClientClanTag(client, sTag, sizeof(sTag));
    
    //If Client Clan Tag Contains input from PLUGIN_TAG
    if(StrContains(sTag, PLUGIN_TAG) != -1)
        SetEntProp(client, Prop_Send, "m_iAccount", GetClientCash(client) + 100);
        CPrintToChat("You were awarded {Green}$100{Default} for using our clan tag. Thank you!");
}

int GetClientCash(int client)
{
    return GetEntProp(client, Prop_Send, "m_iAccount");
}

stock bool IsValidClient(int client)
{
    return (1 <= client <= MaxClients && IsClientInGame(client));
}

I took a look at other plugins to find out how to add the message about the reward, but it's still not working.


First I added this

Code:
CPrintToChat("You were awarded {Green}$100{Default} for using our clan tag. Thank you!");
Then thought I would need to include Multicolors, which I did.
But the plugin still fails to compile. Am I on the right track?
__________________

Last edited by Obyboby; 07-20-2017 at 13:52.
Obyboby is offline
vortex.
AlliedModders Donor
Join Date: Jan 2017
Location: OnGameFrame()
Old 07-20-2017 , 13:54   Re: Clantag benefits
Reply With Quote #8

With message version.

If you want halftime version, you can PM to me. I will write for you. But I'm not at home. When I'm at home, i will write.

PHP Code:
#include <sourcemod>
#include <cstrike>

#define PLUGIN_TAG "CSGO" // here your tag

public void OnPluginStart() 
{     
    
HookEvent("round_start"Event_RoundStart); 


public 
Action Event_RoundStart(Event event, const char[] namebool dontBroadcast

    for(
int i 1<= MaxClientsi++) 
        if (
IsValidClient(i)) CheckTag(i); 


void CheckTag(int client

    
//Clear Variables 
    
char sTag[256]; 
     
    
//Get Client Clan Tag 
    
CS_GetClientClanTag(clientsTagsizeof(sTag)); 
     
    
//If Client Clan Tag Contains input from PLUGIN_TAG 
    
if(StrContains(sTagPLUGIN_TAG) != -1)
    {    
        
SetEntProp(clientProp_Send"m_iAccount"GetClientCash(client) + 100); // you can change money -> 100
        
PrintToChat(client"You got $100 bonus for using the clantag, thank you!");
    }


int GetClientCash(int client

    return 
GetEntProp(clientProp_Send"m_iAccount"); 


stock bool IsValidClient(int client

    return (
<= client <= MaxClients && IsClientInGame(client)); 

EDIT: You've already done it. I did not see. Sorry for a new post xD
__________________

Last edited by vortex.; 07-20-2017 at 13:56.
vortex. is offline
Obyboby
Veteran Member
Join Date: Sep 2013
Old 07-20-2017 , 13:55   Re: Clantag benefits
Reply With Quote #9

Ooh, I was getting close then :p

So if I want colors support, I just need to include multicolors right?
Well I'll still give it a shot. :p
Thanks for now!
__________________
Obyboby is offline
vortex.
AlliedModders Donor
Join Date: Jan 2017
Location: OnGameFrame()
Old 07-20-2017 , 13:57   Re: Clantag benefits
Reply With Quote #10

Quote:
Originally Posted by Obyboby View Post
So if I want colors support, I just need to include multicolors right?
Yes
__________________
vortex. 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 00:28.


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