AlliedModders

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

DruGzOG 08-01-2009 00:04

Zspawn
 
PHP Code:

#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#include <colorchat>
#tryinclude <zombiezealots>

new PLUG[] = "Zombie Respawn";
new 
VERS[] = "1.0";
new 
AUTH[] = "LeviN";

public 
plugin_init()
{
    
register_plugin(PLUGVERSAUTH);
    
    
RegisterHam(Ham_DeathNotice"player""player_death"1);
    
    
register_clcmd("say !zspawn""StartSpawn");
    
register_clcmd("say /zspawn""StartSpawn");
}

public 
player_death(id)
{
    
ColorChat(0GREEN"Type ^"^x03/zspawn^x04^" to respawn as a zombie!");
}

public 
StartSpawn(id)
{
    if(!
is_user_alive(id))
    {
        
cs_set_user_team(idCS_TEAM_T);
        
set_task(1.0"spawn_again"id);
    }
    return 
PLUGIN_HANDLED;
}

public 
spawn_again(id)
{
    
ExecuteHamB(Ham_Spawnid);
    
set_task(0.5"make_zombie"id);
}

public 
make_zombie(id)
{
    
infect_user(id);


Quote:

L 07/14/2009 - 18:13:52: [AMXX] Run time error 10 (plugin "zspawn.amxx") (native "cs_set_user_team") - debug not enabled!
L 07/14/2009 - 18:13:52: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
When I enable debug, the server crashes for some apparent reason, any solutions or fixes I should do?

5c0r-|3i0 08-01-2009 00:53

Re: Zspawn
 
This is just a remake of biohazard ...or what ??
1)the native cs_get_user_team maybe won't work...Because your plugin set team with another method ...(fm_get_user_team...or what ??)
2) Is there any logs when debug....post here..

Alka 08-01-2009 06:07

Re: Zspawn
 
Usually before checking player team with "cstrike" you must check if it's connected...try it.

if(is_user_alive(id) && is_user_connected(id))
//some ...

Xellath 08-01-2009 06:28

Re: Zspawn
 
I don't know if you have to set the team, infect_user() probably does that.

Also, setting a 1 second task is unnecessary, just call the function directly.

DruGzOG 08-01-2009 11:00

Re: Zspawn
 
Quote:

Originally Posted by 5c0r-|3i0 (Post 887238)
This is just a remake of biohazard ...or what ??
1)the native cs_get_user_team maybe won't work...Because your plugin set team with another method ...(fm_get_user_team...or what ??)
2) Is there any logs when debug....post here..

Quote:

Originally Posted by Alka (Post 887342)
Usually before checking player team with "cstrike" you must check if it's connected...try it.

if(is_user_alive(id) && is_user_connected(id))
//some ...

Quote:

Originally Posted by Xellath (Post 887359)
I don't know if you have to set the team, infect_user() probably does that.

Also, setting a 1 second task is unnecessary, just call the function directly.


@ 5c0r-|3i0
The issue is I cannot enable debug, it crashes. (Tested on 3 different servers)

@ Alka
I've tried that and like Xellath stated, infect_user does it

@ Xellath
Could you show me an example on how I should directly do it?

joaquimandrade 08-01-2009 11:18

Re: Zspawn
 
Do what alka said
PHP Code:

if(is_user_connected(id) && !is_user_alive(id)) 

About the enabling of debug are you sure it crashes because of it?

DruGzOG 08-01-2009 11:29

Re: Zspawn
 
Quote:

Originally Posted by joaquimandrade (Post 887514)
Do what alka said
PHP Code:

if(is_user_connected(id) && !is_user_alive(id)) 

About the enabling of debug are you sure it crashes because of it?

yea, like I stated above, tested on 3 different servers

I'll test it when I get home (1 week)

joaquimandrade 08-01-2009 11:31

Re: Zspawn
 
Quote:

Originally Posted by DruGzOG (Post 887517)
yea, like I stated above, tested on 3 different servers, that's why


Try with debug just the code:
PHP Code:

#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#include <colorchat>
#tryinclude <zombiezealots>

new PLUG[] = "Zombie Respawn";
new 
VERS[] = "1.0";
new 
AUTH[] = "LeviN";

public 
plugin_init()
{
    
register_plugin(PLUGVERSAUTH);
    
    
RegisterHam(Ham_DeathNotice"player""player_death"1);
    
    
register_clcmd("say !zspawn""StartSpawn");
    
register_clcmd("say /zspawn""StartSpawn");
}

public 
player_death(id)
{
    
ColorChat(0GREEN"Type ^"^x03/zspawn^x04^" to respawn as a zombie!");
}

public 
StartSpawn(id)
{
    if(!
is_user_alive(id))
    {
        
cs_set_user_team(idCS_TEAM_T);
    }
    return 
PLUGIN_HANDLED;




Xellath 08-01-2009 13:54

Re: Zspawn
 
PHP Code:

#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#include <colorchat>
#include <zombiezealots>

new PLUGIN[ ] = "Zombie Respawn";
new 
VERSION[ ] = "1.0";
new 
AUTHOR[ ] = "LeviN";

public 
plugin_init( )
{
    
register_pluginPLUGINVERSIONAUTHOR );
    
    
RegisterHamHam_DeathNotice"player""player_death");
    
    
register_clcmd"say !zspawn""startSpawn" );
    
register_clcmd"say /zspawn""startSpawn" );
}

public 
player_deathid )
{
    
ColorChatidGREEN"Type ^"^x03/zspawn^x04^" to respawn as a zombie!" );
}

public 
startSpawnid )
{
    if ( 
is_user_connectedid ) && !is_user_aliveid ) )
    {
        
ExecuteHamBHam_Spawnid );
    
        
infect_userid );
    }


I am guessing that infect_user changes the team of the player.

zacky 08-01-2009 19:20

Re: Zspawn
 
Quote:

Originally Posted by Xellath (Post 887618)
PHP Code:

#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#include <colorchat>
#include <zombiezealots>

new PLUGIN[ ] = "Zombie Respawn";
new 
VERSION[ ] = "1.0";
new 
AUTHOR[ ] = "LeviN";

public 
plugin_init( )
{
    
register_pluginPLUGINVERSIONAUTHOR );
    
    
RegisterHamHam_DeathNotice"player""player_death");
    
    
register_clcmd"say !zspawn""startSpawn" );
    
register_clcmd"say /zspawn""startSpawn" );
}

public 
player_deathid )
{
    
ColorChatidGREEN"Type ^"^x03/zspawn^x04^" to respawn as a zombie!" );
}

public 
startSpawnid )
{
    if ( 
is_user_connectedid ) && !is_user_aliveid ) )
    {
        
ExecuteHamBHam_Spawnid );
    
        
infect_userid );
    }


I am guessing that infect_user changes the team of the player.

Yes it does, just checked.


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

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