AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Spectator Bug (https://forums.alliedmods.net/showthread.php?t=127725)

-=hunter=- 05-24-2010 04:33

Spectator Bug
 
Hello all. I found bug but i can't understand how to fix it. This plugin allows to enter spectate without killing and changing team. But if i kill myself and then try to go to the spectator and leave, there will be a bug. How can I fix it?

PHP Code:

#include <amxmodx>
#include <engine>
#include <fun>

public plugin_init() {
    
register_plugin("Plugin""1.0""AUTHOR")
    
register_clcmd("chooseteam""spectate" );
    
    
set_msg_block(get_user_msgid("ClCorpse"), BLOCK_SET );
}

public 
spectate(id)
{    
    if (
is_user_alive(id)) { // enter to spectate        
        
strip_user_weapons(id);        
        
entity_set_int(id,EV_INT_movetype,MOVETYPE_NOCLIP)        
        
entity_set_int(id,EV_INT_deadflag,DEAD_DEAD)
    } else { 
// exit from spectate    
        
spawn(id)        
        
give_item(id"weapon_knife")
        
give_item(id"weapon_usp")
    }    
    return 
PLUGIN_HANDLED;



unnyquee 05-24-2010 04:46

Re: Spectator Bug
 
What bug?

-=hunter=- 05-24-2010 04:54

Re: Spectator Bug
 
This bug appears after i was killed.
When i trying to exit from spectate then this does not happen as expected

Alka 05-24-2010 04:59

Re: Spectator Bug
 
This is not a proper way to spawn someone...You should use hamsandwich "Spawn" native, and don't know if it's needed to reset player prop also.

-=hunter=- 05-24-2010 05:20

Re: Spectator Bug
 
Alka I don't know how to use hamsandwich for fixing this problem. I can't understand what i must to do after
Quote:

RegisterHam(Ham_Spawn, "player", "fwdHamSpawn");
in a function fwdHamSpawn

Alka 05-24-2010 05:29

Re: Spectator Bug
 
Don't need to register the forward, just define the include <hamsandwich> then instead of "spawn(id)" put
PHP Code:

ExecuteHam(Ham_CS_RoundRespawnid); 


-=hunter=- 05-24-2010 07:58

Re: Spectator Bug
 
Alka Thank you very much! :-)


All times are GMT -4. The time now is 05:25.

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