(Sorry if my english suck a bit :s)
Basically writing a subplugin for a FF2 boss (.ff2), the people tell me "Heey! f***ing duos, i dont want to be that boss >:c", but i dont want to remove them...
So, my solution is a plugin that gives (players)*7 points as "Refund" for the Grupal boss' assistants (Example: In Sonic duo, Tails will recive 77 points, but sonic doesn't)
Here's my plugin .sp
PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <tf2_stocks>
#include <freak_fortress_2>
#include <freak_fortress_2_subplugin>
#define ME 2048
new playing;
public Plugin:myinfo = {
name = "Freak Fortress 2: BossRefundPoints",
author = "krizcold",
version = "1.0",
};
public OnPluginStart2()
{
HookEvent("arena_round_start", Event_RoundStart, EventHookMode_PostNoCopy);
HookEvent("arena_win_panel", Event_RoundEnd, EventHookMode_PostNoCopy);
}
public Action:Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
if (FF2_IsFF2Enabled())
{
for(new g_boss; FF2_GetBossUserId(g_boss)!=-1; g_boss++)
{
if (g_boss>0)
{
playing=0;
for(new client=1; client<=MaxClients; client++)
{
if(IsValidClient(client) && GetClientTeam(client)>_:TFTeam_Spectator)
{
playing++;
}
}
}
}
}
}
public Action:Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
if (FF2_IsFF2Enabled())
{
for(new g_boss; FF2_GetBossUserId(g_boss)!=-1; g_boss++)
{
if (IsValidClient(g_boss))
{
if (FF2_HasAbility(g_boss, this_plugin_name, "refundpoints"))
{
CreateTimer(3.1, Timer_GivePoints, _, TIMER_FLAG_NO_MAPCHANGE);
}
}
}
}
}
public Action:Timer_GivePoints(Handle:timer)
{
for(new g_boss; FF2_GetBossUserId(g_boss)!=-1; g_boss++)
{
if (IsValidClient(g_boss))
{
new buspoints=playing*FF2_GetAbilityArgument(g_boss, this_plugin_name, "refundpoints", 1);
FF2_SetQueuePoints(g_boss, buspoints);
CPrintToChat(g_boss, "{olive}[Kriz_cold]{default} ĦHas recibido {yellow}%i {default}puntos como {yellow}reembolso {default}por formar parte de un Duo/Trio! ĦDiviertete!", buspoints);
new g_boss = -1;
}
}
}
stock IsValidClient(client, bool:replaycheck=true)
{
if(client<=0 || client>MaxClients)
{
return false;
}
if(!IsClientInGame(client))
{
return false;
}
if(GetEntProp(client, Prop_Send, "m_bIsCoaching"))
{
return false;
}
if(replaycheck)
{
if(IsClientSourceTV(client) || IsClientReplay(client))
{
return false;
}
}
return true;
}
public Action:FF2_OnAbility2(index, const String:plugin_name[], const String:ability_name[], action)
{
}
AND this is a fragment of the Tails_duo.cfg
PHP Code:
"ability8"
{
"name" "refundpoints"
"arg1" "7"
"plugin_name" "kcbossrefund"
}
I try it and it works when i'm alone with bots.. BUT, when I invited to other player for test it doesn't ;_; WHY, What did I do wrong?? idk
It's my first plugin, If someone can help me I would be so thankful.
Also, if this works you are free to use it