Raised This Month: $ Target: $400
 0% 

Autorepare Dmg


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 03-05-2009 , 18:39   Autorepare Dmg
Reply With Quote #1

Hi,

im writing a new plug-in & want to add autorepare dmg to races...

example : race 1 has autorepare every sec. +2 HP

race 2 every sec. +5HP & ...

so i need the code & how can i add this to races?

so how i know, i cant have the same code in 1 plugin.
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 03-06-2009 , 09:08   Re: Autorepare Dmg
Reply With Quote #2

Switch classes and check them. Assign a variable to 2.0 for example if the race is 1. The simplistic way is creating a task every 2.0 seconds and adding health to the player.
__________________

anakin_cstrike is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 03-06-2009 , 09:26   Re: Autorepare Dmg
Reply With Quote #3

Quote:
Originally Posted by anakin_cstrike View Post
Switch classes and check them. Assign a variable to 2.0 for example if the race is 1. The simplistic way is creating a task every 2.0 seconds and adding health to the player.
TY,

could u give me 1 example?
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 03-06-2009 , 09:53   Re: Autorepare Dmg
Reply With Quote #4

Something like this
PHP Code:
public funcid )
{
new 
Float:interval;
switch( 
g_classid ] )
{
case 
1interval 2.0;
case 
2interval 4.0;
case 
3interval 5.0;
}

set_taskinterval"addhp"id+123__"b" );
}

public 
addhpindex )
{
index -= 123;
new 
hp get_user_healthindex );
if( 
hp >= 100 )
{
set_user_healthindex100 );
remove_taskindex );
return 
1;
}

set_user_healthindexhp+1);
return 
0;

__________________

anakin_cstrike is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 03-10-2009 , 04:01   Re: Autorepare Dmg
Reply With Quote #5

Ty anakin.so how can i add this to this code?

