show equipment sprite

Сообщения
32
Реакции
0
Неверный раздел форума. Перенесено
Я ищу этот плагин show equipment sprite
 
Сообщения
125
Реакции
50
i don`t know if this is what you are looking for based on your description, but try

Код:
#include <fakemeta>
#include <engine>
#include <cstrike>
 
#define DISPLAY_MONEY  1
#define DISPLAY_WEAPONS 1
#define DISPLAY_DOLLARSIGN  1
#define DISPLAY_ARROW  0
 
#define PLUGIN  "SHOWTEAMEQUIP"
#define VERSION "1337"
#define AUTHOR  "tarsisd2"
 
#define TASK1 5125
#define TASK2 6124
 
#if DISPLAY_MONEY
#define NUMBER_OF_SPRITES  5
new userSpr[33][NUMBER_OF_SPRITES];
new tmpstr[6];
new value[2];
new money_sprite1[] = "sprites/1.spr"
new money_sprite10[] = "sprites/10.spr"
new money_sprite100[] = "sprites/100.spr"
new money_sprite1000[] = "sprites/1000.spr"
new money_sprite10000[] = "sprites/10000.spr"
#endif
 
#if DISPLAY_WEAPONS
#define NUMBER_OF_WEAPTYPES 7
new const Float:Pistols[6] = {1.0,10.0,11.0,16.0,17.0,26.0};
new const Float:Rifles[18] = {3.0,5.0,7.0,8.0,12.0,13.0,14.0,15.0,18.0,19.0,20.0,21.0,22.0,23.0,24.0,27.0,28.0,30.0};
new userWeap[33][NUMBER_OF_WEAPTYPES];
new armor;
new weapons;
new weap_sprite[] = "sprites/weap.spr"
new weap2_sprite[] = "sprites/weap2.spr"
 
#endif
 
#if DISPLAY_DOLLARSIGN
new userDSign[33];
new cash_sprite[] = "sprites/cash.spr"
 
#endif
 
#if DISPLAY_ARROW
new userArrow[33];
new arrow_sprite[] = "sprites/arrow.spr"
 
#endif
 
new bool:NewRound;
new bool:show;
 
new Float:userOrig[33][3];
new g_iMaxPlayers;
 
public plugin_precache(){
    #if DISPLAY_MONEY
    precache_model(money_sprite10000);
    precache_model(money_sprite1000);
    precache_model(money_sprite100);
    precache_model(money_sprite10);
    precache_model(money_sprite1);
    #endif
    #if DISPLAY_WEAPONS
    precache_model(weap_sprite);
    precache_model(weap2_sprite);
    #endif
    #if DISPLAY_DOLLARSIGN
    precache_model(cash_sprite);
    #endif
    #if DISPLAY_ARROW
    precache_model(arrow_sprite);
    #endif
}
 
public plugin_init(){
    register_plugin(PLUGIN,VERSION,AUTHOR);
 
    register_event("HLTV", "new_round", "a", "1=0", "2=0");
    g_iMaxPlayers = get_maxplayers()
    crear_entidades()
}
public plugin_cfg()
{
    if(is_plugin_loaded("Pause Plugins") != -1)
        server_cmd("amx_pausecfg add ^"SHOWEQUIPS^"");
}
public crear_entidades(){
    for(new x = 1; x <= g_iMaxPlayers; x++){
        #if DISPLAY_MONEY
        for(new i; i<NUMBER_OF_SPRITES; i++){
            userSpr[x][i]=create_entity("env_sprite");
        }
        #endif
        #if DISPLAY_WEAPONS
        for(new i; i<NUMBER_OF_WEAPTYPES; i++){
            userWeap[x][i]=create_entity("env_sprite");
        }
        #endif
        #if DISPLAY_DOLLARSIGN
        userDSign[x]=create_entity("env_sprite");
        #endif
        #if DISPLAY_ARROW
        userArrow[x]=create_entity("env_sprite");
        #endif
    }
}
public new_round(){
 
    NewRound = true;
    show = true
    remove_task(TASK2)
    remove_task(TASK1)
    set_task(get_cvar_float("mp_freezetime"),"hiden",TASK1);
    set_task(0.2,"display_info",TASK2,"",0,"b");
}
public hiden(){
    show = false
}
 
 
public display_info(){
 
 
    for(new c=1; c<= g_iMaxPlayers; c++){
      
        if(!is_user_alive(c) || !is_user_connected(c)){
            #if DISPLAY_MONEY
            drawsprite(userSpr[c][4],c,money_sprite10000,1.0,34.0,0,0,255,0);
            drawsprite(userSpr[c][3],c,money_sprite1000,1.0,34.0,0,0,255,0);
            drawsprite(userSpr[c][2],c,money_sprite100,1.0,34.0,0,0,255,0);
            drawsprite(userSpr[c][1],c,money_sprite10,1.0,34.0,0,0,255,0);
            drawsprite(userSpr[c][0],c,money_sprite1,1.0,34.0,0,0,255,0);
            #endif
            #if DISPLAY_DOLLARSIGN
            drawsprite(userDSign[c],c,cash_sprite,1.0,34.0,0,0,255,0);
            #endif
            #if DISPLAY_ARROW
            drawsprite(userArrow[c],c,arrow_sprite,1.0,34.0,0,255,255,0);
            #endif
            #if DISPLAY_WEAPONS
            drawsprite(userWeap[c][0],c,weap_sprite,Pistols[0],50.0,0,255,255,0);
            drawsprite(userWeap[c][1],c,weap_sprite,Rifles[0],50.0,0,255,255,0);
            drawsprite(userWeap[c][2],c,weap_sprite,4.0,50.0,0,255,255,255);
            drawsprite(userWeap[c][3],c,weap_sprite,25.0,50.0,0,255,255,255);
            drawsprite(userWeap[c][4],c,weap_sprite,9.0,50.0,0,255,255,255);
            drawsprite(userWeap[c][5],c,weap2_sprite,1.0,50.0,0,0,0,255);
            drawsprite(userWeap[c][6],c,weap2_sprite,3.0,50.0,0,0,0,255);
            #endif
          
            continue;
        }
      
        #if DISPLAY_MONEY
        for (new x; x < NUMBER_OF_SPRITES; x++){
            arrayset(tmpstr, 0, sizeof tmpstr);
            num_to_str(cs_get_user_money(c), tmpstr, charsmax(tmpstr))
            value[0]=tmpstr[x];
            value[1]=0;
          
            if(!tmpstr[x]){
                switch(x){
                    case 0: drawsprite(userSpr[c][4],c,money_sprite10000,1.0,34.0,0,0,255,0);
                    case 1: drawsprite(userSpr[c][3],c,money_sprite1000,1.0,34.0,0,0,255,0);
                    case 2: drawsprite(userSpr[c][2],c,money_sprite100,1.0,34.0,0,0,255,0);
                    case 3: drawsprite(userSpr[c][1],c,money_sprite10,1.0,34.0,0,0,255,0);
                    case 4: drawsprite(userSpr[c][0],c,money_sprite1,1.0,34.0,0,0,255,0);
                }
                continue;
            }
          
            switch(x){
                case 0: drawsprite(userSpr[c][4],c,money_sprite10000,floatstr(value),34.0,255,0,255,0);
                case 1: drawsprite(userSpr[c][3],c,money_sprite1000,floatstr(value),34.0,255,0,255,0);
                case 2: drawsprite(userSpr[c][2],c,money_sprite100,floatstr(value),34.0,255,0,255,0);
                case 3: drawsprite(userSpr[c][1],c,money_sprite10,floatstr(value),34.0,255,0,255,0);
                case 4: drawsprite(userSpr[c][0],c,money_sprite1,floatstr(value),34.0,255,0,255,0);
            }
        }
        #endif
        #if DISPLAY_DOLLARSIGN
        drawsprite(userDSign[c],c,cash_sprite,1.0,34.0,255,0,255,0);
        #endif
        #if DISPLAY_ARROW
        drawsprite(userArrow[c],c,arrow_sprite,1.0,34.0,255,255,255,0);
        #endif
        #if DISPLAY_WEAPONS
        weapons = pev(c, pev_weapons);
      
        for(new i; i < sizeof Pistols; i++)
        if(weapons & 1<<floatround(Pistols[i])){
            drawsprite(userWeap[c][0],c,weap_sprite,Pistols[i],50.0,255,255,255,0);
            goto jmp1;
        }
        drawsprite(userWeap[c][0],c,weap_sprite,Pistols[0],50.0,0,255,255,0);
        jmp1:
      
        for(new i; i < sizeof Rifles; i++)
        if(weapons & 1<<floatround(Rifles[i])){
            drawsprite(userWeap[c][1],c,weap_sprite,Rifles[i],50.0,255,255,255,0);
            goto jmp2;
        }
        drawsprite(userWeap[c][1],c,weap_sprite,Rifles[0],50.0,0,255,255,0);
        jmp2:
      
        if(weapons & 1<<CSW_HEGRENADE)
        drawsprite(userWeap[c][2],c,weap_sprite,4.0,50.0,255,255,255,255);
        else
        drawsprite(userWeap[c][2],c,weap_sprite,4.0,50.0,0,255,255,255);
      
        if(weapons & 1<<CSW_FLASHBANG)
        drawsprite(userWeap[c][3],c,weap_sprite,25.0,50.0,255,255,255,255);
        else
        drawsprite(userWeap[c][3],c,weap_sprite,25.0,50.0,0,255,255,255);
      
        if(weapons & 1<<CSW_SMOKEGRENADE)
        drawsprite(userWeap[c][4],c,weap_sprite,9.0,50.0,255,255,255,255);
        else
        drawsprite(userWeap[c][4],c,weap_sprite,9.0,50.0,0,255,255,255);
      
        cs_get_user_armor(c,CsArmorType:armor);
        if(armor == 2)
        drawsprite(userWeap[c][5],c,weap2_sprite,2.0,50.0,255,0,0,255);
        else if(armor == 1)
        drawsprite(userWeap[c][5],c,weap2_sprite,1.0,50.0,255,0,0,255);
        else
        drawsprite(userWeap[c][5],c,weap2_sprite,1.0,50.0,0,0,0,255);
      
      
        if(weapons & 1<<CSW_C4)
        drawsprite(userWeap[c][6],c,weap2_sprite,3.0,50.0,255,0,0,255);
        else if(cs_get_user_defuse(c))
        drawsprite(userWeap[c][6],c,weap2_sprite,4.0,50.0,255,0,0,255);
        else
        drawsprite(userWeap[c][6],c,weap2_sprite,3.0,50.0,0,0,0,255);
      
        #endif
    }
}
 
drawsprite(ent,player,str[],Float:frame,Float:offset,render,r,g,b){
 
    set_pev(ent, pev_framerate, 1.0)
    set_pev(ent, pev_scale, 0.3)
    set_pev(ent, pev_movetype, MOVETYPE_NOCLIP);
    engfunc(EngFunc_SetModel, ent, str);
    set_pev(ent, pev_frame, frame)
 
 
    if(is_user_connected(player) && is_user_alive(player)){
        pev(player, pev_origin, userOrig[player]);
        userOrig[player][2] += offset;
        set_pev(ent, pev_origin, userOrig[player]);
    }
    else{
        set_pev(ent, pev_origin, {0.0, 0.0, 0.0})
    }
 
    if(!show){
        render = 0
        set_pev(ent, pev_origin, {0.0, 0.0, 0.0})
        remove_task(TASK2)
    }
 

Вложения

d3m37r4

111111
Сообщения
1,454
Реакции
1,194
Помог
10 раз(а)

RockTheStreet

Саппорт года
Сообщения
1,743
Реакции
344
Помог
40 раз(а)
Обратите внимание, если вы хотите заключить сделку с этим пользователем, он заблокирован
d3m37r4, А есть лучше?
Мне просто тоже хотелось бы найти хорошую реализацию.
 
Сообщения
188
Реакции
11
классный плагин себе бы тоже поствил
 
Сообщения
125
Реакции
50
ty this, if you don`t use reapi comment //#define REAPI_COMPATIBILITY

