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

hats not turning off


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
mr_tnctproo
Junior Member
Join Date: Mar 2014
Location: UK
Old 12-05-2021 , 06:06   hats not turning off
Reply With Quote #1

Hello,
I edited Santa Hat that's made by xPaw

I've added client command /hats to enable and disable the hats.
The problem is that it enables the hats but after typing /hats, it doesn't remove them.

PHP Code:
#include <amxmodx>
#include <engine>
#include <fakemeta> 

new const MODEL[] = "models/kuleczky/dd2/santa_hat.mdl";
new 
szHats[33];
new 
iEntityiMaxPlayersiInfoTarget;

public 
plugin_precache()
{
    
precache_model(MODEL);
}
public 
client_connect(id)
{
    
szHats[id] = 0;
}
public 
plugin_init()
{
    new const 
VERSION[] = "1.3";
    
    
register_plugin("Santa Hat"VERSION"xPaw");
    
register_clcmd("say /hats""ToggleHat");
    
iInfoTarget engfunc(EngFunc_AllocString"info_target");
    
iMaxPlayers get_maxplayers();
}

public 
ToggleHat(id
{
    switch(
szHats[id])
    {
        case 
0:
        {
            
AddHat();
        }
        case 
1:
        {
            
RemoveHat();
        }
    }
    return 
PLUGIN_HANDLED;
}
AddHat()
{    
    for(new 
id 1id <= iMaxPlayersid++)
    {
        
iEntity engfunc(EngFunc_CreateNamedEntity,iInfoTarget);
        if(
pev_valid(iEntity))
        {
            
engfunc(EngFunc_SetModeliEntityMODEL);
            
set_pev(iEntitypev_movetypeMOVETYPE_FOLLOW);
            
set_pev(iEntitypev_aimentid);
            
set_pev(iEntitypev_ownerid);
            
szHats[id] = 1;
            
client_print(idprint_chat"Your hat has been added");
        }
    }
}
RemoveHat()
{
    for(new 
id 1id <= iMaxPlayersid++)
    {
        
iEntity engfunc(EngFunc_FindEntityByStringiEntity"classname"iInfoTarget);
        
engfunc(EngFunc_RemoveEntityiEntity);
        
szHats[id] = 0;
        
client_print(idprint_chat"Your hat has been removed");

    }

mr_tnctproo is offline
 



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 13:11.


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