Raised This Month: $ Target: $400
 0% 

Clantag benefits


Post New Thread Reply   
 
Thread Tools Display Modes
Obyboby
Veteran Member
Join Date: Sep 2013
Old 09-09-2017 , 11:54   Re: Clantag benefits
Reply With Quote #21

Quote:
Originally Posted by vortex. View Post
You're welcome
Cannot compile on latest sourcemod build (6022 or 6025, just tried 6027 right now)

https://i.imgur.com/YEaoFwt.png

How can I fix that?
Also I can't see the code to print to chat, for users without the tag, the message "use our tag for a bonus" etc etc how can I add it back?

Reason: changed server name and needed to recompile with the new clan tag.

(a .cfg for the desired clan tag would be awesome this time, to avoid having to recompile)
:p


I tried adding the message myself but the errors persist anyway:

here's my "latest" code (well not "my code" but u get what i mean )

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

#define PLUGIN_TAG "nudonudo"

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(StrEqual(sTag, PLUGIN_TAG)) 
    { 
        SetEntProp(client, Prop_Send, "m_iAccount", GetClientCash(client) + 200); 
        CPrintToChat(client, "You got $100 bonus for using our clantag, thank you!");  
    }  
    else
    {
        CPrintToChat(client, "Use our tag nudonudo for an in-game bonus!");  
    }

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

stock bool IsValidClient(int client)
{
    return (1 <= client <= MaxClients && IsClientInGame(client));
}
EDIT: I have a feeling this is not the code i have in the plugin I got running on my server right now...but I don't know where I saved it. I will have to re-add that message I mentioned :C


EDIT2:

FIXED! Thanks to Papero!

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

#define PLUGIN_TAG "nudonudo"

public void OnPluginStart()
{
	HookEvent("round_start", Event_RoundStart);
	LoadTranslations("ez_tagbenefits.phrases.txt"); 
}

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 (StrEqual(sTag, PLUGIN_TAG))
	{
		SetEntProp(client, Prop_Send, "m_iAccount", GetClientCash(client) + 200);
		CPrintToChat(client, "%t", "mex_1");
	}
	else
	{
		CPrintToChat(client, "%t", "mex_2");
	}
}

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

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

Last edited by Obyboby; 09-09-2017 at 12:39.
Obyboby is offline
Papero
Veteran Member
Join Date: Aug 2016
Location: Italy
Old 09-09-2017 , 12:14   Re: Clantag benefits
Reply With Quote #22

Here you are:
PHP Code:
#include <sourcemod> 
#include <cstrike>  
#include <multicolors>

#define PLUGIN_TAG "nudonudo"

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 (StrEqual(sTagPLUGIN_TAG))
    {
        
SetEntProp(clientProp_Send"m_iAccount"GetClientCash(client) + 200);
        
CPrintToChat(client"You got $100 bonus for using our clantag, thank you!");
    }
    else
    {
        
CPrintToChat(client"Use our tag nudonudo for an in-game bonus!");
    }
}

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

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

__________________
My Plugins
SPCode


Steam: hexer504
Telegram: Hexah
Discord: Hexah#6903

If you like my work you can donate here!

Last edited by Papero; 09-09-2017 at 12:14.
Papero is offline
Obyboby
Veteran Member
Join Date: Sep 2013
Old 09-11-2017 , 16:56   Re: Clantag benefits
Reply With Quote #23

I'm trying to add a round check, I'd like the plugin to give out bonuses starting from the 2nd round (3rd if we count the warmup).
__________________
Obyboby is offline
Papero
Veteran Member
Join Date: Aug 2016
Location: Italy
Old 09-11-2017 , 17:20   Re: Clantag benefits
Reply With Quote #24

Quote:
Originally Posted by Obyboby View Post
I'm trying to add a round check, I'd like the plugin to give out bonuses starting from the 2nd round (3rd if we count the warmup).
Here you are:
PHP Code:
#include <sourcemod> 
#include <cstrike>  
#include <sdktools>
#include <multicolors>

#define PLUGIN_TAG "nudonudo"

int iRoundCount 0;

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

public 
Action Event_RoundStart(Event event, const char[] namebool dontBroadcast)
{
    
//Ignore warmup
    
if (GameRules_GetProp("m_bWarmupPeriod") == 1)
        return;
    
//Increase iRoundCount
    
iRoundCount++;
    
//If rounds are < than 2 return 
    
if (iRoundCount 2)
        return;
        
    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 (StrEqual(sTagPLUGIN_TAG))
    {
        
SetEntProp(clientProp_Send"m_iAccount"GetClientCash(client) + 200);
        
CPrintToChat(client"You got $100 bonus for using our clantag, thank you!");
    }
    else
    {
        
CPrintToChat(client"Use our tag nudonudo for an in-game bonus!");
    }
}

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

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

__________________
My Plugins
SPCode


Steam: hexer504
Telegram: Hexah
Discord: Hexah#6903

If you like my work you can donate here!
Papero is offline
Obyboby
Veteran Member
Join Date: Sep 2013
Old 09-12-2017 , 04:44   Re: Clantag benefits
Reply With Quote #25

Still getting the bonus at match start :C (round 2, including warmup)
__________________
Obyboby is offline
DarkBlackOMG
Member
Join Date: Oct 2015
Old 09-12-2017 , 05:59   Re: Clantag benefits
Reply With Quote #26

Took the code from Papero and i think this should work

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

#define PLUGIN_TAG "nudonudo" 

public void OnPluginStart() 

    
HookEvent("round_start"Event_RoundStart); 


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

    
//Ignore warmup 
    
if (GameRules_GetProp("m_bWarmupPeriod") == 1
        return; 
    
    
rounds CS_GetTeamScore(3) + CS_GetTeamScore(2);

    
//If rounds are < than 2 return  
    
if (rounds 1
        return; 
         
    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 (StrEqual(sTagPLUGIN_TAG)) 
    { 
        
SetEntProp(clientProp_Send"m_iAccount"GetClientCash(client) + 200); 
        
CPrintToChat(client"You got $100 bonus for using our clantag, thank you!"); 
    } 
    else 
    { 
        
CPrintToChat(client"Use our tag nudonudo for an in-game bonus!"); 
    } 


int GetClientCash(int client

    return 
GetEntProp(clientProp_Send"m_iAccount"); 


stock bool IsValidClient(int client

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

DarkBlackOMG is offline
Obyboby
Veteran Member
Join Date: Sep 2013
Old 09-12-2017 , 06:29   Re: Clantag benefits
Reply With Quote #27

Quote:
Originally Posted by DarkBlackOMG View Post
Took the code from Papero and i think this should work

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

#define PLUGIN_TAG "nudonudo" 

public void OnPluginStart() 

    
HookEvent("round_start"Event_RoundStart); 


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

    
//Ignore warmup 
    
if (GameRules_GetProp("m_bWarmupPeriod") == 1
        return; 
    
    
rounds CS_GetTeamScore(3) + CS_GetTeamScore(2);

    
//If rounds are < than 2 return  
    
if (rounds 1
        return; 
         
    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 (StrEqual(sTagPLUGIN_TAG)) 
    { 
        
SetEntProp(clientProp_Send"m_iAccount"GetClientCash(client) + 200); 
        
CPrintToChat(client"You got $100 bonus for using our clantag, thank you!"); 
    } 
    else 
    { 
        
CPrintToChat(client"Use our tag nudonudo for an in-game bonus!"); 
    } 


int GetClientCash(int client

    return 
GetEntProp(clientProp_Send"m_iAccount"); 


stock bool IsValidClient(int client

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

Can't compile.

__________________
Obyboby is offline
DarkBlackOMG
Member
Join Date: Oct 2015
Old 09-12-2017 , 08:47   Re: Clantag benefits
Reply With Quote #28

Quote:
Originally Posted by Obyboby View Post
Can't compile.

My bad, fixed it,

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

#define PLUGIN_TAG "nudonudo"  

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

public 
Action Event_RoundStart(Event event, const char[] namebool dontBroadcast)  
{  
    
//Ignore warmup  
    
if (GameRules_GetProp("m_bWarmupPeriod") == 1)  
        return;  
     
    new 
rounds;
    
rounds CS_GetTeamScore(3) + CS_GetTeamScore(2); 

    
//If rounds are < than 2 return   
    
if (rounds 1)  
        return;  
          
    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 (StrEqual(sTagPLUGIN_TAG))  
    {  
        
SetEntProp(clientProp_Send"m_iAccount"GetClientCash(client) + 200);  
        
CPrintToChat(client"You got $100 bonus for using our clantag, thank you!");  
    }  
    else  
    {  
        
CPrintToChat(client"Use our tag nudonudo for an in-game bonus!");  
    }  
}  

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

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

DarkBlackOMG is offline
Obyboby
Veteran Member
Join Date: Sep 2013
Old 09-12-2017 , 17:11   Re: Clantag benefits
Reply With Quote #29

Quote:
Originally Posted by DarkBlackOMG View Post
My bad, fixed it,

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

#define PLUGIN_TAG "nudonudo"  

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

public 
Action Event_RoundStart(Event event, const char[] namebool dontBroadcast)  
{  
    
//Ignore warmup  
    
if (GameRules_GetProp("m_bWarmupPeriod") == 1)  
        return;  
     
    new 
rounds;
    
rounds CS_GetTeamScore(3) + CS_GetTeamScore(2); 

    
//If rounds are < than 2 return   
    
if (rounds 1)  
        return;  
          
    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 (StrEqual(sTagPLUGIN_TAG))  
    {  
        
SetEntProp(clientProp_Send"m_iAccount"GetClientCash(client) + 200);  
        
CPrintToChat(client"You got $100 bonus for using our clantag, thank you!");  
    }  
    else  
    {  
        
CPrintToChat(client"Use our tag nudonudo for an in-game bonus!");  
    }  
}  

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

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


Tyvm dude!
Just uploaded it and let's see if it works.
A few needed adjustments:

- A spectator is still being checked, the plugin should only check T/CT players.
- I added a translation, though sometimes it's being displayed in english, some other time in my own language, what could be the reason?
__________________
Obyboby is offline
sim242
AlliedModders Donor
Join Date: Dec 2012
Location: England
Old 09-13-2017 , 08:12   Re: Clantag benefits
Reply With Quote #30

Been looking for something to do at home when I'm bored. I can sort that for you when I get home ^^ I should be home around 5pm (for reference the current time for me is 1:12pm UK time).

If no one has sorted it by the time I'm home I'll get it done
__________________
Steam - Sim
Request a private plugin
Not accepting requests at this time
sim242 is offline
Send a message via Skype™ to sim242
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 19:04.


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