Код:
#include <amxmodx>
#include <engine>
#include <cstrike>
#include <fakemeta>

#define REAPI_COMPATIBILITY

#if defined REAPI_COMPATIBILITY
#include <reapi>
#endif

#pragma semicolon 1

static const PLUGIN[] = "TEAM EQUIPMENT"; static const VERSION[] = "1.0"; static const AUTHOR[] = "Dev-cs";

#define IsPlayer(%0)            (1 <= %0 <= MAX_PLAYERS)
#define GetPlayerBit(%0,%1)     (IsPlayer(%1) && (%0 & (1 << (%1 & 31))))
#define SetPlayerBit(%0,%1)     (IsPlayer(%1) && (%0 |= (1 << (%1 & 31))))
#define ClearPlayerBit(%0,%1)   (IsPlayer(%1) && (%0 &= ~(1 << (%1 & 31))))

/// ================== MONEY ===================================
const WEAPON_SPRITES = 7;

static const szMoneySprites[][] = {"sprites/10000.spr", "sprites/1000.spr", "sprites/100.spr", "sprites/10.spr", "sprites/1.spr"};
static const szWeaponsSprites[][] = {"sprites/weap.spr", "sprites/weap2.spr"};
static const szSpriteSign[] = "sprites/cash.spr";
static const szSpriteArrow[] = "sprites/arrow.spr";