PHP Code:
public characters_menu(idkeys)
{
    switch(
keys
    {
        case 
0:  
        { 
            
fm_strip_user_weapons(id);
            
fm_give_item(id"weapon_knife");
            
fm_give_item(id"weapon_m4a1");
            
fm_give_item(id"ammo_556nato");
            
fm_give_item(id"ammo_556nato");
            
fm_give_item(id"ammo_556nato");
            
fm_give_item(id"weapon_hegrenade");
            
fm_give_item(id"weapon_glock18");

            
fm_set_user_health(idget_pcvar_num(DOD_RifflemanHP));
            
fm_set_user_armor(idget_pcvar_num(DOD_RifllemanAR));
            
fm_set_rendering(idkRenderFxGlowShell01000kRenderNormal170);
    
        }
        case 
1:
        {
            
fm_strip_user_weapons(id);
            
fm_give_item(id"weapon_knife");
            
fm_give_item(id"weapon_galil");
            
fm_give_item(id"ammo_556nato");
            
fm_give_item(id"ammo_556nato"); 
            
fm_give_item(id"ammo_556nato");
            
fm_give_item(id"weapon_smokegrenade");
            
fm_give_item(id"weapon_hegrenade");
            
fm_give_item(id"weapon_usp");
            
fm_give_item(id"ammo_45acp");
            
fm_give_item(id"ammo_45acp");
            
fm_give_item(id"ammo_45acp");
            
fm_give_item(id"ammo_45acp");
            
fm_give_item(id"ammo_45acp");
            
fm_give_item(id"ammo_45acp");
            
fm_give_item(id"ammo_45acp");
            
fm_give_item(id"ammo_45acp");
            
    
            
fm_set_user_health(idget_pcvar_num(DOD_AssaultHP));
            
fm_set_user_armor(idget_pcvar_num(DOD_AssaultAR));
            
fm_set_rendering(idkRenderFxGlowShell02550kRenderNormal170);
        
        }

        case 
2:
        {
            
            
user_kill(id);
            
color_print(id"^x04You have died because you didn't select any class!");
            
fm_set_rendering(idkRenderFxGlowShell000kRenderNormal255);

            return 
0;
        }
    }
    return 
0;

__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
iNspiratioN
Member
Join Date: Feb 2009
Location: Lithuania
Old 03-10-2009 , 09:08   Re: Autorepare Dmg
Reply With Quote #6

Quote:
Originally Posted by One View Post
Hi,

im writing a new plug-in & want to add autorepare dmg to races...

example : race 1 has autorepare every sec. +2 HP

race 2 every sec. +5HP & ...

so i need the code & how can i add this to races?

so how i know, i cant have the same code in 1 plugin.
->
PHP Code:
#define TASK_REPARE 999

public autorepare(id)
{
    if ( 
id TASK_REPARE )
        
id -= TASK_REPARE ;
    
    if ( !
is_user_alive(id) )
        return ;
    
    
set_user_healthidget_user_health(id) +)        

and then add -> set_task( 1.0,"autorepare", TASK_REPARE+id )
--------------------------------------
PHP Code:
#define TASK_REPARE 999

public autorepare(id)
{
    if ( 
id TASK_REPARE )
        
id -= TASK_REPARE ;
    
    if ( !
is_user_alive(id) )
        return ;
    
    
set_user_healthidget_user_health(id) +
}

public 
characters_menu(idkeys)
{
    switch(
keys)
    {
        case 
0:  
        {
            
fm_strip_user_weapons(id);
            
fm_give_item(id"weapon_knife");
            
fm_give_item(id"weapon_m4a1");
            
fm_give_item(id"ammo_556nato");
            
fm_give_item(id"ammo_556nato");
            
fm_give_item(id"ammo_556nato");
            
fm_give_item(id"weapon_hegrenade");
            
fm_give_item(id"weapon_glock18");
            
            
fm_set_user_health(idget_pcvar_num(DOD_RifflemanHP));
            
fm_set_user_armor(idget_pcvar_num(DOD_RifllemanAR));
            
fm_set_rendering(idkRenderFxGlowShell01000kRenderNormal170);
            
set_task1.0,"autorepare"TASK_REPARE+id )
        }
        case 
1:
        {
            
fm_strip_user_weapons(id);
            
fm_give_item(id"weapon_knife");
            
fm_give_item(id"weapon_galil");
            
fm_give_item(id"ammo_556nato");
            
fm_give_item(id"ammo_556nato");
            
fm_give_item(id"ammo_556nato");
            
fm_give_item(id"weapon_smokegrenade");
            
fm_give_item(id"weapon_hegrenade");
            
fm_give_item(id"weapon_usp");
            
fm_give_item(id"ammo_45acp");
            
fm_give_item(id"ammo_45acp");
            
fm_give_item(id"ammo_45acp");
            
fm_give_item(id"ammo_45acp");
            
fm_give_item(id"ammo_45acp");
            
fm_give_item(id"ammo_45acp");
            
fm_give_item(id"ammo_45acp");
            
fm_give_item(id"ammo_45acp");
            
            
            
fm_set_user_health(idget_pcvar_num(DOD_AssaultHP));
            
fm_set_user_armor(idget_pcvar_num(DOD_AssaultAR));
            
fm_set_rendering(idkRenderFxGlowShell02550kRenderNormal170);
            
set_task1.0,"autorepare"TASK_REPARE+id )
        }
        
        case 
2:
        {
            
            
user_kill(id);
            
color_print(id"^x04You have died because you didn't select any class!");
            
fm_set_rendering(idkRenderFxGlowShell000kRenderNormal255);
            
set_task1.0,"autorepare"TASK_REPARE+id )
            return 
0;
        }
    }
    return 
0;

Maybe that helped

Last edited by iNspiratioN; 03-10-2009 at 09:10.
iNspiratioN is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 03-10-2009 , 09:15   Re: Autorepare Dmg
Reply With Quote #7

Ok, ty . thats very nice, no error & looks good. anyway i have to test first. ill test when im @ home. however a new problem :

Case 0 has autorepare :

PHP Code:
        case 0:  
        { 
            
fm_strip_user_weapons(id);
            
fm_give_item(id"weapon_knife");
            
fm_give_item(id"weapon_m4a1");
            
fm_give_item(id"ammo_556nato");
            
fm_give_item(id"ammo_556nato");
            
fm_give_item(id"ammo_556nato");
            
fm_give_item(id"weapon_hegrenade");
            
fm_give_item(id"weapon_glock18");
            
fm_set_user_maxspeedid265.0 ); 
            
get_user_footsteps(1);            ///Must be checked.if not work, delete + fun.inc
            
new Float:gravity get_cvar_float("amxx_gravity");
            
gravity *= 0.8
            set_user_gravity
(idgravity)  
            
