Raised This Month: $ Target: $400
 0% 

Edit plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KING Army
Member
Join Date: Mar 2016
Old 07-11-2017 , 10:07   Edit plugin
Reply With Quote #1

i want to use this only 1 time when user i alive -->>
PHP Code:
set_user_health(idget_user_health(id) + 1000)
    
ColorChatidRED"^x04[Thirsty-Devils]^x01 You recieved 1000 HP." )
    
gRoundUsageid ] = false
    
return PLUGIN_CONTINUE 
and when he die and respawn again he can use it again can anyone do this for me :p ?

full code -->>

PHP Code:
/* Plugin generated by AMXX-Studio */

#include < amxmodx >
#include < amxmisc >
#include < cstrike >
#include < colorchat >
#include < fakemeta >
#include < fakemeta_util >
#include < fun >

#define VIP_ACCESS ADMIN_KICK

new const PLUGIN[ ] = "Vip menu"
new const VERSION[ ] = "1.1"
new const AUTHOR[ ] = "alliedmodders"

new bool:gRoundUsage33 ] = false
new bool:gGlowing33 ] = false

public plugin_init( ) 
{
    
register_plugin        PLUGINVERSIONAUTHOR )
    
register_logevent    "logevent_round_start"2"1=Round_Start" )  
    
register_clcmd        "say /vmenu""VipMenu" )
    
// Add your code here...
}

public 
client_authorizedid )
{
    
gRoundUsageid ] = false
    gGlowing
id ] = false
}
    
public 
logevent_round_start( )
{
    new 
Players32 ], PlayersNumid
    get_players
PlayersPlayersNum"ch" )
    for( new 
iPlayersNumi++ )
    {
        
id Players]
        
gRoundUsageid ] = false
        
if( gGlowingid ] )
        {
            if( 
cs_get_user_teamid ) == CS_TEAM_T )
                
set_user_rendering(id,kRenderFxGlowShell,255,0,0,kRenderNormal,25)//red
            
if( cs_get_user_teamid ) == CS_TEAM_CT )
                
set_user_renderingidkRenderFxGlowShell00255kRenderNormal25 )//blue
        
}
            
    }
}

public 
VipMenuid )
{
    if( ~
get_user_flagsid ) & VIP_ACCESS )
        return 
PLUGIN_HANDLED
        
    
new menu
    
    
if( cs_get_user_teamid ) == CS_TEAM_CT )
        
menu menu_create"\wVIP Menu --> \rHumans ""menu_handler" )
    if( 
cs_get_user_teamid ) == CS_TEAM_T )
        
menu menu_create"\wVIP Menu --> \rZombies ""menu_handler" )
    
    if( 
cs_get_user_teamid ) == CS_TEAM_CT )
        
menu_additemmenu"\r255 HP / ARMOR """)
        
    if( 
cs_get_user_teamid ) == CS_TEAM_T )
        
menu_additemmenu"\r1000 HP """)
        
    
menu_additemmenu"\rSwitch team """)
    
menu_additemmenu"\rRevive """)
    
menu_additemmenu"\rGlow """0)
    
menu_displayidmenu)
    return 
PLUGIN_CONTINUE
}

public 
menu_handleridmenuitem )
{
    switch( 
item )
    {
        case 
0
        {
            if( 
cs_get_user_teamid ) == CS_TEAM_CT )
            {
                if( !
is_user_aliveid ) )
                {
                    
ColorChatidRED"^x04[Thirsty-Devils]^x01 You're dead." 
                    return 
PLUGIN_HANDLED
                
}
                
set_user_healthid255 )
                
set_user_armorid255 )
                
ColorChatidRED"^x04[Thirsty-Devils]^x01 You recieved 255 HP / ARMOR." )
                
gRoundUsageid ] = true
                
return PLUGIN_CONTINUE
            
}
            if( 
cs_get_user_teamid ) == CS_TEAM_T )
            {
                if( !
is_user_aliveid ) )
                {
                    
ColorChatidRED"^x04[Thirsty-Devils]^x01 You're dead." 
                    return 
PLUGIN_HANDLED
                
}
                
set_user_health(idget_user_health(id) + 1000)
                
ColorChatidRED"^x04[Thirsty-Devils]^x01 You recieved 1000 HP." )
                
gRoundUsageid ] = false
                
return PLUGIN_CONTINUE
            
}
        }
        case 
1:
        {
            if( 
cs_get_user_teamid ) == CS_TEAM_CT )
            {
                
cs_set_user_teamidCS_TEAM_T )
                
ColorChatidRED"^x04[Thirsty-Devils]^x01 Team switched." )
                
set_user_rendering(id,kRenderFxGlowShell,255,0,0,kRenderNormal,25)//red
                