static g_iPlayerMoneySprites[33][5], g_iPlayerWeaponsSprites[33][WEAPON_SPRITES], g_iPlayerDolarSign[33], g_iPlayerArrow[33];

static const Float:fPistols[6] = {1.0,10.0,11.0,16.0,17.0,26.0};
static const Float:fRifles[18] = {3.0,5.0,7.0,8.0,12.0,13.0,14.0,15.0,18.0,19.0,20.0,21.0,22.0,23.0,24.0,27.0,28.0,30.0};

static g_iIsConnected;

const TASK_REMOVE_ENT = 6969;
static const szClassNameEntPijuda[] = "EntityPijuda";
static g_iEntPijuda;

public plugin_precache(){
    new i;

    for(i = 0; i < sizeof(szMoneySprites); i++) precache_model(szMoneySprites[i]);
    for(i = 0; i < sizeof(szWeaponsSprites); i++) precache_model(szWeaponsSprites[i]);

    precache_model(szSpriteSign); precache_model(szSpriteArrow);
}

public plugin_init(){
    register_plugin(PLUGIN, VERSION, AUTHOR);

    register_event("HLTV", "EventRoundStart", "a", "1=0", "2=0");

    register_think(szClassNameEntPijuda, "ShowSprites");
    
    #if defined REAPI_COMPATIBILITY
    RegisterHookChain(RG_RoundEnd, "fwdRoundEnd", false);
    #else
    register_logevent("fwdRoundEnd", 2, "1=Round_End");
    #endif
}

