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

[CSS] Christmas Hat


Post New Thread Reply   
 
Thread Tools Display Modes
Fragkiller
Member
Join Date: Jun 2012
Old 12-11-2015 , 12:08   Re: [CSS] Christmas Hat
Reply With Quote #41

Tried it first with installing it how its supposed to be.

Didnt worked at all but it has been loaded, downloads the models, metarials too.

But theres no hat at spawn either with the first gamedata or the 2nd one from peace-maker.
Fragkiller is offline
Franc1sco
Veteran Member
Join Date: Oct 2010
Location: Spain (Madrid)
Old 12-11-2015 , 12:26   Re: [CSS] Christmas Hat
Reply With Quote #42

https://forums.alliedmods.net/showpo...71&postcount=3
__________________
Veteran SourceMod Coder -> Activity channel
Taking paid and free jobs.
Contact: Steam, Telegram or discord ( Franc1sco#7876 ).

You like my work? +Rep in my steam profile comments or donate.

Franc1sco is offline
Send a message via MSN to Franc1sco
Fragkiller
Member
Join Date: Jun 2012
Old 12-11-2015 , 15:56   Re: [CSS] Christmas Hat
Reply With Quote #43

Quote:
Originally Posted by Franc1sco View Post
it would work for CS:S?
Fragkiller is offline
painkiller
Senior Member
Join Date: Jun 2011
Old 12-12-2016 , 06:42   Re: [CSS] Christmas Hat
Reply With Quote #44

Hello,
Could someone make a gamedate signatur for bms?

Thanks in advance
painkiller is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 12-12-2016 , 07:27   Re: [CSS] Christmas Hat
Reply With Quote #45

Quote:
Originally Posted by painkiller View Post
Hello,
Could someone make a gamedate signatur for bms?

Thanks in advance
This doesn't need the gamedata really, if you know the attachment point for the player model you're setting it on. In cs:s 90% of the default models have the forward attachment, that's why it needs to be checked. Just a guess but I bet the attachment point in BM:S would be 'head'
Mitchell is offline
Hakuna Cfg
New Member
Join Date: Aug 2021
Old 11-11-2021 , 14:00   Re: [CSS] Christmas Hat
Reply With Quote #46

Quote:
Originally Posted by Xilver266 View Post


Put a Christmas hat to players at spawn




SourceMod 1.5.0+

  • sm_christmas_hat_enable - Enable Christmas hats. 0 -No | 1 -Yes


Code:
2013-12-12 (v1.2)

* Removed debug messages (xD)

2013-11-12 (v1.1)

* ToggleEffects.smx is not required now
* Some bugs fixed with remove hats
* Functions updated

2013-09-12 (v1.0)

* Initial release.


Place SMX in the plugins folder and you're done". A cfg file will be generated once the server has started (cfg/sourcemod/christmas_hat.cfg)

Source from Hats!
GitHub Repository

Can this plugin be made compatible with Left 4 dead 2?
Hakuna Cfg is offline
micmacx
Junior Member
Join Date: May 2021
Old 12-12-2021 , 19:56   Re: [CSS] Christmas Hat
Reply With Quote #47

Hi everybody,
sorry for my english but i'm french, thx to google for translation, my english is really rusty. :-)

I try to modifying this plugin for DoD:S without ToggleEffects but this doesn't work. :-)

All the mdl files for the hat will download to the right place and are in the good place to the server and fast_download (sv_downloadurl).
Cvar sm_christmas_hat_enable "1".
There is no error when compiling smx.
There is no error in the DoD: S console while playing the game.
There is no error in the sourcemod logs.
There is no error in the server logs (logs from the dod directory).
The comment sentences that I placed in the script are all launched so everything is going well with the script.
But we don't see the hats.

If you want to test the server : steam://connect/82.65.74.77:27015


This is the .sp for test :
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#undef REQUIRE_PLUGIN
#define VERSION "1.3"

new g_Hat[MAXPLAYERS+1];
new 
Handle:g_hLookupAttachment INVALID_HANDLE;
new 
Handle:CvarEnable;

public 
Plugin:myinfo 
{
    
name "Christmas Hat DoD:S",
    
author "Xilver266 Steam: donchopo modif Micmacx",
    
description "Put a Christmas hat to players at spawn",
    
version VERSION,
    
url "servers-cfg.foroactivo.com"
};

public 
OnPluginStart()
{
    
AutoExecConfig(true"christmas_hat");
    
HookEvent("player_spawn"PlayerSpawn);
    
HookEvent("player_death"PlayerDeath);
    
CreateConVar("sm_christmas_hat_version"VERSION"Christmas Hat"FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD);
    new 
Handle:hGameConf LoadGameConfigFile("hats.gamedata");
    
StartPrepSDKCall(SDKCall_Entity);
    
PrepSDKCall_SetFromConf(hGameConfSDKConf_Signature"LookupAttachment");
    
PrepSDKCall_SetReturnInfo(SDKType_PlainOldDataSDKPass_Plain);
    
PrepSDKCall_AddParameter(SDKType_StringSDKPass_Pointer);
    
g_hLookupAttachment EndPrepSDKCall();
    
CvarEnable CreateConVar("sm_christmas_hat_enable""1""Enable Christmas hats. 0 -No | 1 -Yes"_true0.0true1.0);
}

public 
OnMapStart()
{
    
AddFileToDownloadsTable("materials/models/santahat/furballs.vmt");
    
AddFileToDownloadsTable("materials/models/santahat/santahat.vmt");
    
AddFileToDownloadsTable("materials/models/santahat/santahat.vtf");
    
AddFileToDownloadsTable("models/santahat/santahat.mdl");
    
AddFileToDownloadsTable("models/santahat/santahat.phy");
    
AddFileToDownloadsTable("models/santahat/santahat.vvd");
    
AddFileToDownloadsTable("models/santahat/santahat.sw.vtx");
    
AddFileToDownloadsTable("models/santahat/santahat.dx80.vtx");
    
AddFileToDownloadsTable("models/santahat/santahat.dx90.vtx");
    
PrecacheModel("models/santahat/santahat.mdl");
}

public 
Action:PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    if(!
IsClientInGame(client) || !IsPlayerAlive(client))
        return 
Plugin_Continue;
    
    
RemoveHat(client);
    
PrintToChatAll("Lancement PlayerSpawn");
    
CreateTimer(0.0TimerCreateHatsclient);
    
    return 
Plugin_Continue;
}