gRoundUsageid ] = true
                Revive
id100100 )
                return 
PLUGIN_CONTINUE
            
}
            if( 
cs_get_user_teamid ) == CS_TEAM_T )
            {
                
cs_set_user_teamidCS_TEAM_CT )
                
ColorChatidRED"^x04[Thirsty-Devils]^x01 Team switched." )
                
set_user_renderingidkRenderFxGlowShell00255kRenderNormal25 )//blue
                
gRoundUsageid ] = true
                Revive
id100100 )
                return 
PLUGIN_CONTINUE
            
}
        }
        case 
2:
        {
            if( 
cs_get_user_teamid ) == CS_TEAM_CT || cs_get_user_teamid ) == CS_TEAM_T )
            {
                if( !
is_user_aliveid ) )
                {
                    
ColorChatidRED"^x04[Thirsty-Devils]^x01 You've been revived!" )
                    
gRoundUsageid ] = true
                    Revive
id100100 )
                    return 
PLUGIN_CONTINUE
                
} else {
                    
ColorChatidRED"^x04[Thirsty-Devils]^x01 You're already alive!" )
                    return 
PLUGIN_CONTINUE
                
}
            } else {
                
ColorChatidRED"^x04[Thirsty-Devils]^x01 You're a spectator." )
                return 
PLUGIN_CONTINUE
            
}
        }
        case 
3:
        {
            if( 
cs_get_user_teamid ) == CS_TEAM_T )
                
set_user_rendering(id,kRenderFxGlowShell,255,0,0,kRenderNormal,25)//red
            
if( cs_get_user_teamid ) == CS_TEAM_CT )
                
set_user_renderingidkRenderFxGlowShell00255kRenderNormal25 )//blue
            
ColorChatidRED"^x04[Thirsty-Devils]^x01 You're glowing!" )
            
gRoundUsageid ] = true
            gGlowing
id ] = true
            
return PLUGIN_HANDLED
        
}
    }
    return 
PLUGIN_HANDLED
}

// this is from ut revive
Reviveindexhparmor )
{
    
set_pevindexpev_deadflagDEAD_RESPAWNABLE )
    
set_pevindexpev_iuser1)
    
dllfuncDLLFunc_Thinkindex )
    
engfuncEngFunc_SetOriginindexFloat:{-4800.0,-4800.0,-4800.0} )
    new array[ 
]
    array[ 
] = index
    
array[ ] = hp
    
array[ ] = armor
    set_task
0.5"respawn"0, array, )
}

public 
respawn( array[ ] )
{
    new 
index = array[ ]
    new 
hp = array[ ]
    new 
armor = array[ ]
    
    if( 
is_user_connectedindex ) )
    {
        
dllfuncDLLFunc_Spawn,index )
        
set_pevindex,pev_healthfloathp ) )
        
set_pevindex,pev_armorvaluefloatarmor ) ) 
        switch( 
get_user_teamindex ) )
        {
            case 
1:
            {
                
fm_give_itemsindex"weapon_knife" )
            } case 
2: {
                
fm_give_itemindex"weapon_knife" )
            }
        }
    }
}

stock fm_give_itemsid, const item[ ] )
{
    static 
ent
    ent 
engfuncEngFunc_CreateNamedEntityengfuncEngFunc_AllocStringitem ) )
    if( !
pev_valident ) ) return
   
    static 
Float:originF]
    
pevidpev_originoriginF )
    
set_peventpev_originoriginF )
    
set_peventpev_spawnflagspeventpev_spawnflags ) | SF_NORESPAWN )
    
dllfuncDLLFunc_Spawnent )
   
    static 
save
    save 
peventpev_solid )
    
dllfuncDLLFunc_Touchentid )
    if( 
pevent,pev_solid ) != save )
        return
      
    
engfuncEngFunc_RemoveEntityent )

__________________

Last edited by KING Army; 07-11-2017 at 10:08.
KING Army is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 07-11-2017 , 13:55   Re: Edit plugin
Reply With Quote #2

try: i add to all case buy item in one round if you want to display some so remove
Code:
PlayerUsed[ id ] = true;
this line from case
Code:
/* Plugin generated by AMXX-Studio */

#include < amxmodx >
#include < cstrike >
#include < colorchat >
#include < hamsandwich >
#include < fakemeta_util >
#include < fun >

#define VIP_ACCESS ADMIN_KICK

new const PLUGIN[ ] = "Vip menu"
new const VERSION[ ] = "1.1"
new const AUTHOR[ ] = "alliedmodders"

new bool:gRoundUsage[ 33 ] = false
new bool:gGlowing[ 33 ] = false

new PlayerUsed[ 33 ]