#if defined REAPI_COMPATIBILITY
public fwdRoundEnd(WinStatus:status, ScenarioEventEndRound:event, Float:tmDelay)
#else
public fwdRoundEnd()
#endif
{
    remove_task(TASK_REMOVE_ENT); HideEntities();
}

public EventRoundStart(){
    remove_task(TASK_REMOVE_ENT); set_task(get_cvar_float("mp_freezetime"), "HideEntities", TASK_REMOVE_ENT);

    g_iEntPijuda = create_entity("info_target");
    if(is_valid_ent(g_iEntPijuda)){
        entity_set_string(g_iEntPijuda, EV_SZ_classname, szClassNameEntPijuda);
        entity_set_float(g_iEntPijuda, EV_FL_nextthink, get_gametime() + 0.2);
    }
}

public client_putinserver(id){
    SetPlayerBit(g_iIsConnected, id); CreateEntitiesOnConnect(id);
}

public client_disconnected(id){
    if(GetPlayerBit(g_iIsConnected, id)){
        ClearPlayerBit(g_iIsConnected, id);
        RemoveEntitiesOnDisconnect(id);
    }
}

CreateEntitiesOnConnect(const iId){
    new i;
    for(i = 0; i < sizeof(szMoneySprites); i++){
        g_iPlayerMoneySprites[iId][i] = create_entity("env_sprite");

        if(is_valid_ent(g_iPlayerMoneySprites[iId][i])) SetEntityAttribs(g_iPlayerMoneySprites[iId][i], szMoneySprites[i]);
    }

    for(i = 0; i < WEAPON_SPRITES; i++){
        g_iPlayerWeaponsSprites[iId][i] = create_entity("env_sprite");

        if(is_valid_ent(g_iPlayerWeaponsSprites[iId][i])) SetEntityAttribs(g_iPlayerWeaponsSprites[iId][i], (i < 5) ? szWeaponsSprites[0] : szWeaponsSprites[1]);
    }
    
    g_iPlayerDolarSign[iId] = create_entity("env_sprite"); if(is_valid_ent(g_iPlayerDolarSign[iId])) SetEntityAttribs(g_iPlayerDolarSign[iId], szSpriteSign);
    g_iPlayerArrow[iId] = create_entity("env_sprite"); if(is_valid_ent(g_iPlayerArrow[iId])) SetEntityAttribs(g_iPlayerArrow[iId], szSpriteArrow);
}

RemoveEntitiesOnDisconnect(const iId){
    new i;
    for(i = 0; i < sizeof(szMoneySprites); i++){
        remove_entity(g_iPlayerMoneySprites[iId][i]);
        g_iPlayerMoneySprites[iId][i] = 0;
    }
    for(i = 0; i < WEAPON_SPRITES; i++){
        remove_entity(g_iPlayerWeaponsSprites[iId][i]);
        g_iPlayerWeaponsSprites[iId][i] = 0;
    }

    remove_entity(g_iPlayerDolarSign[iId]); g_iPlayerDolarSign[iId] = 0;
    remove_entity(g_iPlayerArrow[iId]); g_iPlayerArrow[iId] = 0;
}

