AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [EDIT] +e Regeneration Plugin (Excerpt from the idea) (https://forums.alliedmods.net/showthread.php?t=164078)

Sepsis 08-07-2011 04:05

[EDIT] +e Regeneration Plugin (Excerpt from the idea)
 
Hey guys , Came to my mind an idea :)

This plugin I would like to add a few features, e.g. The ability to grant health , at the start of the game two players will be given randomly and next to the name [+] sign will. But, This the sign [+] Only will see teammate.

PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <cstrike>
#include <fun>
#define MAXPLAYERS 32
#define VERSION "1.0"
new gHPgTimes;
new 
gHealTimes[MAXPLAYERS 1];
public 
plugin_init() 
{
 
register_plugin("+e Regeneration"VERSION"MaNiax");
 
 
register_forward(FM_PlayerPreThink"HookUse");
 
register_event("HLTV""eNewRound""a""1=0""2=0");
 
 
gHP register_cvar("th_heal""25");
 
gTimes register_cvar("th_healtimes""2");
}
public 
eNewRound(id)
{
 new 
iPlayers[MAXPLAYERS], iNumiAll;
 
get_players(iPlayersiNum"a");
 for( new 
0iNumi++ )
 {
  
iAll iPlayers[i];
  
gHealTimes[iAll] = 0;
 }
}
public 
HookUse(id)
{
 if( !
is_user_alive(id) )
  return 
PLUGIN_HANDLED;
 
 new 
nbut pev(idpev_button);
 new 
obut pev(idpev_oldbuttons);
 
 if( (
nbut IN_USE) && !(obut IN_USE) )
 {
  if( 
gHealTimes[id] < get_pcvar_num(gTimes) )
  {
   
set_user_health(idget_user_health(id) + get_pcvar_num(gHP));
   
client_print(idprint_chat"** You refreshed your health! (+%i HP)"get_pcvar_num(gHP));
   
gHealTimes[id]++;
  }
  else
  {
   
client_print(idprint_chat"** You have already healed %i/%i Times!"gHealTimes[id], get_pcvar_num(gTimes));
  }
 }
 
 return 
PLUGIN_CONTINUE;



Erdener 08-07-2011 08:36

Re: [EDIT] +e Regeneration Plugin (Excerpt from the idea)
 
I need it too :(

Sepsis 08-07-2011 08:55

Re: [EDIT] +e Regeneration Plugin (Excerpt from the idea)
 
Quote:

Originally Posted by Erdener (Post 1527533)
I need it too :(

Then , We wait for aid :(

Korxu 08-07-2011 10:42

Re: [EDIT] +e Regeneration Plugin (Excerpt from the idea)
 
Is better use "Ham_ObjectCaps" to hook +use.

Sepsis 08-07-2011 13:32

Re: [EDIT] +e Regeneration Plugin (Excerpt from the idea)
 
This?

PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <cstrike>
#include <fun>
#define MAXPLAYERS 32
#define VERSION "1.0"
new gHPgTimes;
new 
gHealTimes[MAXPLAYERS 1];
public 
plugin_init() 
{
 
register_plugin("+e Regeneration"VERSION"MaNiax");
 
 
register_forward(FM_PlayerPreThink"Ham_ObjectCaps");
 
register_event("HLTV""eNewRound""a""1=0""2=0");
 
 
gHP register_cvar("th_heal""25");
 
gTimes register_cvar("th_healtimes""2");
}
public 
eNewRound(id)
{
 new 
iPlayers[MAXPLAYERS], iNumiAll;
 
get_players(iPlayersiNum"a");
 for( new 
0iNumi++ )
 {
  
iAll iPlayers[i];
  
gHealTimes[iAll] = 0;
 }
}
public 
Ham_ObjectCaps(id)
{
 if( !
is_user_alive(id) )
  return 
PLUGIN_HANDLED;
 
 new 
nbut pev(idpev_button);
 new 
obut pev(idpev_oldbuttons);
 
 if( (
nbut IN_USE) && !(obut IN_USE) )
 {
  if( 
gHealTimes[id] < get_pcvar_num(gTimes) )
  {
   
set_user_health(idget_user_health(id) + get_pcvar_num(gHP));
   
client_print(idprint_chat"** You refreshed your health! (+%i HP)"get_pcvar_num(gHP));
   
gHealTimes[id]++;
  }
  else
  {
   
client_print(idprint_chat"** You have already healed %i/%i Times!"gHealTimes[id], get_pcvar_num(gTimes));
  }
 }
 
 return 
PLUGIN_CONTINUE;



Thnx but,
I would like to.The ability to grant health , This ability at the start of the game 1 or 2 players will be given randomly and next to the name [+] sign will. Yet [+] this the sign will see teammate only

OvidiuS 08-07-2011 13:36

Re: [EDIT] +e Regeneration Plugin (Excerpt from the idea)
 
Code:

register_forward(FM_PlayerPreThink, "Ham_ObjectCaps");
--------------->>>>>>>
Code:

RegisterHam( Ham_ObjectCaps , "player", "Forward_ObjectCaps" )
and then
Code:

public Ham_ObjectCaps(id)
--------------->>>>>>>
Code:

public Forward_ObjectCaps(id)

Sepsis 08-07-2011 13:43

Re: [EDIT] +e Regeneration Plugin (Excerpt from the idea)
 
Quote:

Originally Posted by OvidiuS (Post 1527707)
PHP Code:

register_forward(FM_PlayerPreThink"Ham_ObjectCaps"); 

--------------->>>>>>>
PHP Code:

RegisterHam("Ham_ObjectCaps" "player""Forward_ObjectCaps" 

and then
PHP Code:

public Ham_ObjectCaps(id

--------------->>>>>>>
PHP Code:

public Forward_ObjectCaps(id


Thnx, But :(

Quote:

I would like to.The ability to grant health , This ability at the start of the game 1 or 2 players will be given randomly and next to the name [+] sign will. Yet [+] this the sign will see teammate only

OvidiuS 08-07-2011 13:49

Re: [EDIT] +e Regeneration Plugin (Excerpt from the idea)
 
don't know for the + sign seen only by teammates, someone more expirienced maybe can help you.

PHP Code:

#include <amxmodx>
#include <hamsandwich>
#include <fun>

#define MAXPLAYERS 32
#define VERSION "1.0"

new gHPgTimes;
new 
gHealTimes[MAXPLAYERS 1];

public 
plugin_init() 
{
    
register_plugin("+e Regeneration"VERSION"MaNiax");
 
    
RegisterHamHam_ObjectCaps "player""Forward_ObjectCaps" )
    
register_event("HLTV""eNewRound""a""1=0""2=0");
 
    
gHP register_cvar("th_heal""25");
    
gTimes register_cvar("th_healtimes""2");
}

public 
eNewRound(id)
{
    new 
iPlayers[MAXPLAYERS], iNumiAll;
    
get_players(iPlayersiNum"a");
    for( new 
0iNumi++ )
    {
        
iAll iPlayers[i];
        
gHealTimes[iAll] = 0;
    }
}

public 
Forward_ObjectCaps(id)
{
    if(!
is_user_alive(id))
        return;
 
    if( 
gHealTimes[id] < get_pcvar_num(gTimes) )
    {
        
set_user_health(idget_user_health(id) + get_pcvar_num(gHP));
        
client_print(idprint_chat"** You refreshed your health! (+%i HP)"get_pcvar_num(gHP));
        
gHealTimes[id]++;
    }
    else
        
client_print(idprint_chat"** You have already healed %i/%i Times!"gHealTimes[id], get_pcvar_num(gTimes));



Sepsis 08-07-2011 13:52

Re: [EDIT] +e Regeneration Plugin (Excerpt from the idea)
 
I understood , Ok, Thanx for help :)


All times are GMT -4. The time now is 03:30.

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