public plugin_init( ) 
{
	register_plugin        ( PLUGIN, VERSION, AUTHOR )
	register_logevent    ( "logevent_round_start", 2, "1=Round_Start" )
	RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn_Post", 1)
	register_clcmd        ( "say /vmenu", "VipMenu" )
	// Add your code here...
}

public client_putinserver( id )
{
	gRoundUsage[ id ] = false
	gGlowing[ id ] = false
	PlayerUsed[ id ] = false
}

public fw_PlayerSpawn_Post(id)
{
	PlayerUsed[ id ] = false;
}

public logevent_round_start( )
{
	new Players[ 32 ], PlayersNum, id
	get_players( Players, PlayersNum, "ch" )
	for( new i; i < PlayersNum; i++ )
	{
		id = Players[ i ]
		gRoundUsage[ id ] = false
		PlayerUsed[ id ] = false
		if( gGlowing[ id ] )
		{
			if( cs_get_user_team( id ) == CS_TEAM_T )
				set_user_rendering(id,kRenderFxGlowShell,255,0,0,kRenderNormal,25)//red
			if( cs_get_user_team( id ) == CS_TEAM_CT )
				set_user_rendering( id, kRenderFxGlowShell, 0, 0, 255, kRenderNormal, 25 )//blue
		}
		
	}
}

public VipMenu( id )
{
	if( ~get_user_flags( id ) & VIP_ACCESS )
		return PLUGIN_HANDLED
	
	new menu
	
	if( cs_get_user_team( id ) == CS_TEAM_CT )
		menu = menu_create( "\wVIP Menu --> \rHumans ", "menu_handler" )
	if( cs_get_user_team( id ) == CS_TEAM_T )
		menu = menu_create( "\wVIP Menu --> \rZombies ", "menu_handler" )
	
	if( cs_get_user_team( id ) == CS_TEAM_CT )
		menu_additem( menu, "\r255 HP / ARMOR ", "", 0 )
	
	if( cs_get_user_team( id ) == CS_TEAM_T )
		menu_additem( menu, "\r1000 HP ", "", 0 )
	
	menu_additem( menu, "\rSwitch team ", "", 0 )
	menu_additem( menu, "\rRevive ", "", 0 )
	menu_additem( menu, "\rGlow ", "", 0)
	menu_display( id, menu, 0 )
	return PLUGIN_CONTINUE
}