fm_set_user_health(idget_pcvar_num(DOD_RifflemanHP));
            
fm_set_user_armor(idget_pcvar_num(DOD_RifllemanAR));
            
set_task1.0,"autorepare"TASK_REPARE+id 
how can i give case 1 autorepare too but this should be repared every sec. +1 HP & not 2HP
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
iNspiratioN
Member
Join Date: Feb 2009
Location: Lithuania
Old 03-10-2009 , 14:15   Re: Autorepare Dmg
Reply With Quote #8

Quote:
Originally Posted by One View Post
Ok, ty . thats very nice, no error & looks good. anyway i have to test first. ill test when im @ home. however a new problem :

Case 0 has autorepare :

PHP Code:
        case 0:  
        { 
            
fm_strip_user_weapons(id);
            
fm_give_item(id"weapon_knife");
            
fm_give_item(id"weapon_m4a1");
            
fm_give_item(id"ammo_556nato");
            
fm_give_item(id"ammo_556nato");
            
fm_give_item(id"ammo_556nato");
            
fm_give_item(id"weapon_hegrenade");
            
fm_give_item(id"weapon_glock18");
            
fm_set_user_maxspeedid265.0 ); 
            
get_user_footsteps(1);            ///Must be checked.if not work, delete + fun.inc
            
new Float:gravity get_cvar_float("amxx_gravity");
            
gravity *= 0.8
            set_user_gravity
(idgravity)  
            
fm_set_user_health(idget_pcvar_num(DOD_RifflemanHP));
            
fm_set_user_armor(idget_pcvar_num(DOD_RifllemanAR));
            
set_task1.0,"autorepare"TASK_REPARE+id 
how can i give case 1 autorepare too but this should be repared every sec. +1 HP & not 2HP
Simply change
Quote:
set_user_health( id, get_user_health(id) +2 )
to
Quote:
set_user_health( id, get_user_health(id) +1 )
{To change HEALTH}

+number to give health

PHP Code:
#define TASK_REPARE2 999

public autorepare2(id)
{
    if ( 
id TASK_REPARE2 )
        
id -= TASK_REPARE2;
    
    if ( !
is_user_alive(id) )
        return ;
    
set_user_healthidget_user_health(id) +)

Then add in case1 -> set_task( 1.0,"autorepare2", TASK_REPARE2+id )

I think like this... post here if you will get error from this.

Last edited by iNspiratioN; 03-10-2009 at 14:20.
iNspiratioN is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 03-10-2009 , 14:20   Re: Autorepare Dmg
Reply With Quote #9

Quote:
Originally Posted by iNspiratioN View Post
Simply change (+2) -> (+1) {To change HEALTH}

PHP Code:
#define TASK_REPARE2 999

public autorepare2(id)
{
    if ( 
id TASK_REPARE2 )
        
id -= TASK_REPARE2;
    
    if ( !
is_user_alive(id) )
        return ;
    
set_user_healthidget_user_health(id) +)

Then set_task( 1.0,"autorepare2", TASK_REPARE2+id )

I think like this... post here if you will get error at this.
lol. but i cant have 2 time this here :

PHP Code:
public autorepare(id

    if ( 
id TASK_REPARE 
        
id -= TASK_REPARE 
     
    if ( !
is_user_alive(id) ) 
        return ; 
     
set_user_healthidget_user_health(id) +

PHP Code:
public autorepare(id

    if ( 
id TASK_REPARE 
        
id -= TASK_REPARE 
     
    if ( !
is_user_alive(id) ) 
        return ; 
     
set_user_healthidget_user_health(id) +

Example :
race 1 become +2
race 2 become +3
race 4 become +5

or is it poss. that i try this so :
PHP Code:
public autorepare(id

    if ( 
id TASK_REPARE 
        
id -= TASK_REPARE 
     
    if ( !
is_user_alive(id) ) 
        return ; 
     
set_user_healthidget_user_health(id) +

PHP Code:
set_task1.0,"autorepare2"TASK_REPARE2+id+id+id+id 
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
iNspiratioN
Member
Join Date: Feb 2009
Location: Lithuania
Old 03-10-2009 , 14:30   Re: Autorepare Dmg
Reply With Quote #10

Actually i don't know i'm still beginner on AMXX Scripting... But have you tried ?
iNspiratioN 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 17:02.


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