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

[ REQUEST ] Edit plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
endlessx
Junior Member
Join Date: Sep 2023
Old 01-17-2024 , 11:58   [ REQUEST ] Edit plugin
Reply With Quote #1

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

public plugin_precache( )
{
    
precache_model"models/devil.mdl" );
}

public 
plugin_init( )
{
    new const 
VERSION[ ] = "1.3";
    
    
register_plugin"Santa Hat"VERSION"xPaw" );
    
    
set_pcvar_stringregister_cvar"santa_hat"VERSIONFCVAR_SERVER ), VERSION );
    
    if( !
get_pcvar_numregister_cvar"amx_santahat""1" ) ) )
    {
        return;
    }
    

}
public 
Hat(id)
{
    if (
is_user_alive(id) && is_user_steam(id))
    {
        new 
iEntity engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"));

        if (
pev_valid(iEntity))
        {
            
engfunc(EngFunc_SetModeliEntity"models/devil.mdl");
            
set_pev(iEntitypev_movetypeMOVETYPE_FOLLOW);
            
set_pev(iEntitypev_aimentid);
            
set_pev(iEntitypev_ownerid);
        }
    }
}
public 
client_putinserver(id)
{
    
Hat(id);
}
stock bool:is_user_steam(id
{
        new 
auth[65]
        
get_user_authid(id,auth,64)
        if(
contain(auth"STEAM_0:0:") != -|| contain(auth"STEAM_0:1:") != -1)
        return 
true;
        return 
false;

I want to add hat only for steamid . can you help me?
This plugin will add some devil things (horns and tail ) to one player , but this script is for all players , i want only for which steamid i add

Last edited by endlessx; 01-19-2024 at 08:18.
endlessx is offline
endlessx
Junior Member
Join Date: Sep 2023
Old 01-19-2024 , 06:42   Re: [ REQUEST ] Edit plugin
Reply With Quote #2

can someone help me?
endlessx is offline
mlibre
Veteran Member
Join Date: Nov 2015
Location: return PLUGIN_CONTINUE
Old 01-19-2024 , 07:33   Re: [ REQUEST ] Edit plugin
Reply With Quote #3

use tag [php]code here...[/php] highlights the sma
__________________
mlibre is offline
endlessx
Junior Member
Join Date: Sep 2023
Old 01-19-2024 , 08:18   Re: [ REQUEST ] Edit plugin
Reply With Quote #4

done
endlessx is offline
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: Jupiter
Old 01-19-2024 , 09:10   Re: [ REQUEST ] Edit plugin
Reply With Quote #5

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

new a[][] = 
{
    
"STEAM_0:0:820752243",
    
"...",
    
"..."
}

public 
plugin_precache( )
{
    
precache_model"models/devil.mdl" );
}

public 
plugin_init( )
{
    new const 
VERSION[ ] = "1.3";
    
    
register_plugin"Santa Hat"VERSION"xPaw" );
    
    
set_pcvar_stringregister_cvar"santa_hat"VERSIONFCVAR_SERVER ), VERSION );
    
    if( !
get_pcvar_numregister_cvar"amx_santahat""1" ) ) )
    {
        return;
    }
    

}
public 
Hat(id)
{
    if (
is_user_alive(id) && is_user_steam(id))
    {
        new 
iEntity engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"));

        if (
pev_valid(iEntity))
        {
            
engfunc(EngFunc_SetModeliEntity"models/devil.mdl");
            
set_pev(iEntitypev_movetypeMOVETYPE_FOLLOW);
            
set_pev(iEntitypev_aimentid);
            
set_pev(iEntitypev_ownerid);
        }
    }
}
public 
client_putinserver(id)
{
    
Hat(id);
}
stock bool:is_user_steam(id
{
        new 
auth[65]
        
get_user_authid(id,auth,64)
        for (new 
0sizeof(a); i++)
        {
            if (
equal(a[i], auth))
                return 
true
        
}
        return 
false;

__________________
bigdaddy424 is offline
endlessx
Junior Member
Join Date: Sep 2023
Old 01-19-2024 , 14:11   Re: [ REQUEST ] Edit plugin
Reply With Quote #6

doesen't work ...

Or you can make on this ?

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

new gHatBit 
#define AddToBit(%0)        ( gHatBit |= (1<<%0) )  
#define RemoveFromBit(%0)    ( gHatBit &= ~(1<<%0) )  
#define IsInBit(%0)        ( gHatBit & (1<<%0) ) 

#define CreateEntity    (engfunc( EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target") ) ); 

new g_pEnabled 
#define ENABLED        (get_pcvar_num(g_pEnabled) ) 

new const CT_MODEL[] = "models/adminhead_ct.mdl"
new const 
T_MODEL[] = "models/adminhead_t.mdl"


public plugin_precache( ) 

    
precache_modelCT_MODEL ); 
    
precache_modelT_MODEL ); 