public 
Action:TimerCreateHats(Handle:timerany:client)
{
    
PrintToChatAll("Lancement TimerCreateHats");
    if (
GetConVarBool(CvarEnable))
        
CreateHat(client);
    return 
Plugin_Stop;
}

CreateHat(client)
{    
    
PrintToChatAll("Lancement CreateHat donc CvarEnable ok")
    if(!
LookupAttachment(client"forward"))
        return;
        
    if(
GetClientTeam(client) == 1)
        return;

    new 
Float:or[3];
    new 
Float:ang[3];
    new 
Float:fForward[3];
    new 
Float:fRight[3];
    new 
Float:fUp[3];
    
GetClientAbsOrigin(client,or);
    
GetClientAbsAngles(client,ang);
    
    
ang[0] += 0.0;
    
ang[1] += 0.0;
    
ang[2] += 0.0;

    new 
Float:fOffset[3];
    
fOffset[0] = 0.0;
    
fOffset[1] = -1.0;
    
fOffset[2] = 6.0;

    
GetAngleVectors(angfForwardfRightfUp);

    or[
0] += fRight[0]*fOffset[0]+fForward[0]*fOffset[1]+fUp[0]*fOffset[2];
    or[
1] += fRight[1]*fOffset[0]+fForward[1]*fOffset[1]+fUp[1]*fOffset[2];
    or[
2] += fRight[2]*fOffset[0]+fForward[2]*fOffset[1]+fUp[2]*fOffset[2];
    
    new 
ent CreateEntityByName("prop_dynamic_override");
    
DispatchKeyValue(ent"model""models/santahat/santahat.mdl");
    
DispatchKeyValue(ent"spawnflags""4");
    
SetEntProp(entProp_Data"m_CollisionGroup"2);
    
SetEntPropEnt(entProp_Send"m_hOwnerEntity"client);
    
    
DispatchSpawn(ent);    
    
AcceptEntityInput(ent"TurnOn"entent0);
    
    
g_Hat[client] = ent;
    
    
SDKHook(entSDKHook_SetTransmitShouldHide);

    
TeleportEntity(ent, or, angNULL_VECTOR); 
    
    
SetVariantString("!activator");
    
AcceptEntityInput(ent"SetParent"clientent0);
    
    
SetVariantString("forward");
    
AcceptEntityInput(ent"SetParentAttachmentMaintainOffset"entent0);
}

