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

Freak fortress Refund points for grupal bosses


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kriz_cold
Junior Member
Join Date: Mar 2016
Location: Chile
Old 03-22-2016 , 13:53   Freak fortress Refund points for grupal bosses
Reply With Quote #1

(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_RoundStartEventHookMode_PostNoCopy);
    
HookEvent("arena_win_panel"Event_RoundEndEventHookMode_PostNoCopy);
}
    
public 
Action:Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    if (
FF2_IsFF2Enabled())
    {
        for(new 
g_bossFF2_GetBossUserId(g_boss)!=-1g_boss++)
        {
            if (
g_boss>0)
            {
                
playing=0;
                for(new 
client=1client<=MaxClientsclient++)
                {
                    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_bossFF2_GetBossUserId(g_boss)!=-1g_boss++)
        {
            if (
IsValidClient(g_boss))
            {
                if (
FF2_HasAbility(g_bossthis_plugin_name"refundpoints"))
                {
                    
CreateTimer(3.1Timer_GivePoints_TIMER_FLAG_NO_MAPCHANGE);
                }
            }
        }
    }
}

public 
Action:Timer_GivePoints(Handle:timer)
{

    for(new 
g_bossFF2_GetBossUserId(g_boss)!=-1g_boss++)
    {
        if (
IsValidClient(g_boss))
        {
            new 
buspoints=playing*FF2_GetAbilityArgument(g_bossthis_plugin_name"refundpoints"1);
            
FF2_SetQueuePoints(g_bossbuspoints);
            
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(clientbool:replaycheck=true)
{
    if(
client<=|| client>MaxClients)
    {
        return 
false;
    }

    if(!
IsClientInGame(client))
    {
        return 
false;
    }

    if(
GetEntProp(clientProp_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
kriz_cold 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 04:34.


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