public ShowSprites(iEnt){
    if(!is_valid_ent(iEnt)) return PLUGIN_HANDLED;

    static i, j;
    static iMoney, szMoney[6], szValue[2];
    static iWeapons, bPistols, bRifles, iArmortype;

    for(i = 1; i <= MAX_PLAYERS; i++){
        if(!is_user_alive(i)) continue;

        iMoney = cs_get_user_money(i); num_to_str(iMoney, szMoney, charsmax(szMoney));

        for(j = 0; j < sizeof(szMoneySprites); j++){
            szValue[0] = szMoney[j]; szValue[1] = 0;

            if(!szMoney[j]) DisplaySprite(g_iPlayerMoneySprites[i][j], i, 1.0, 34.0, 0, 0, 255, 0);
            else DisplaySprite(g_iPlayerMoneySprites[i][j], i, floatstr(szValue), 34.0, 255,0, 255, 0);
        }

        DisplaySprite(g_iPlayerDolarSign[i], i, 1.0, 34.0, 255, 0, 255, 0);
        DisplaySprite(g_iPlayerArrow[i], i, 1.0, 34.0, 255, 255, 255, 0);

        iWeapons = pev(i, pev_weapons); bPistols = false; bRifles = false;
        
        for(j = 0; j < sizeof (fPistols); j++){
            if(iWeapons & 1<<floatround(fPistols[j])){
                DisplaySprite(g_iPlayerWeaponsSprites[i][0], i, fPistols[j], 50.0, 255, 255, 255, 0);
                bPistols = true;
            }
        }
        
        if(!bPistols) DisplaySprite(g_iPlayerWeaponsSprites[i][0], i, fPistols[0], 50.0, 0, 255, 255, 0);

        for(j = 0; j < sizeof (fRifles); j++){
            if(iWeapons & 1<<floatround(fRifles[j])){
                DisplaySprite(g_iPlayerWeaponsSprites[i][1], i, fRifles[j], 50.0, 255, 255, 255, 0);
                bRifles = true;
            }
        }

        if(!bRifles) DisplaySprite(g_iPlayerWeaponsSprites[i][1], i, fRifles[0], 50.0, 0, 255, 255, 0);
        
        if(iWeapons & 1<<CSW_HEGRENADE) DisplaySprite(g_iPlayerWeaponsSprites[i][2], i, 4.0, 50.0, 255, 255, 255, 255);
        else DisplaySprite(g_iPlayerWeaponsSprites[i][2], i, 4.0, 50.0, 0, 255, 255, 255);
        
        if(iWeapons & 1<<CSW_FLASHBANG) DisplaySprite(g_iPlayerWeaponsSprites[i][3], i, 25.0, 50.0, 255, 255, 255, 255);
        else DisplaySprite(g_iPlayerWeaponsSprites[i][3], i, 25.0, 50.0, 0, 255, 255, 255);
        
        if(iWeapons & 1<<CSW_SMOKEGRENADE) DisplaySprite(g_iPlayerWeaponsSprites[i][4], i, 9.0, 50.0, 255, 255, 255, 255);
        else DisplaySprite(g_iPlayerWeaponsSprites[i][4], i, 9.0, 50.0, 0, 255, 255, 255);

        cs_get_user_armor(i, CsArmorType:iArmortype);
        if(iArmortype == 2) DisplaySprite(g_iPlayerWeaponsSprites[i][5], i, 2.0, 50.0, 255, 0, 0, 255);
        else if(iArmortype == 1) DisplaySprite(g_iPlayerWeaponsSprites[i][5], i, 1.0, 50.0, 255, 0, 0, 255);
        else DisplaySprite(g_iPlayerWeaponsSprites[i][5], i, 1.0, 50.0, 0, 0, 0, 255);

        if(iWeapons & 1<<CSW_C4) DisplaySprite(g_iPlayerWeaponsSprites[i][6], i, 3.0, 50.0, 255, 0, 0, 255);
        else if(cs_get_user_defuse(i)) DisplaySprite(g_iPlayerWeaponsSprites[i][6], i, 4.0, 50.0, 255, 0, 0, 255);
        else DisplaySprite(g_iPlayerWeaponsSprites[i][6], i, 3.0, 50.0, 0, 0, 0, 255);
    }

    entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + 1.0);
    return PLUGIN_CONTINUE;
}

DisplaySprite(const iEnt, iPlayer, Float:fFrame, Float:fOffset, const iRender, const iRed, const iGreen, const iBlue)
{
    if(!is_valid_ent(iEnt)) return;

    set_entity_visibility(iEnt, 1);
    entity_set_float(iEnt, EV_FL_frame, fFrame);
    set_rendering(iEnt, kRenderFxNone, iRed, iGreen, iBlue, kRenderTransAdd, iRender);
    static Float:vPlayerOrigin[3]; entity_get_vector(iPlayer, EV_VEC_origin, vPlayerOrigin); vPlayerOrigin[2] += fOffset;
    entity_set_vector(iEnt, EV_VEC_origin, vPlayerOrigin);
}