public 
Action:PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    
RemoveHat(client);
}

public 
OnClientDisconnect(client)
{
    
RemoveHat(client);
}

public 
Action:ShouldHide(entclient)
{
    if(
ent == g_Hat[client])
        return 
Plugin_Handled;
            
    if(
IsClientInGame(client))
        if(
GetEntProp(clientProp_Send"m_iObserverMode") == && GetEntPropEnt(clientProp_Send"m_hObserverTarget")>=0)
            if(
ent == g_Hat[GetEntPropEnt(clientProp_Send"m_hObserverTarget")])
                return 
Plugin_Handled;
    
    return 
Plugin_Continue;
}

stock LookupAttachment(clientString:point[])
{
    if(
g_hLookupAttachment==INVALID_HANDLE) return 0;
    if( 
client<=|| !IsClientInGame(client) ) return 0;
    return 
SDKCall(g_hLookupAttachmentclientpoint);
}

public 
RemoveHat(client)
{
    
PrintToChatAll("Lancement RemoveHat");
    if (
g_Hat[client] != && IsValidEdict(g_Hat[client]))
    {
        
AcceptEntityInput(g_Hat[client], "Kill");
        
SDKUnhook(g_Hat[client], SDKHook_SetTransmitShouldHide);
        
g_Hat[client] = 0;
    }

And i modifying : hats.gamedata.txt
I tested with "#default" like the original script, I also tested with "dod" but that doesn't change anything.


PHP Code:
"Games"
{
    
"#default"
    
{
        
"Signatures"
        
{
            
"LookupAttachment"
            
{
                
"library"    "server"
                "linux"        "@_ZN14CBaseAnimating16LookupAttachmentEPKc"
                "windows"        "\x56\x8B\xF1\x80\xBE\x2A\x2A\x2A\x2A\x00\x75\x2A\x83\xBE\x2A\x2A\x2A\x2A\x00\x75\x2A\xE8\x2A\x2A\x2A\x2A\x85\xC0\x74\x2A\x8B\xCE\xE8\x2A\x2A\x2A\x2A\x8B\xB6\x2A\x2A\x2A\x2A\x85\xF6\x74\x2A\x83\x3E\x00\x75\x2A\x33\xC0\x5E\xC2\x04\x00\x8B\x44\x24\x08\x50\x56\xE8\x2A\x2A\x2A\x2A\x83\xC4\x08\x83\xC0\x01\x5E\xC2\x04\x00"
            
}
        }
    }

If anyone can help me that would be super nice.

Thank you in advance and see you soon.


Edit : My bad. I had not read all the posts and I see that this code is not working correctly. I'll try to take this code and modify it: https://forums.alliedmods.net/showpo...71&postcount=3

Besides, why is this plugin that doesn't work still in the plugins? Plugin Search

+++. :-) :-) :-)

Last edited by micmacx; 12-12-2021 at 21:27. Reason: My bad.
micmacx is offline
Reply


Thread Tools
Display Modes

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:37.


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