View Single Post
Author Message
Ace67
Senior Member
Join Date: Sep 2020
Location: France
Old 11-02-2023 , 06:45   Dead Switch Team Plugin
Reply With Quote #1

Yo, i made this plugin for switch all dead CT to T on last round before change map for basebuilder

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <engine>
#include <hamsandwich>
#include <fun>
#include <csstats>
#include <csx>
#include <xs>

public plugin_init() {
    
register_plugin("Switch Dead CT to T on Last Round""1.0""Ace67");
    
register_event("Round_End""round_end_event""a""1=1");
}

public 
round_end_event(id) {
    if (
cs_get_user_team(id) == CS_TEAM_CT && !is_user_alive(id)) {
        
cs_set_user_team(idCS_TEAM_T);
        
client_print(idprint_chat"You have been moved to the Terrorist team for the last round.");
        
Respawn_Zombie(id);
    }
}

public 
Respawn_Zombie(id) {
    if (
is_user_connected(id) && cs_get_user_team(id) == CS_TEAM_T) {
        if (
get_user_health(id) == 6500 || !is_user_alive(id)) {
            
ExecuteHamB(Ham_CS_RoundRespawnid);
        } else {
            
client_print(idprint_center"%L"LANG_SERVER"FAIL_RESPAWN");
        }
    }

Got error:
PHP Code:
L 11/02/2023 15:17:54Invalid event (name "Round_End") (plugin "lastround.amxx")
L 11/02/2023 15:17:54: [AMXXDisplaying debug trace (plugin "lastround.amxx"version "1.0")
L 11/02/2023 15:17:54: [AMXXRun time error 10native error (native "register_event")
L 11/02/2023 15:17:54: [AMXX]    [0lastround.sma::plugin_init (line 14
I'm using the function respawn from basebuilder so that's not affecting it.
__________________
CS:CZ > CS 1.6

Last edited by Ace67; 11-02-2023 at 10:21.
Ace67 is offline