Raised This Month: $ Target: $400
 0% 

[TF2] Resize Heads! (1.1.1) [1/18/2013]


Post New Thread Reply   
 
Thread Tools Display Modes
Chaosxk
Veteran Member
Join Date: Aug 2010
Location: Westeros
Old 10-29-2012 , 16:23   Re: [TF2] Resize Heads! (1.1) [10/28/2012]
Reply With Quote #21

Did you use this on an FF2 server?
__________________
Chaosxk is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 10-29-2012 , 17:00   Re: [TF2] Resize Heads! (1.1) [10/28/2012]
Reply With Quote #22

~~

Last edited by Mitchell; 10-29-2012 at 17:04. Reason: i'm not sure what the crap im saying.
Mitchell is offline
Chaosxk
Veteran Member
Join Date: Aug 2010
Location: Westeros
Old 10-29-2012 , 17:58   Re: [TF2] Resize Heads! (1.1) [10/28/2012]
Reply With Quote #23

What?

And nvm, it happens on all servers. Will look into.
__________________
Chaosxk is offline
BBG_Theory
Veteran Member
Join Date: Oct 2010
Location: NC USA
Old 10-29-2012 , 23:10   Re: [TF2] Resize Heads! (1.1) [10/28/2012]
Reply With Quote #24

no, not on FF2, on a trade server. Also regular clients do not have permission to resizemyhead but I did select in config
sm_resizehead_join "1"
BBG_Theory is online now
ReFlexPoison
☠☠☠
Join Date: Jul 2011
Location: ☠☠☠
Old 10-29-2012 , 23:18   Re: [TF2] Resize Heads! (1.1) [10/28/2012]
Reply With Quote #25

Here's that fix Tak. Give it a try I suppose.

Fixed:
  • Logs not appearing until CVar changed.
  • 'Invalid Target' stopping the function on everyone.
PHP Code:
#pragma semicolon 1

#include <sourcemod>
#include <sdktools>

/* Global Definitions */

#define PLUGIN_VERSION "1.1.1"

/* Global Handles */

new Handle:Version;
new 
Handle:cvarEnabled;
new 
Handle:cvarLogs;
new 
Handle:cvarJoin;
new 
Handle:cvarJoinSize;

/* Global Variables */

new bool:Enabled;
new 
bool:Logs;
new 
Float:g_HeadScale[MAXPLAYERS 1] = 1.0;

public 
Plugin:myinfo =
{
    
name "[TF2] Resize Heads",
    
author "Tak + ReFlexPoison",
    
description "LOL!",
    
version PLUGIN_VERSION,
    
url "http://www.sourcemod.net"
}

public 
APLRes:AskPluginLoad2(Handle:myselfbool:lateString:error[], err_max)
{
    new 
String:Game[32];
    
GetGameFolderName(Gamesizeof(Game));
    if(!
StrEqual(Game"tf"))
    {
        
Format(errorerr_max"This plugin only works for Team Fortress 2");
        return 
APLRes_Failure;
    }
    return 
APLRes_Success;
}

public 
OnPluginStart()
{
    
Version CreateConVar("sm_resizehead_version"PLUGIN_VERSION"Version of Resize Heads"FCVAR_REPLICATED FCVAR_PLUGIN FCVAR_SPONLY FCVAR_DONTRECORD FCVAR_NOTIFY);
    
cvarEnabled CreateConVar("sm_resizehead_enabled""1""Enable Resize Heads"FCVAR_PLUGINtrue0.0true1.0);
    
cvarLogs CreateConVar("sm_resizehead_logs""1""Enable logs of head resizes"FCVAR_PLUGINtrue0.0true1.0);
    
cvarJoin CreateConVar("sm_resizehead_join""0""Should we resize your head when player spawns? Off = 0 Public = 1 Admins = 2"FCVAR_PLUGINtrue0.0true2.0);
    
cvarJoinSize CreateConVar("sm_resizehead_joinsize""1.0""What should the default size be?");

    
HookConVarChange(cvarEnabledCVarChange);
    
HookConVarChange(cvarLogsCVarChange);
    
HookConVarChange(VersionCVarChange);

    
RegAdminCmd("sm_resizehead"ResizeHeadADMFLAG_GENERIC"Resizes players' heads");
    
RegAdminCmd("sm_resizemyhead"ResizeMyHeadADMFLAG_GENERIC"Resizes your head");

    
HookEvent("player_spawn"Player_Spawn);

    
AutoExecConfig(true"resizehead");
    
LoadTranslations("common.phrases");

    for(new 
0<= MaxClientsi++)
    {
        if(!
IsValidClient(i)) continue;
        {
            
g_HeadScale[i] = 1.0;
            
SetEntPropFloat(iProp_Send"m_flHeadScale"1.0);
        }
    }
}

