Raised This Month: $ Target: $400
 0% 

Setting/removing invisibility and godmode. Tasks.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
t3hNox
Senior Member
Join Date: Oct 2009
Old 06-15-2010 , 05:30   Setting/removing invisibility and godmode. Tasks.
Reply With Quote #1

Hi.
What I want to do is simply setting a player barely visibile or setting a godmode for a player and after some time remove it.
I've got some issue with the code and I think there is a better way how to do it.
PHP Code:
public plugin_init()
{
    
register_event("DeathMsg""eDeath""a"
}
//...
public setInvis(id) {
        
set_user_rendering(id,kRenderFxNone ,0,0,0,kRenderTransAlpha10);
        
set_task(10.0"removeInvis"id);
}

public 
removeInvis(id) {
        
set_user_rendering(id,kRenderFxNone,255,255,255,kRenderNormal,16);
}

//Originally from amx_super, couldn't find any better solution..
stock fm_set_user_godmode(idgodmode 0) {
    
set_pev(idpev_takedamagegodmode == DAMAGE_NO DAMAGE_AIM)

    return 
1
}

public 
setGodmode(id) {
    
fm_set_user_godmode(id,1)
    
set_task(10.0"removeGodmode"id);
}

public 
removeGodmode(id) {
    
fm_set_user_godmode(id,0)
}
public 
eDeath() {
//I'm aware that here should be some checking
        
remove_task(id//The Idea is to remove all the tasks to make sure that there wouldn't be any unnecessary invisibility or godmode removing.
        
removeGodmode(id)
        
removeInvis(id)

The problem is that if I'm using this code the server is crashing. There is no info in logs. The full code completes fine so I guess I'm looking for a more sufficient way how to do these two things.
And another question is wether I am removing these tasks correctly because I have noticed that after player's death the task may be still active.
t3hNox is offline
 


Thread Tools
Display Modes

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 14:45.


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