public menu_handler( id, menu, item )
{
	switch( item )
	{
		case 0: 
		{
			if(PlayerUsed[id] == 1)
			{
				ColorChat( id, RED, "^x04[Thirsty-Devils]^x01 You can only buy that item once in round.")
				
				return PLUGIN_HANDLED
			}
			
			if( cs_get_user_team( id ) == CS_TEAM_CT )
			{
				if( !is_user_alive( id ) )
				{
					ColorChat( id, RED, "^x04[Thirsty-Devils]^x01 You're dead." ) 
					return PLUGIN_HANDLED
				}
				set_user_health( id, 255 )
				set_user_armor( id, 255 )
				ColorChat( id, RED, "^x04[Thirsty-Devils]^x01 You recieved 255 HP / ARMOR." )
				gRoundUsage[ id ] = true
				PlayerUsed[ id ] = true;
				return PLUGIN_CONTINUE
			}
			if( cs_get_user_team( id ) == CS_TEAM_T )
			{
				if( !is_user_alive( id ) )
				{
					ColorChat( id, RED, "^x04[Thirsty-Devils]^x01 You're dead." ) 
					return PLUGIN_HANDLED
				}
				set_user_health(id, get_user_health(id) + 1000)
				ColorChat( id, RED, "^x04[Thirsty-Devils]^x01 You recieved 1000 HP." )
				gRoundUsage[ id ] = false
				PlayerUsed[id] = true;
				return PLUGIN_CONTINUE
			}
		}
		case 1:
		{
			if(PlayerUsed[id] == 1)
			{
				ColorChat( id, RED, "^x04[Thirsty-Devils]^x01 You can only buy that item once in round.")
				
				return PLUGIN_HANDLED
			}
			
			if( cs_get_user_team( id ) == CS_TEAM_CT )
			{
				cs_set_user_team( id, CS_TEAM_T )
				ColorChat( id, RED, "^x04[Thirsty-Devils]^x01 Team switched." )
				set_user_rendering(id,kRenderFxGlowShell,255,0,0,kRenderNormal,25)//red
				gRoundUsage[ id ] = true
				PlayerUsed[ id ] = true
				Revive( id, 100, 100 )
				return PLUGIN_CONTINUE
			}
			if( cs_get_user_team( id ) == CS_TEAM_T )
			{
				cs_set_user_team( id, CS_TEAM_CT )
				ColorChat( id, RED, "^x04[Thirsty-Devils]^x01 Team switched." )
				set_user_rendering( id, kRenderFxGlowShell, 0, 0, 255, kRenderNormal, 25 )//blue
				gRoundUsage[ id ] = true
				PlayerUsed[ id ] = true;
				Revive( id, 100, 100 )
				return PLUGIN_CONTINUE
			}
		}
		case 2:
		{
			if(PlayerUsed[id] == 1)
			{
				ColorChat( id, RED, "^x04[Thirsty-Devils]^x01 You can only buy that item once in round.")
				
				return PLUGIN_HANDLED
			}
			
			if( cs_get_user_team( id ) == CS_TEAM_CT || cs_get_user_team( id ) == CS_TEAM_T )
			{
				if( !is_user_alive( id ) )
				{
					ColorChat( id, RED, "^x04[Thirsty-Devils]^x01 You've been revived!" )
					gRoundUsage[ id ] = true
					PlayerUsed[ id ] = true;
					Revive( id, 100, 100 )
					return PLUGIN_CONTINUE
					} else {
					ColorChat( id, RED, "^x04[Thirsty-Devils]^x01 You're already alive!" )
					return PLUGIN_CONTINUE
				}
				} else {
				ColorChat( id, RED, "^x04[Thirsty-Devils]^x01 You're a spectator." )
				return PLUGIN_CONTINUE
			}
		}
		case 3:
		{
			if(PlayerUsed[id] == 1)
			{
				ColorChat( id, RED, "^x04[Thirsty-Devils]^x01 You can only buy that item once in round.")
				
				return PLUGIN_HANDLED
			}
			
			if( cs_get_user_team( id ) == CS_TEAM_T )
				set_user_rendering(id,kRenderFxGlowShell,255,0,0,kRenderNormal,25)//red
			if( cs_get_user_team( id ) == CS_TEAM_CT )
				set_user_rendering( id, kRenderFxGlowShell, 0, 0, 255, kRenderNormal, 25 )//blue
			ColorChat( id, RED, "^x04[Thirsty-Devils]^x01 You're glowing!" )
			gRoundUsage[ id ] = true
			PlayerUsed[ id ] = true;
			gGlowing[ id ] = true
			return PLUGIN_HANDLED
		}
	}
	
	PlayerUsed[id]++
	return PLUGIN_HANDLED
}

// this is from ut revive
Revive( index, hp, armor )
{
	set_pev( index, pev_deadflag, DEAD_RESPAWNABLE )
	set_pev( index, pev_iuser1, 0 )
	dllfunc( DLLFunc_Think, index )
	engfunc( EngFunc_SetOrigin, index, Float:{-4800.0,-4800.0,-4800.0} )
	new array[ 3 ]
	array[ 0 ] = index
	array[ 1 ] = hp
	array[ 2 ] = armor
	set_task( 0.5, "respawn", 0, array, 3 )
}

public respawn( array[ 3 ] )
{
	new index = array[ 0 ]
	new hp = array[ 1 ]
	new armor = array[ 2 ]

	if( is_user_connected( index ) )
	{
		dllfunc( DLLFunc_Spawn,index )
		set_pev( index,pev_health, float( hp ) )
		set_pev( index,pev_armorvalue, float( armor ) ) 
		switch( get_user_team( index ) )
		{
			case 1: fm_give_items( index, "weapon_knife" ) // items?
			case 2: fm_give_item( index, "weapon_knife" ) // item?
		}
	}
}

stock fm_give_items( id, const item[ ] )
{
	static ent
	ent = engfunc( EngFunc_CreateNamedEntity, engfunc( EngFunc_AllocString, item ) )
	if( !pev_valid( ent ) ) return

	static Float:originF[ 3 ]
	pev( id, pev_origin, originF )
	set_pev( ent, pev_origin, originF )
	set_pev( ent, pev_spawnflags, pev( ent, pev_spawnflags ) | SF_NORESPAWN )
	dllfunc( DLLFunc_Spawn, ent )

	static save
	save = pev( ent, pev_solid )
	dllfunc( DLLFunc_Touch, ent, id )
	if( pev( ent,pev_solid ) != save )
		return
	
	engfunc( EngFunc_RemoveEntity, ent )
}

Last edited by Fuck For Fun; 07-11-2017 at 13:57.
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
KING Army
Member
Join Date: Mar 2016
Old 07-11-2017 , 17:50   Re: Edit plugin
Reply With Quote #3

its working thanks
__________________
KING Army is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 07-12-2017 , 04:14   Re: Edit plugin
Reply With Quote #4

Quote:
Originally Posted by KING Army View Post
its working thanks
^^
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
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 16:15.


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