SetEntityAttribs(const iEnt, const szModel[]){
    entity_set_model(iEnt, szModel);
    entity_set_int(iEnt, EV_INT_movetype, MOVETYPE_NOCLIP);
    entity_set_float(iEnt, EV_FL_framerate, 1.0);
    entity_set_float(iEnt, EV_FL_scale, 0.3);
    set_entity_visibility(iEnt, 0);
}

public HideEntities(){
    if(is_valid_ent(g_iEntPijuda)){
        remove_entity(g_iEntPijuda);
        g_iEntPijuda = 0;
    }

    new i;
    for(new iId = 1; iId <= MAX_PLAYERS; iId++){
        for(i = 0; i < sizeof(szMoneySprites); i++) if(is_valid_ent(g_iPlayerMoneySprites[iId][i])) set_entity_visibility(g_iPlayerMoneySprites[iId][i], 0);

        for(i = 0; i < WEAPON_SPRITES; i++) if(is_valid_ent(g_iPlayerWeaponsSprites[iId][i])) set_entity_visibility(g_iPlayerWeaponsSprites[iId][i], 0);
    
        if(is_valid_ent(g_iPlayerDolarSign[iId])) set_entity_visibility(g_iPlayerDolarSign[iId], 0);
        if(is_valid_ent(g_iPlayerArrow[iId])) set_entity_visibility(g_iPlayerArrow[iId], 0);
    }
}

// WORK ON AMX_OFF
public plugin_cfg() if(is_plugin_loaded("Pause Plugins") != -1) server_cmd("amx_pausecfg add ^"%s^"", PLUGIN);
 
