AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   question and help code (https://forums.alliedmods.net/showthread.php?t=110109)

spirit 11-25-2009 09:31

question and help code
 
hi all i would like create a plugin who regenerate the terrorist after 5seconds not hurt but i have errors in my code can you help me for correct please

PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <cstrike>
#include <fun>

#define PLUGIN "alien Regeneration"
#define VERSION "1.0"
#define AUTHOR "fry!"

new g_regen_timeg_regen_amountg_class_regen
const alien_maxhealth 500

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
g_regen_time register_cvar("zp_regen_time""5.0")
    
g_regen_amount register_cvar("zp_regen_amount""5.0")
    
register_event("Damage""SetRegeneration""be""2>0")
}

public 
zp_user_infected_post(player)
{
    if ((
cs_get_user_team(player) == CS_TEAM_T) == g_class_regen)
    {    
        
Regenerate(player)
    }
}

public 
SetRegeneration(player)
{
    if (!
is_user_alive(player) || (cs_get_user_team(player) == CS_TEAM_T))
        return 
PLUGIN_CONTINUE
    
    
if ((cs_get_user_team(player) == CS_TEAM_T) != g_class_regen)
        return 
PLUGIN_CONTINUE
        
    
if (get_user_health(player) < alien_maxhealth(player))
        
set_task(get_pcvar_float(g_regen_time), "Regenerate"player__"b")
    
    return 
PLUGIN_CONTINUE
}

public 
Regenerate(player)
{
    if (!
is_user_alive(player) || (cs_get_user_team(player) == CS_TEAM_T))
        return 
PLUGIN_CONTINUE
    
    
    
new regen_health get_user_health(player)
    new 
max_health alien_maxhealth(player) - regen_health
    
    
if (max_health <= get_pcvar_num(g_regen_amount))
    {
        
set_pev(playerpev_healthregen_health float(max_health))
    }
    
    if (
max_health <= get_pcvar_num(g_regen_amount) <= alien_maxhealth)
    {
        
remove_task(player)
    }

    
set_pev(playerpev_healthregen_health get_pcvar_float(g_regen_amount))
    
    return 
PLUGIN_CONTINUE


Code:

alienregeneration.sma(23) : warning 213: tag mismatch
alienregeneration.sma(34) : warning 213: tag mismatch
alienregeneration.sma(37) : error 012: invalid function call, not a valid address
alienregeneration.sma(37) : warning 215: expression has no effect
alienregeneration.sma(37) : error 001: expected token: ";", but found ")"
alienregeneration.sma(37) : error 029: invalid expression, assumed zero
alienregeneration.sma(37) : fatal error 107: too many error messages on one line

and i have an question i would like the terrorist have longjump this plugin is it correct ?

PHP Code:

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

new bool:g_hasLongJump[33]

#define AUTHOR "test"
#define VERSION "1.0"
#define PLUGIN "am_longjump"

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
RegisterHam(Ham_Spawn"id""Player_Spawn"1);
    
register_event("DeathMsg""death""a")
    
register_event("ResetHUD""roundchange" "b")
}

public 
client_connect(id)
{
    
g_hasLongJump[id] = false
    
return PLUGIN_HANDLED
}

public 
client_disconnect(id)
{
    
g_hasLongJump[id] = false
    
return PLUGIN_HANDLED
}

public 
death()
{
    new 
id read_data(2)
    
g_hasLongJump[id] = false
}

public 
Player_Spawn(id)
{
    if(
is_user_alive(id))
    { 
        if(
cs_get_user_team(id) == CS_TEAM_T)
        
give_item(id"item_longjump")
        
g_hasLongJump[id] = true
    
}
        return 
PLUGIN_CONTINUE
}

public 
roundchange(id)
{
    if ( 
g_hasLongJump[id] == false )
    {
    return 
PLUGIN_HANDLED
    
}
    if ( 
g_hasLongJump[id] == true )
        {
        
give_item(id"item_longjump")
    
        return 
PLUGIN_HANDLED
        
}
        return 
PLUGIN_HANDLED



Zombiezzz 11-25-2009 09:35

Re: question and help code
 
#define AUTHOR "fry!"
giggles

for taht code, u have things like_regen_time = register_cvar("zp_regen_time", "5.0")
g_regen_amount = register_cvar("zp_regen_amount", "5.0"
)

which is ZP code for zombie plague.

.-. ._. .o. .x.

Arkshine 11-25-2009 09:41

Re: question and help code
 
Again you. Always trying to manipulate code you don't want to understand and you are back with another shit where after randomly changed some things you cry now. Like always you don't even tried to search yourself...

( I know I'm not nice with this user, but he doesn't want to learn the basics even if we told him severals times ; he's always trying to manipulate code a lot more above his capacity and he doesn't want to search himself :down: )

benjibau 11-25-2009 10:00

Re: question and help code
 
hard plugins

why you don't create a new plugin for the regeneration or ask a new plugin ?


All times are GMT -4. The time now is 13:41.

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