AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   HAM spawn after death? (https://forums.alliedmods.net/showthread.php?t=206080)

alonelive 01-18-2013 05:02

HAM spawn after death?
 
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta>
#include <cstrike>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

public plugin_init ()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
RegisterHam Ham_Killed"player""fwd_Ham_Killed_post" )
    
//RegisterHam ( Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1 )
}


public 
fwd_Ham_Killed_postid )
{
    
set_task2.0"spawn" );
}

public 
spawn id 
{
    if (!
is_user_alive id ) && ( CS_TEAM_T <= cs_get_user_teamid ) <= CS_TEAM_CT ) )
    {
    
ExecuteHamB Ham_CS_RoundRespawn id )
    }


Hello all :)
code modified.

L 01/18/2013 - 15:55:49: [CSTRIKE] Player out of range (0)
L 01/18/2013 - 15:55:49: [AMXX] Displaying debug trace (plugin "wmp.amxx")
L 01/18/2013 - 15:55:49: [AMXX] Run time error 10: native error (native "cs_get_user_team")
L 01/18/2013 - 15:55:49: [AMXX] [0] wmp.sma::spawn (line 54)


What's wrong ? :)

AngeIII 01-18-2013 07:09

Re: HAM spawn after death?
 
set_task( 2.0, "spawn" );
to:
set_task( 2.0, "spawn",id );

bibu 01-18-2013 14:30

Re: HAM spawn after death?
 
And check also if user is connected.

Xalus 01-18-2013 14:30

Re: HAM spawn after death?
 
PHP Code:

CS_TEAM_T <= cs_get_user_teamid ) <= CS_TEAM_CT 

->
PHP Code:

CS_TEAM_T >= cs_get_user_teamid ) <= CS_TEAM_CT 


ConnorMcLeod 01-18-2013 15:42

Re: HAM spawn after death?
 
Quote:

Originally Posted by Xalus (Post 1875693)
PHP Code:

CS_TEAM_T <= cs_get_user_teamid ) <= CS_TEAM_CT 

->
PHP Code:

CS_TEAM_T >= cs_get_user_teamid ) <= CS_TEAM_CT 


no no no


AngeIII found the problem already

YamiKaitou 01-18-2013 20:07

Re: HAM spawn after death?
 
Quote:

Originally Posted by bibu (Post 1875692)
And check also if user is connected.

is_user_alive does this already, no need to check it again.

guipatinador 01-18-2013 20:39

Re: HAM spawn after death?
 
Quote:

Originally Posted by YamiKaitou (Post 1875881)
is_user_alive does this already, no need to check it again.

PHP Code:

if (!is_user_alive... 

is_user_connected is not necessary when is_user_alive is used, but, in this case, he is checking if the player is dead, so is better to check if the player is connected, because is_user_alive returns false when the player is dead / disconnected.

YamiKaitou 01-18-2013 20:43

Re: HAM spawn after death?
 
Quote:

Originally Posted by guipatinador (Post 1875901)
He is checking if the player is dead.

Opps, missed that part, thanks

alonelive 01-19-2013 07:53

Re: HAM spawn after death?
 
Thank you all! :)
Be happy!:)


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

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