AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Simple plugin: round start/respawn (https://forums.alliedmods.net/showthread.php?t=95781)

in0x0rable7 06-27-2009 08:28

Simple plugin: round start/respawn
 
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'.

shine771 06-27-2009 09:19

Re: Simple plugin: round start/respawn
 
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() 


in0x0rable7 06-27-2009 09:33

Re: Simple plugin: round start/respawn
 
Code:

// C:\...\...\addons\amxmodx\scripting\newres.sma(21) : error 017: undefined
 symbol "id"

I got this error when I tried to complete the plugin.

xPaw 06-27-2009 09:45

Re: Simple plugin: round start/respawn
 
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(); 


in0x0rable7 06-27-2009 10:04

Re: Simple plugin: round start/respawn
 
xPaw, the plugin caused a server crash. amxx logs empty.


All times are GMT -4. The time now is 15:36.

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