Raised This Month: $ Target: $400
 0% 

Solved [HELP]what am i doing wrong ?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
yas17sin
Veteran Member
Join Date: Oct 2016
Location: Morocco/Sale
Old 04-11-2017 , 13:02   [HELP]what am i doing wrong ?
Reply With Quote #1

Hi all.

i've made this team swap and all seems good but when the round that cnrtolled by cvar comes the team does not swap, any idea why it doesn't work.

Here the fixed Code :

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

#define PLUGIN "Team Swap"
#define VERSION "0.2"
#define AUTHOR "yas17sin"

#define TAG "TAG"

#define TASK_SHOW_LEVEL 10113

#define isTeam(%0)    (CS_TEAM_T <= cs_get_user_team(%0) <= CS_TEAM_CT)

#define MAX_PLAYERS 32

new g_msgsync;

new 
iCount;

new 
cvar_enablecvar_round_neededcvar_round_hud;

public 
plugin_init()
{
    
register_plugin(AUTHORVERSIONPLUGIN)
    
    
register_event"HLTV""Event_NewRound""a""1=0""2=0" );
    
register_logevent("EventRoundEnd"2"1=Round_End" );
    
    
RegisterHamHam_Spawn"player""FwdPlayerSpawnPost");
    
    
g_msgsync CreateHudSyncObj();
    
    
cvar_enable register_cvar("amx_plugin_on""1");
    
cvar_round_needed register_cvar("amx_round_needed""4");
    
cvar_round_hud register_cvar("amx_hud_on""1");
    
    
register_clcmd("say /round""round_now")
    
register_clcmd("say_team /round""round_now")
    
register_clcmd("say /rnd""round_now")
    
register_clcmd("say_team /rnd""round_now")
}
public 
client_disconnect(id)
{
    
remove_taskTASK_SHOW_LEVEL id );
}
public 
Event_NewRound()
{
    if(!
get_pcvar_num(cvar_enable))
        return;
        
    
iCount++
    
    if( 
iCount get_pcvar_num(cvar_round_needed) )
    {
        
set_task(1.0"Swap")
    }
}
public 
FwdPlayerSpawnPost(id)
{
    if(!
get_pcvar_num(cvar_round_hud))
        return 
HAM_HANDLED;
        
    
set_task(0.1"task_show_level"TASK_SHOW_LEVEL id)
    
    return 
PLUGIN_CONTINUE;
}
public 
task_show_level(task)
{
    new 
id task TASK_SHOW_LEVEL
    
    set_hudmessage
(025500.440.0106.0300.0)
    
ShowSyncHudMsg(idg_msgsync"[%s] Round Remain For Swap : %d/%d"TAGiCountget_pcvar_num(cvar_round_needed));
    
    
set_task(0.1"task_show_level"TASK_SHOW_LEVEL id)        
}
public 
Swap(id)
{
    if(!
get_pcvar_num(cvar_enable))
        return;

    new 
iPlayers[MAX_PLAYERS], iNumid
    get_players
(iPlayersiNum)
    for(new 
i;iNum;i++)
    {
        
id iPlayers[i]

        if(
isTeam(id))
        {
            
cs_set_user_team(idcs_get_user_team(id) == CS_TEAM_CT CS_TEAM_T CS_TEAM_CT)
        }
    }
    
iCount 0;
}
public 
round_now(id)
{
    
client_print(idprint_center"[%s] the round now is %d/%d"TAGiCountget_pcvar_num(cvar_round_needed))
}
public 
EventRoundEnd()
{
    if(
get_pcvar_num(cvar_round_hud))
        return
        
    
client_print(0print_center"[%s] the round now is %d/%d"TAGiCountget_pcvar_num(cvar_round_needed))

P.S : thanks for advance.
__________________
FINISHED WORKING ON : Attack On Titan Mod (100% Done).

FB Acc : FaceBook Account.

pic: http://prntscr.com/fszkke not good quality

Last edited by yas17sin; 04-12-2017 at 14:40.
yas17sin is offline
Send a message via ICQ to yas17sin
 


Thread Tools
Display Modes

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 18:01.


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