Raised This Month: $ Target: $400
 0% 

Life Mode


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
datasource
New Member
Join Date: Jun 2013
Old 12-29-2013 , 13:08   Life Mode
Reply With Quote #1

Hi again Finaly i created my new plugin. Life mode. Yep... it looks awfl. but it works ! Anyway what I wanna to do to is share with you guys and try to help me a little bit. Here is the code:
Code:
#include <amxmodx>
#include <cstrike>
#include <fun>
#include <colorchat>
#include <fakemeta_util>

#define PLUGIN "Life Mode"
#define VERSION "1.0"
#define AUTHOR "DataSource"


public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    
    register_event( "DeathMsg", "lf_someone_death", "a")
    register_event( "BombDrop", "lf_bomb_planted", "a")
    register_event("CurWeapon", "CurWeapon","be", "1=1")
    register_logevent("lf_bomb_plant", 3, "2=Planted_The_Bomb")
    register_logevent("lf_round_end", 2, "1=Round_End")
    register_logevent("lf_round_start", 2, "1=Round_Start")
    
    set_task( 20.0, "lf_textmsg")
}

public lf_textmsg(id) {
    ColorChat( 0, Color:RED, "^x04Plant or defuse the bomb to save your teammates and ^x03 yourself!")
    set_task(300.0, "lf_textmsg", id)
    
}

public lf_round_end() {
    
    new players[32], num, tid
    get_players(players, num, "a")

    for( new i = 0; i < num; i++ )
    {
    tid = players[i]
    remove_task(tid)
    
    } 
}

public lf_round_start() {
    
    if (fm_find_ent_by_class(-1, "weapon_c4") ) {
    new players[32], num, tid
    get_players(players, num, "a")
    
    for( new i = 0; i < num; i++ )
    {
    tid = players[i]
    if ( cs_get_user_team(tid) == CS_TEAM_T ) {
        set_task(1.0, "lf_mode_start", tid, "", 0, "a", 100)
    }
    }
    }
    
}


public lf_mode_start(tid) {

    
    if( !is_user_alive(tid) ) {
    remove_task(tid)
    }
    else {
    
    new Health = get_user_health(tid)
    
    set_user_health( tid, Health - 1)
    
    }
}

public lf_someone_death() {
    new iVictim = read_data( 2 )
    remove_task(iVictim)
    
}
new planter
public lf_bomb_plant() {
    new players[32], num, tid
    get_players(players, num, "a")

    for( new i = 0; i < num; i++ )
    {
    tid = players[i]
    
    if ( cs_get_user_team( tid ) == CS_TEAM_T )
        if ( planter == ( tid ) ) { 
        new t_health = get_user_health( tid )
        set_user_health( tid, t_health + 20 ) 
        } else {
        new t_health = get_user_health( tid )
        set_user_health( tid, t_health + 10 )
        }
    }
    
}

public CurWeapon(tid) {
    if(read_data(2) == CSW_C4)
    planter = tid
}

public lf_bomb_planted() {
    new BombPlanted = read_data(4)
    new players[32], num, tid
    if ( BombPlanted == 1 ) {
    
    get_players(players, num, "a")

    for( new i = 0; i < num; i++ )
    {
    tid = players[i]
    remove_task(tid)
    }
    set_task(1.0, "lf_bomb_defuse_time")
    }
    
}

public lf_bomb_defuse_time(tid) {
    new players[32], num, tid
    
    
    get_players(players, num, "a")
    
    for (new i = 0; i < num; i++ )
    {
    tid = players[i]
    
    if ( cs_get_user_team(tid) == CS_TEAM_CT ) {
        set_task(1.0, "lf_mode_start", tid, "", 0, "a", 100)
    }
    }
}
It doesn't look very good but problem is when someone connects 1-2s later and joinded the game the plugin doesn't work because it only checks at round start not when somebody connected... Any ideas?

Last edited by datasource; 12-29-2013 at 13:08.
datasource is offline
 



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 10:05.


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