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

Clantag benefits


Post New Thread Reply   
 
Thread Tools Display Modes
Obyboby
Veteran Member
Join Date: Sep 2013
Old 07-20-2017 , 13:58   Re: Clantag benefits
Reply With Quote #11

Quote:
Originally Posted by vortex. View Post
Yes
This way didn't work. It just displays the default color and I can see the {Green} and {Default} as plain text. :C

Code:
PrintToChat(client, "You got {Green}$100 bonus{Default} for using our clantag, thank you!");
Something to do with the ""'s?

EDIT: some user reported receiving the bonus even if he's not using the tag (and he wasn't even in the steam group :/ )
Is that possible?
__________________

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

I dont have time for check. As I said, I'm not at home.

Try, CPrintToChat

When I at home, I will rewrote.
__________________
vortex. is offline
Obyboby
Veteran Member
Join Date: Sep 2013
Old 07-20-2017 , 15:33   Re: Clantag benefits
Reply With Quote #13

Quote:
Originally Posted by vortex. View Post
I dont have time for check. As I said, I'm not at home.

Try, CPrintToChat

When I at home, I will rewrote.
no problem whatsoever dude, I'm happy to keep testing and report here :p
I was out too but I will try again asap.

EDIT: ok that didn't fix the issue either, non-tagged players still see the message. They don't get the bonus, but they see the message in chat.
__________________

Last edited by Obyboby; 07-20-2017 at 16:33.
Obyboby is offline
vortex.
AlliedModders Donor
Join Date: Jan 2017
Location: OnGameFrame()
Old 07-21-2017 , 19:02   Re: Clantag benefits
Reply With Quote #14

You can PM to me. I can help you, tomorrow.
__________________
vortex. is offline
Obyboby
Veteran Member
Join Date: Sep 2013
Old 07-25-2017 , 18:14   Re: Clantag benefits
Reply With Quote #15

I'm trying to show a message when a player gets the bonus, but it is shown to EVERY player instead.
Players with my tag will get the money, AND see the message.
Players with NO tag will NOT get the money, BUT STILL see the message.

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(client, "You got $100 bonus for using our clantag, thank you!"); 
}

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

stock bool IsValidClient(int client)
{
    return (1 <= client <= MaxClients && IsClientInGame(client));
}
What do I need to change here?
__________________
Obyboby is offline
BraveFox
AlliedModders Donor
Join Date: May 2015
Location: Israel
Old 07-25-2017 , 19:22   Re: Clantag benefits
Reply With Quote #16

PHP 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[] 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);
        
CPrintToChat(client"You got $100 bonus for using our clantag, thank you!"); 
    else
        
CPrintToChat(client"Use our clantag(%s) to recive $100 bonus every round start!"PLUGIN_TAG);
}

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

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

__________________
Contact Me:
Steam: NoyB
Discord: Noy#9999
Taking Private Requests
BraveFox is offline
vortex.
AlliedModders Donor
Join Date: Jan 2017
Location: OnGameFrame()
Old 07-25-2017 , 19:22   Re: Clantag benefits
Reply With Quote #17

PHP Code:
    //If Client Clan Tag Contains input from PLUGIN_TAG
    
if(StrContains(sTagPLUGIN_TAG) != -1)
        
SetEntProp(clientProp_Send"m_iAccount"GetClientCash(client) + 100);
        
CPrintToChat(client"You got $100 bonus for using our clantag, thank you!"); 
Change to

PHP Code:
    //If Client Clan Tag Contains input from PLUGIN_TAG
    
if(StrEqual(sTagPLUGIN_TAG))
    {
        
SetEntProp(clientProp_Send"m_iAccount"GetClientCash(client) + 100);
        
CPrintToChat(client"You got $100 bonus for using our clantag, thank you!"); 
    } 
__________________
vortex. is offline
WatchDogs
Senior Member
Join Date: Oct 2015
Location: Iran
Old 07-25-2017 , 19:25   Re: Clantag benefits
Reply With Quote #18

Just because of {}

If you have more than one command in if - else - for - while, etc you should use { } to specify the code block that engine should run.

EDIT: Posting without refreshing page vortex. is correct ;)
__________________

Last edited by WatchDogs; 07-25-2017 at 19:27. Reason: Posting without refreshing page
WatchDogs is offline
Obyboby
Veteran Member
Join Date: Sep 2013
Old 07-26-2017 , 01:32   Re: Clantag benefits
Reply With Quote #19

Thanks guys!!!!
__________________
Obyboby is offline
vortex.
AlliedModders Donor
Join Date: Jan 2017
Location: OnGameFrame()
Old 07-26-2017 , 05:12   Re: Clantag benefits
Reply With Quote #20

You're welcome
__________________
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 11:21.


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