Raised This Month: $ Target: $400
 0% 

T skin bug


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hugz`
Veteran Member
Join Date: Jul 2007
Location: In a house
Old 10-18-2007 , 19:57   T skin bug
Reply With Quote #1

Hey I have this script that switches teams after Terrorists lose, and the bug is it leaves some CT's with the T skin, could anybody fix this up?

Code:
#include <amxmodx>
#include <cstrike>

new gMaxPlayers;
new bool:gRestart[33];

public plugin_init()
{
    register_plugin("Switch Ts", "1.0", "Exolent");
    register_logevent("logevent_Round_End", 2, "1=Round_End");
    register_clcmd("fullupdate", "clcmd_fullupdate");
    register_event("TextMsg", "event_TextMsg", "a", "#2=Game_will_restart_in");
    register_event("ResetHUD", "event_ResetHUD", "be");
    gMaxPlayers = get_maxplayers();
}

public client_disconnect(id)
{
    gRestart[id] = false;
}

public logevent_Round_End()
{
    new bool:tAlive = false;
    new CsTeams:team;
    for(new i = 1; i <= gMaxPlayers; i++) {
        if(!is_user_connected(i)) continue;
        team = cs_get_user_team(i);
        if(team == CS_TEAM_T && is_user_alive(i)) {
            tAlive = true;
            break;
        }
    }
    if(!tAlive) {
        for(new i = 1; i <= gMaxPlayers; i++) {
            if(!is_user_connected(i)) continue;
            team = cs_get_user_team(i);
            if(team != CS_TEAM_CT && team!= CS_TEAM_T) continue;
            cs_set_user_team(i, team == CS_TEAM_T ? CS_TEAM_CT : CS_TEAM_T, random_model(team));
        }
    }
}

public clcmd_fullupdate(id)
{
    return PLUGIN_HANDLED_MAIN;
}

public event_TextMsg()
{
    for(new i = 1; i <= gMaxPlayers; i++) {
        if(is_user_alive(i)) gRestart[i] = true;
    }
}

public event_ResetHUD(id)
{
    if(gRestart[id]) {
        gRestart[id] = false;
        return;
    }
    // let other plugin set custom models before checking bad ones.
    set_task(0.2, "handle_model", id + 888888);
}

public handle_model(id)
{
    id -= 888888;
    if(check_bad_model(id, CS_TEAM_T) || check_bad_model(id, CS_TEAM_CT)) {
        set_task(0.5, "set_model", id + 999999);
    }
}

public set_model(id)
{
    id -= 999999;
    new CsTeams:team = cs_get_user_team(id);
    if(team == CS_TEAM_CT) {
        cs_set_user_model(id, "gign");
    }
    else if(team == CS_TEAM_T) {
        cs_set_user_model(id, "leet");
    }
    
}

bool:check_bad_model(id, CsTeams:team)
{
    new model[32];
    cs_get_user_model(id, model, 31);
    if(team == CS_TEAM_T) {
        if(equali(model, "sas") || equali(model, "gign") || equali(model, "gsg9") || equali(model, "urban")) {
            return true;
        }
    }
    else if(team == CS_TEAM_CT) {
        if(equali(model, "arctic") || equali(model, "leet") || equali(model, "guerilla") || equali(model, "terror")) {
            return true;
        }
    }
    return false;
}

CsInternalModel:random_model(CsTeams:team)
{
    new CsInternalModel:model = CS_DONTCHANGE;
    if(team == CS_TEAM_CT) {
        switch(random_num(1, 4)) {
            case 1: model = CS_T_TERROR;
            case 2: model = CS_T_LEET;
            case 3: model = CS_T_ARCTIC;
            case 4: model = CS_T_GUERILLA;
        }
    }
    else if(team == CS_TEAM_T) {
        switch(random_num(1, 4)) {
            case 1: model = CS_CT_URBAN;
            case 2: model = CS_CT_GSG9;
            case 3: model = CS_CT_SAS;
            case 4: model = CS_CT_GIGN;
        }
    }
    return model;
}
__________________

Last edited by hugz`; 10-20-2007 at 10:16.
hugz` is offline
Send a message via AIM to hugz`
kp_uparrow
Penalized Member
Join Date: Jun 2006
Location: 192.168.0.1
Old 10-18-2007 , 20:08   Re: T skin bug
Reply With Quote #2

did you double post?
__________________
I USED A SECOND ACCOUNT TO DO MORE KARMA UPS AND DOWNS UNTIL GREENTRYST CAUGHT ME
kp_uparrow is offline
M249-M4A1
I <3 Mac
Join Date: May 2005
Location: Not interested
Old 10-18-2007 , 20:09   Re: T skin bug
Reply With Quote #3

No, Roach told him to post here. Also, don't upload the .amxx file, it doesn't help us. Post the .sma
__________________
M249-M4A1 is offline
hugz`
Veteran Member
Join Date: Jul 2007
Location: In a house
Old 10-18-2007 , 21:06   Re: T skin bug
Reply With Quote #4

Edited my post
__________________

Last edited by hugz`; 10-20-2007 at 10:16.
hugz` is offline
Send a message via AIM to hugz`
hugz`
Veteran Member
Join Date: Jul 2007
Location: In a house
Old 10-20-2007 , 10:15   Re: T skin bug
Reply With Quote #5

Could anyone fix this up a little?
__________________
hugz` is offline
Send a message via AIM to hugz`
Reply


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


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