Raised This Month: $ Target: $400
 0% 

Simple plugin: round start/respawn


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
in0x0rable7
Junior Member
Join Date: Dec 2008
Old 06-27-2009 , 08:28   Simple plugin: round start/respawn
Reply With Quote #1

There is not enough respawn points in some deathrun maps. So I wanted to make a plugin that respawns player if he gets killed at the very beginning of a new round. The method I'm trying to use is very simple but it should work since in DR there's semi-clip.
The code I made:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>

public plugin_init()
{
    
register_plugin("Resurrection""0.1""inox");    
}

public 
round_start(id)
{
    
set_task(0.2"killer"id)    
    
set_task(1.0"respawn"id)
}

public 
killer(id)
{
    if(
is_user_alive(id))
    {
        
user_kill(id)
    }
    return 
PLUGIN_HANDLED
}

public 
respawn(id)
{
    new 
name[32]
    
get_user_name(id,name,31)
    if(
is_user_alive(id))
    {
        return 
PLUGIN_HANDLED
    
}
    
ExecuteHamB(Ham_CS_RoundRespawnid)
    
client_print(idprint_chat"%s, you've been respawned due spawn issue."name)
    
client_print(idprint_chat"You're good to go !")
    return 
PLUGIN_HANDLED

'killer' function is only for testing purposes. The plugin completed with no errors or warning but it's not working anyway. I think, as I hardly understand pawn and actually this is my first plugin (so far I've only made some small changes to plugins), I've chosen incorrect 'round_start' function (I mean there's another function to do this job) or there's something wrong with 'set_tast'.
in0x0rable7 is offline
shine771
Senior Member
Join Date: Jun 2007
Old 06-27-2009 , 09:19   Re: Simple plugin: round start/respawn
Reply With Quote #2

This should work.
PHP Code:
#include <amxmodx>
#include <hamsandwich>

new Float:g_RoundStartGmt

public plugin_init() {
    
    
register_plugin("xx","0.7.0","shine")
    
    
register_event("DeathMsg","PlayerDeath","a")
    
    
register_logevent("RoundStart",2,"1=Round_Start")
}

public 
PlayerDeath() {
    
    new 
Victim read_data(2)
    
    if(
get_gametime() - g_RoundStartGmt 1.0) {
        
        
ExecuteHamB(Ham_CS_RoundRespawn,id)
    }
}

public 
RoundStart() g_RoundStartGmt get_gametime() 
shine771 is offline
in0x0rable7
Junior Member
Join Date: Dec 2008
Old 06-27-2009 , 09:33   Re: Simple plugin: round start/respawn
Reply With Quote #3

Code:
// C:\...\...\addons\amxmodx\scripting\newres.sma(21) : error 017: undefined
 symbol "id"
I got this error when I tried to complete the plugin.
in0x0rable7 is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 06-27-2009 , 09:45   Re: Simple plugin: round start/respawn
Reply With Quote #4

PHP Code:
#include <amxmodx>
#include <hamsandwich>

new Float:g_RoundStartGmt;

public 
plugin_init() {
    
register_plugin"xx""0.7.0""shine" );
    
    
register_event"DeathMsg""EventDeath""a" );
    
    
register_logevent"EventRoundStart"2"1=Round_Start" );
}

public 
EventDeath( ) {
    if( 
get_gametime( ) - g_RoundStartGmt 1.0 )
        
ExecuteHamBHam_CS_RoundRespawnread_data) );
}

public 
EventoundStart( )
    
g_RoundStartGmt get_gametime(); 
__________________
xPaw is offline
in0x0rable7
Junior Member
Join Date: Dec 2008
Old 06-27-2009 , 10:04   Re: Simple plugin: round start/respawn
Reply With Quote #5

xPaw, the plugin caused a server crash. amxx logs empty.
in0x0rable7 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 15:36.


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