public 
plugin_init( ) 

    new const 
VERSION[ ] = "1.0"
    
    
register_plugin"Yanderewolf12_admin_head"VERSION"Yanderewolf12" ); 
    
    
set_pcvar_stringregister_cvar"admin_head"VERSIONFCVAR_SERVER ), VERSION ); 
    
    
register_clcmd("say /coarne""ToggleHat"
    
register_event("DeathMsg""eDeath""a")
    
    
g_pEnabled register_cvar("hats_enabled""1"


public 
eDeath()
{
    new 
iVictim read_data(2)
    
    if(
IsInBit(iVictim))
    {
        
RemoveFromBit(iVictim)
        static 
szClassName[32]
        
formatex(szClassNamecharsmax(szClassName), "admin_head_%d"iVictim)

        
remove_entity(szClassName)
    }
}
    

public 
ToggleHat(id

    if(!
ENABLED
        return 
client_print(idprint_chat"Coarnele nu sunt activate!.."
    
    new 
iEnt 
    
new szClassName[32]; formatex(szClassNamecharsmax(szClassName), "admin_head_%d"id
    if(!
IsInBit(id)) 
    { 
        
AddToBit(id
        
        
iEnt CreateEntity 
        
        
if(!pev_valid(iEnt)) 
        { 
            return 
client_print(idprint_chat"Couldn't create entity"
        } 
        if(
get_user_flags(id) & ADMIN_RESERVATION)
    {
        
set_pev(iEntpev_classnameszClassName

        
engfuncEngFunc_SetModeliEntget_user_team(id) == T_MODEL CT_MODEL); 
        
set_peviEntpev_movetypeMOVETYPE_FOLLOW ); 
        
set_peviEntpev_aimentid ); 
        
set_peviEntpev_ownerid ); 
        
        
client_print(idprint_chat"YAY! ti ai primit coarnele! .."
        return 
PLUGIN_HANDLED 
    
}
    else 
    {
    
client_print(idprint_chat"Nu ai acces pentru a ti pune coarne!"
    }
    } 
    
    
RemoveFromBit(id
    
    
remove_entity(szClassName)
    
    
client_print(idprint_chat"Ti ai dat jos coarnele!"
    return 
PLUGIN_HANDLED 
}  

remove_entity(szClassName[])
{
    new 
iEnt = -
    iEnt 
engfunc(EngFunc_FindEntityByStringiEnt"classname"szClassName
    
    
engfunc(EngFunc_RemoveEntityiEnt

And this plugin have a problem , after they die the horns disappear and I would like them to remain permanently without putting them on every time the round starts.
endlessx is offline
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: Jupiter
Old 01-19-2024 , 18:08   Re: [ REQUEST ] Edit plugin
Reply With Quote #7

it doesnt work because its unlikely that user's alive on putinserver
__________________
bigdaddy424 is offline
mlibre
Veteran Member
Join Date: Nov 2015
Location: return PLUGIN_CONTINUE
Old 01-20-2024 , 19:05   Re: [ REQUEST ] Edit plugin
Reply With Quote #8

why not check spawn..?
__________________
mlibre is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-21-2024 , 00:02   Re: [ REQUEST ] Edit plugin
Reply With Quote #9

All players on your server should be steam, why do you need a check?

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

new const VERSION[ ] = "1.3";

new 
g_pSantaHat;

public 
plugin_precache( )
{
    
precache_model"models/devil.mdl" );
}

public 
plugin_init( )
{
    
register_plugin"Santa Hat"VERSION"xPaw" );
    
    
RegisterHamHam_Spawn "player" "PlayerSpawn" true );
    
    
set_pcvar_stringregister_cvar"santa_hat"VERSIONFCVAR_SERVER ), VERSION );
    
g_pSantaHat register_cvar"amx_santahat""1" );
}

public 
PlayerSpawnid )
{
    if ( 
is_user_aliveid ) && get_pcvar_numg_pSantaHat ) ) 
    {
        new 
iEntity engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"));
    
        if (
pev_valid(iEntity))
        {
            
engfunc(EngFunc_SetModeliEntity"models/devil.mdl");
            
set_pev(iEntitypev_movetypeMOVETYPE_FOLLOW);
            
set_pev(iEntitypev_aimentid);
            
set_pev(iEntitypev_ownerid);
        }
    }

__________________

Last edited by Bugsy; 01-21-2024 at 00:43.
Bugsy is offline
Uzviseni Bog
Senior Member
Join Date: Jun 2020
Old 01-21-2024 , 15:22   Re: [ REQUEST ] Edit plugin
Reply With Quote #10

This request makes no sense, man what do you even want?
Uzviseni Bog 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:50.


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