Сообщения
188
Реакции
11
tarsisd2, плагин скомпилировался , спрайты с сервера качаются , но иконки над игроками не показываются (
так должно ведь выглядеть?
так должно ведь выглядеть?
 
Сообщения
459
Реакции
272
Помог
9 раз(а)
Schokk,
Скрытое содержимое для пользователей: Schokk
 
Сообщения
125
Реакции
50
i see why don`t compile for you, i forgot to include some parts in the code, try this now

Код:
#include <amxmodx>
#include <fakemeta>
#include <engine>
#include <cstrike>
 
#define DISPLAY_MONEY  1
#define DISPLAY_WEAPONS 1
#define DISPLAY_DOLLARSIGN  1
#define DISPLAY_ARROW  0
 
#define PLUGIN  "SHOWTEAMEQUIP"
#define VERSION "1.0"
#define AUTHOR  "Dev-cs"
 
#define TASK1 5125
#define TASK2 6124
 
#if DISPLAY_MONEY
#define NUMBER_OF_SPRITES  5
new userSpr[33][NUMBER_OF_SPRITES];
new tmpstr[6];
new value[2];
new money_sprite1[] = "sprites/1.spr"
new money_sprite10[] = "sprites/10.spr"
new money_sprite100[] = "sprites/100.spr"
new money_sprite1000[] = "sprites/1000.spr"
new money_sprite10000[] = "sprites/10000.spr"
#endif
 
#if DISPLAY_WEAPONS
#define NUMBER_OF_WEAPTYPES 7
new const Float:Pistols[6] = {1.0,10.0,11.0,16.0,17.0,26.0};
new const Float:Rifles[18] = {3.0,5.0,7.0,8.0,12.0,13.0,14.0,15.0,18.0,19.0,20.0,21.0,22.0,23.0,24.0,27.0,28.0,30.0};
new userWeap[33][NUMBER_OF_WEAPTYPES];
new armor;
new weapons;
new weap_sprite[] = "sprites/weap.spr"
new weap2_sprite[] = "sprites/weap2.spr"
 
#endif
 
#if DISPLAY_DOLLARSIGN
new userDSign[33];
new cash_sprite[] = "sprites/cash.spr"
 
#endif
 
#if DISPLAY_ARROW
new userArrow[33];
new arrow_sprite[] = "sprites/arrow.spr"
 
#endif
 
new bool:NewRound;
new bool:show;
 
new Float:userOrig[33][3];
new g_iMaxPlayers;
 
public plugin_precache(){
    #if DISPLAY_MONEY
    precache_model(money_sprite10000);
    precache_model(money_sprite1000);
    precache_model(money_sprite100);
    precache_model(money_sprite10);
    precache_model(money_sprite1);
    #endif
    #if DISPLAY_WEAPONS
    precache_model(weap_sprite);
    precache_model(weap2_sprite);
    #endif
    #if DISPLAY_DOLLARSIGN
    precache_model(cash_sprite);
    #endif
    #if DISPLAY_ARROW
    precache_model(arrow_sprite);
    #endif
}
 
public plugin_init(){
    register_plugin(PLUGIN,VERSION,AUTHOR);
 
    register_event("HLTV", "new_round", "a", "1=0", "2=0");
    g_iMaxPlayers = get_maxplayers()
    crear_entidades()
}
public plugin_cfg()
{
    if(is_plugin_loaded("Pause Plugins") != -1)
        server_cmd("amx_pausecfg add ^"SHOWEQUIPS^"");
}
public crear_entidades(){
    for(new x = 1; x <= g_iMaxPlayers; x++){
        #if DISPLAY_MONEY
        for(new i; i<NUMBER_OF_SPRITES; i++){
            userSpr[x][i]=create_entity("env_sprite");
        }
        #endif
        #if DISPLAY_WEAPONS
        for(new i; i<NUMBER_OF_WEAPTYPES; i++){
            userWeap[x][i]=create_entity("env_sprite");
        }
        #endif
        #if DISPLAY_DOLLARSIGN
        userDSign[x]=create_entity("env_sprite");
        #endif
        #if DISPLAY_ARROW
        userArrow[x]=create_entity("env_sprite");
        #endif
    }
}
public new_round(){
 
    NewRound = true;
    show = true
    remove_task(TASK2)
    remove_task(TASK1)
    set_task(get_cvar_float("mp_freezetime"),"hiden",TASK1);
    set_task(0.2,"display_info",TASK2,"",0,"b");
}
public hiden(){
    show = false
}
 
 
public display_info(){
 
 
    for(new c=1; c<= g_iMaxPlayers; c++){
      
        if(!is_user_alive(c) || !is_user_connected(c)){
            #if DISPLAY_MONEY
            drawsprite(userSpr[c][4],c,money_sprite10000,1.0,34.0,0,0,255,0);
            drawsprite(userSpr[c][3],c,money_sprite1000,1.0,34.0,0,0,255,0);
            drawsprite(userSpr[c][2],c,money_sprite100,1.0,34.0,0,0,255,0);
            drawsprite(userSpr[c][1],c,money_sprite10,1.0,34.0,0,0,255,0);
            drawsprite(userSpr[c][0],c,money_sprite1,1.0,34.0,0,0,255,0);
            #endif
            #if DISPLAY_DOLLARSIGN
            drawsprite(userDSign[c],c,cash_sprite,1.0,34.0,0,0,255,0);
            #endif
            #if DISPLAY_ARROW
            drawsprite(userArrow[c],c,arrow_sprite,1.0,34.0,0,255,255,0);
            #endif
            #if DISPLAY_WEAPONS
            drawsprite(userWeap[c][0],c,weap_sprite,Pistols[0],50.0,0,255,255,0);
            drawsprite(userWeap[c][1],c,weap_sprite,Rifles[0],50.0,0,255,255,0);
            drawsprite(userWeap[c][2],c,weap_sprite,4.0,50.0,0,255,255,255);
            drawsprite(userWeap[c][3],c,weap_sprite,25.0,50.0,0,255,255,255);
            drawsprite(userWeap[c][4],c,weap_sprite,9.0,50.0,0,255,255,255);
            drawsprite(userWeap[c][5],c,weap2_sprite,1.0,50.0,0,0,0,255);
            drawsprite(userWeap[c][6],c,weap2_sprite,3.0,50.0,0,0,0,255);
            #endif
          
            continue;
        }
      
        #if DISPLAY_MONEY
        for (new x; x < NUMBER_OF_SPRITES; x++){
            arrayset(tmpstr, 0, sizeof tmpstr);
            num_to_str(cs_get_user_money(c), tmpstr, charsmax(tmpstr))
            value[0]=tmpstr[x];
            value[1]=0;
          
            if(!tmpstr[x]){
                switch(x){
                    case 0: drawsprite(userSpr[c][4],c,money_sprite10000,1.0,34.0,0,0,255,0);
                    case 1: drawsprite(userSpr[c][3],c,money_sprite1000,1.0,34.0,0,0,255,0);
                    case 2: drawsprite(userSpr[c][2],c,money_sprite100,1.0,34.0,0,0,255,0);
                    case 3: drawsprite(userSpr[c][1],c,money_sprite10,1.0,34.0,0,0,255,0);
                    case 4: drawsprite(userSpr[c][0],c,money_sprite1,1.0,34.0,0,0,255,0);
                }
                continue;
            }
          
            switch(x){
                case 0: drawsprite(userSpr[c][4],c,money_sprite10000,floatstr(value),34.0,255,0,255,0);
                case 1: drawsprite(userSpr[c][3],c,money_sprite1000,floatstr(value),34.0,255,0,255,0);
                case 2: drawsprite(userSpr[c][2],c,money_sprite100,floatstr(value),34.0,255,0,255,0);
                case 3: drawsprite(userSpr[c][1],c,money_sprite10,floatstr(value),34.0,255,0,255,0);
                case 4: drawsprite(userSpr[c][0],c,money_sprite1,floatstr(value),34.0,255,0,255,0);
            }
        }
        #endif
        #if DISPLAY_DOLLARSIGN
        drawsprite(userDSign[c],c,cash_sprite,1.0,34.0,255,0,255,0);
        #endif
        #if DISPLAY_ARROW
        drawsprite(userArrow[c],c,arrow_sprite,1.0,34.0,255,255,255,0);
        #endif
        #if DISPLAY_WEAPONS
        weapons = pev(c, pev_weapons);
      
        for(new i; i < sizeof Pistols; i++)
        if(weapons & 1<<floatround(Pistols[i])){
            drawsprite(userWeap[c][0],c,weap_sprite,Pistols[i],50.0,255,255,255,0);
            goto jmp1;
        }
        drawsprite(userWeap[c][0],c,weap_sprite,Pistols[0],50.0,0,255,255,0);
        jmp1:
      
        for(new i; i < sizeof Rifles; i++)
        if(weapons & 1<<floatround(Rifles[i])){
            drawsprite(userWeap[c][1],c,weap_sprite,Rifles[i],50.0,255,255,255,0);
            goto jmp2;
        }
        drawsprite(userWeap[c][1],c,weap_sprite,Rifles[0],50.0,0,255,255,0);
        jmp2:
      
        if(weapons & 1<<CSW_HEGRENADE)
        drawsprite(userWeap[c][2],c,weap_sprite,4.0,50.0,255,255,255,255);
        else
        drawsprite(userWeap[c][2],c,weap_sprite,4.0,50.0,0,255,255,255);
      
        if(weapons & 1<<CSW_FLASHBANG)
        drawsprite(userWeap[c][3],c,weap_sprite,25.0,50.0,255,255,255,255);
        else
        drawsprite(userWeap[c][3],c,weap_sprite,25.0,50.0,0,255,255,255);
      
        if(weapons & 1<<CSW_SMOKEGRENADE)
        drawsprite(userWeap[c][4],c,weap_sprite,9.0,50.0,255,255,255,255);
        else
        drawsprite(userWeap[c][4],c,weap_sprite,9.0,50.0,0,255,255,255);
      
        cs_get_user_armor(c,CsArmorType:armor);
        if(armor == 2)
        drawsprite(userWeap[c][5],c,weap2_sprite,2.0,50.0,255,0,0,255);
        else if(armor == 1)
        drawsprite(userWeap[c][5],c,weap2_sprite,1.0,50.0,255,0,0,255);
        else
        drawsprite(userWeap[c][5],c,weap2_sprite,1.0,50.0,0,0,0,255);
      
      
        if(weapons & 1<<CSW_C4)
        drawsprite(userWeap[c][6],c,weap2_sprite,3.0,50.0,255,0,0,255);
        else if(cs_get_user_defuse(c))
        drawsprite(userWeap[c][6],c,weap2_sprite,4.0,50.0,255,0,0,255);
        else
        drawsprite(userWeap[c][6],c,weap2_sprite,3.0,50.0,0,0,0,255);
      
        #endif
    }
}
 
drawsprite(ent,player,str[],Float:frame,Float:offset,render,r,g,b){
 
    set_pev(ent, pev_framerate, 1.0)
    set_pev(ent, pev_scale, 0.3)
    set_pev(ent, pev_movetype, MOVETYPE_NOCLIP);
    engfunc(EngFunc_SetModel, ent, str);
    set_pev(ent, pev_frame, frame)
 
 
    if(is_user_connected(player) && is_user_alive(player)){
        pev(player, pev_origin, userOrig[player]);
        userOrig[player][2] += offset;
        set_pev(ent, pev_origin, userOrig[player]);
    }
    else{
        set_pev(ent, pev_origin, {0.0, 0.0, 0.0})
    }
 
    if(!show){
        render = 0
        set_pev(ent, pev_origin, {0.0, 0.0, 0.0})
        remove_task(TASK2)
    }
 
    set_rendering(ent, kRenderFxNone, r, g, b, kRenderTransAdd, render)
 
}
 
Сообщения
165
Реакции
-8
у меня от этого плагина сервер начал лагать, фризы появились
 

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу