Quote:
Originally Posted by sim242
That'll sort spectators being included. As for your translations I see no reference to a translation file anywhere in the code so I don't understand what you mean with translations.
|
I included that on the script I compiled for my server.
Might as well include your update and then post it back including the translations
EDIT:
Ok, implemented your code. Thanks!
Here's the full code I'm currently using, which includes pretty much every update you guys posted here, and I included a simple translation file myself (thanks Papero for your help!)
Main code:
PHP Code:
#include <sourcemod>
#include <cstrike>
#include <sdktools>
#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)
{
//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; i <= MaxClients; i++)
if (IsValidClient(i))
CheckTag(i);
}
void CheckTag(int client)
{
//If clients team is T or CT
if (GetClientTeam(client) > 1)
{
//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) + 150);
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));
}
And the translation file:
PHP Code:
"Phrases"
{
"mex_1"
{
"en" "You got {Green}$150 bonus{Default} for using our clantag, thank you!"
"it" "Hai ricevuto {Green}$150{Default} di bonus per avere la nostra clantag, grazie!"
}
"mex_2"
{
"en" "Use our tag {Green}nudonudo{Default} for an in-game BONUS!"
"it" "Usa la tag {Green}nudonudo{Default} per un BONUS in-game!"
}
}
So yeah, I'm trying to figure out why, usually at the beginning of the map, the text is displayed in english (language I'm running CS:GO) and some other times I see it in italian lol.
TODO LIST:
(and I'd like to learn this on my own, but any other suggestion and help is always appreciated):
- CFG file to set bonus type (perhaps include other things other than a cash bonus? Armor, extra health, etc, but not really important, just an idea I got right now)
- CFG to toggle giving out bonus on first round for each side
Another bug we need to fix:
On team change (from T to CT or vice versa) the plugin will still display the message "you got blah blah bonus " etc etc, but the player doesn't get any bonus instead. It's just the message being displayed.
This should be fixed and we should make it possible to toggle the bonus on these rounds (first round for each side) and add it to the CFG.
Going to learn about CFG's right now :p
EDIT2: seems like there is an issue. The bonus is not awarded at the SECOND round. (third if warmup is included). It should only skip the FIRST round.
__________________