public 
CVarChange(Handle:convar, const String:oldValue[], const String:newValue[])
{
    if(
convar == VersionSetConVarString(VersionPLUGIN_VERSION);
    if(
convar == cvarEnabled)
    {
        if(
GetConVarBool(cvarEnabled)) Enabled true;
        else 
Enabled false;
    }
    if(
convar == cvarLogs)
    {
        if(
GetConVarBool(cvarLogs)) Logs true;
        else 
Logs false;
    }
}

public 
OnConfigsExecuted()
{
    if(
GetConVarBool(cvarEnabled)) Enabled true;
    else 
Enabled false;
}

public 
OnClientPostAdminCheck(client)
{
    if(!
IsValidClient(client)) return;
    
g_HeadScale[client] = 1.0;
}

public 
OnGameFrame()
{
    if(!
Enabled) return;

    for(new 
0<= MaxClientsi++)
    {
        if(!
IsValidClient(i) || g_HeadScale[i] == 1.0) continue;
        {
            
SetEntPropFloat(iProp_Send"m_flHeadScale"g_HeadScale[i]);
        }
    }
}

public 
Action:Player_Spawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
GetClientOfUserId(GetEventInt(event"userid"));
    if(
IsClientInGame(i) && IsClientAuthorized(i))
    {
        if(
Enabled && (GetConVarInt(cvarJoin) == || GetConVarInt(cvarJoin) == && GetUserFlagBits(i) & ADMFLAG_GENERIC))
        {
            
g_HeadScale[i] = 1.0;
            new 
Float:scale GetConVarFloat(cvarJoinSize);

            if(
scale <= 0.0scale 0.1;
            if(
scale 3.0scale 3.0;

            
g_HeadScale[i] = scale;
        }
    }
}
public 
Action:ResizeHead(clientargs)
{
    if(!
Enabled || !IsValidClient(client)) return Plugin_Continue;

    if(
args 2)
    {
        
ReplyToCommand(client"Usage: sm_resizehead <#userid|name> <size>");
        return 
Plugin_Handled;
    }

    
decl String:arg1[65], String:arg2[65], Float:scale;
    
GetCmdArg(1arg1sizeof(arg1));
    
GetCmdArg(2arg2sizeof(arg2));
    
scale StringToFloat(arg2);
    
decl String:target_name[MAX_TARGET_LENGTH];
    
decl target_list[MAXPLAYERS], target_countbool:tn_is_ml;
    if((
target_count ProcessTargetString(
            
arg1,
            
client,
            
target_list,
            
MAXPLAYERS,
            
COMMAND_FILTER_CONNECTED,
            
target_name,
            
sizeof(target_name),
            
tn_is_ml)) <= 0)
    {
        
ReplyToTargetError(clienttarget_count);
        return 
Plugin_Handled;
    }

    if(
scale <= 0.0scale 0.1;
    if(
scale 3.0scale 3.0;

    for(new 
0target_counti++)
    {
        if(
IsValidClient(target_list[i]))
        {
            
g_HeadScale[target_list[i]] = scale;
            if(
LogsLogAction(clienttarget_list[i], "\"%L\" resized head of \"%L\""clienttarget_list[i]);
        }
    }
    
ShowActivity2(client"[SM] ""%N resized head of %s to %f."clienttarget_namescale);
    return 
Plugin_Handled;
}

public 
Action:ResizeMyHead(clientargs)
{
    if(!
Enabled || !IsValidClient(client)) return Plugin_Continue;

    
decl String:arg1[65], Float:scale;
    
GetCmdArg(1arg1sizeof(arg1));
    
scale StringToFloat(arg1);

    if(
args == 0)
    {
        
scale 1.0;
        
g_HeadScale[client] = scale;
        
PrintToChat(client"[SM] Your head size has been reset.");
        return 
Plugin_Handled;
    }
    else if(
args != 1)
    {
        
ReplyToCommand(client"Usage: sm_resizemyhead <size>");
        return 
Plugin_Handled;
    }

    if(
scale <= 0.0scale 0.1;
    if(
scale 3.0scale 3.0;

    
g_HeadScale[client] = scale;
    
PrintToChat(client"[SM] Head size set to %f."scale);
    return 
Plugin_Handled;
}

stock bool:IsValidClient(ibool:replay true)
{
    if(
<= || MaxClients || !IsClientInGame(i) || GetEntProp(iProp_Send"m_bIsCoaching")) return false;
    if(
replay && (IsClientSourceTV(i) || IsClientReplay(i))) return false;
    return 
true;

Attached Files
File Type: sp Get Plugin or Get Source (resizehead.sp - 285 views - 5.5 KB)

Last edited by ReFlexPoison; 10-29-2012 at 23:19.
ReFlexPoison is offline
BBG_Theory
Veteran Member
Join Date: Oct 2010
Location: NC USA
Old 10-30-2012 , 01:13   Re: [TF2] Resize Heads! (1.1) [10/28/2012]
Reply With Quote #26

the !resizehead @all x.x works well now I believe. Still the average client can not !resizemyhead x.x unless I am doing something wrong.. how do I give unrestricted access to all clients?

would this change be correct?

RegAdminCmd("sm_resizemyhead", ResizeMyHead, 0, "Resizes your head");

and a small picky thing, not really a problem.. but a picky observation...
it reports the new size to 6 digits right of decimal
for example, /resizehead @all 2.0

[sm] xxx resized head of all players to 2.000000

Last edited by BBG_Theory; 10-30-2012 at 01:29.
BBG_Theory is online now
ReFlexPoison
☠☠☠
Join Date: Jul 2011
Location: ☠☠☠
Old 10-30-2012 , 01:32   Re: [TF2] Resize Heads! (1.1) [10/28/2012]
Reply With Quote #27

Quote:
Originally Posted by BBG_Theory View Post
how do I give unrestricted access to all clients?
Use - admin - overrides!
ReFlexPoison is offline
BBG_Theory
Veteran Member
Join Date: Oct 2010
Location: NC USA
Old 10-30-2012 , 01:38   Re: [TF2] Resize Heads! (1.1) [10/28/2012]
Reply With Quote #28

nvm, I see the comments in that config

Last edited by BBG_Theory; 10-30-2012 at 01:39.
BBG_Theory is online now
Mr. Man
Veteran Member
Join Date: Mar 2011
Location: Huh?
Old 10-30-2012 , 02:18   Re: [TF2] Resize Heads! (1.1) [10/28/2012]
Reply With Quote #29

Feature request: Have a menu with a range of head size that pops up if user doesn't specify head size/client name, like the resizeme plugin.
Mr. Man is offline
ragnarox13
Junior Member
Join Date: Sep 2012
Old 11-03-2012 , 05:42   Re: [TF2] Resize Heads! (1.1) [10/28/2012]
Reply With Quote #30

Quote:
Originally Posted by ReFlexPoison View Post
Use - admin - overrides!
Sry may i know how to do that? by the way i tried to use the command but there doesnt seems to be any effect (the plugin is enabled and no error message appears)
ragnarox13 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 10:17.


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