хорошо, я хотел бы добавить эти 2 команды
+ cl_show_team_equipment: показывает спрайты игрока всегда, пока вы не отключите команду
-cl_show_team_equipment: перестает отображать спрайты игроку и отображается только во время периода заморозки
и еще одна вещь, сервер отключается с этим плагином, потому что он будет
+ cl_show_team_equipment: показывает спрайты игрока всегда, пока вы не отключите команду
-cl_show_team_equipment: перестает отображать спрайты игроку и отображается только во время периода заморозки
и еще одна вещь, сервер отключается с этим плагином, потому что он будет
PHP:
/*################################################################################################
_______ _______ _______ _______ _________ _______ _______
( ____ \|\ /|( ___ )|\ /|( ____ \( ___ )|\ /|\__ __/( ____ )( ____ \
| ( \/| ) ( || ( ) || ) ( || ( \/| ( ) || ) ( | ) ( | ( )|| ( \/
| (_____ | (___) || | | || | _ | || (__ | | | || | | | | | | (____)|| (_____
(_____ )| ___ || | | || |( )| || __) | | | || | | | | | | _____)(_____ )
) || ( ) || | | || || || || ( | | /\| || | | | | | | ( ) |
/\____) || ) ( || (___) || () () || (____/\| (_\ \ || (___) |___) (___| ) /\____) |
\_______)|/ \|(_______)(_______)(_______/(____\/_)(_______)\_______/|/ \_______)
This is my take on the https://forums.alliedmods.net/showthread.php?t=306558 plugin.
The code is a bit suckish and uses a lot of entities but i'm too much n00b to do it a better way :P
The sprites stay until freezetime is over and then the entities get removed so maybe it wont
interfere with gameplay. Also the display_info task is removed when freezetime is over
so it should not consume much cpu after freeze. I hope so atleast...
If you want to disable displaying specific sprites:
#define DISPLAY_MONEY 0
#define DISPLAY_WEAPONS 0
#define DISPLAY_DOLLARSIGN 0
#define DISPLAY_ARROW 0
by DaniwA 2018
#################################################################################################*/
#include <amxmodx>
#include <fakemeta>
#include <engine>
#include <cstrike>
#define DISPLAY_MONEY 1
#define DISPLAY_WEAPONS 1
#define DISPLAY_DOLLARSIGN 1
#define DISPLAY_ARROW 1
#define PLUGIN "SHOWEQUIPS"
#define VERSION "1.4"
#define AUTHOR "DaniwA"
#if DISPLAY_MONEY
#define NUMBER_OF_SPRITES 5
new userSpr[33][NUMBER_OF_SPRITES];
new tmpstr[6];
new value[2];
#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;
#endif
#if DISPLAY_DOLLARSIGN
new userDSign[33];
#endif
#if DISPLAY_ARROW
new userArrow[33];
#endif
new bool:NewRound;
new Float:userOrig[33][3];
new iPlayers[32], count;
public plugin_precache(){
#if DISPLAY_MONEY
precache_model("sprites/10000.spr");
precache_model("sprites/1000.spr");
precache_model("sprites/100.spr");
precache_model("sprites/10.spr");
precache_model("sprites/1.spr");
#endif
#if DISPLAY_WEAPONS
precache_model("sprites/weap.spr");
precache_model("sprites/weap2.spr");
#endif
#if DISPLAY_DOLLARSIGN
precache_model("sprites/cash.spr");
#endif
#if DISPLAY_ARROW
precache_model("sprites/arrow.spr");
#endif
}
public plugin_init(){
register_plugin(PLUGIN,VERSION,AUTHOR);
NewRound = true;
register_event("HLTV", "event_new_round", "a", "1=0", "2=0");
}
public event_new_round(){
remove_task(9678);
remove_ents();
NewRound = true;
set_task(get_cvar_float("mp_freezetime"),"remove_ents",9678);
set_task(0.2,"display_info",4563,"",0,"b");
}
public remove_ents(){
remove_task(4563);
for(new i; i<33; i++){
#if DISPLAY_MONEY
for(new e; e<NUMBER_OF_SPRITES; e++)
if(userSpr[i][e])
remove_entity(userSpr[i][e]);
#endif
#if DISPLAY_WEAPONS
for(new e; e<NUMBER_OF_WEAPTYPES; e++)
if(userWeap[i][e])
remove_entity(userWeap[i][e]);
#endif
#if DISPLAY_DOLLARSIGN
if(userDSign[i])
remove_entity(userDSign[i]);
#endif
#if DISPLAY_ARROW
if(userArrow[i])
remove_entity(userArrow[i]);
#endif
}
}
public display_info(){
if (NewRound)
get_players(iPlayers, count, "ah");
for(new c; c<count; c++){
if(!is_user_alive(iPlayers[c]) || !is_user_connected(iPlayers[c]) || cs_get_user_team(iPlayers[c]) == CS_TEAM_SPECTATOR){
if(!NewRound){
#if DISPLAY_MONEY
drawsprite(userSpr[iPlayers[c]][4],iPlayers[c],"sprites/10000.spr",1.0,34.0,0,0,255,0);
drawsprite(userSpr[iPlayers[c]][3],iPlayers[c],"sprites/1000.spr",1.0,34.0,0,0,255,0);
drawsprite(userSpr[iPlayers[c]][2],iPlayers[c],"sprites/100.spr",1.0,34.0,0,0,255,0);
drawsprite(userSpr[iPlayers[c]][1],iPlayers[c],"sprites/10.spr",1.0,34.0,0,0,255,0);
drawsprite(userSpr[iPlayers[c]][0],iPlayers[c],"sprites/1.spr",1.0,34.0,0,0,255,0);
#endif
#if DISPLAY_DOLLARSIGN
drawsprite(userDSign[iPlayers[c]],iPlayers[c],"sprites/cash.spr",1.0,34.0,0,0,255,0);
#endif
#if DISPLAY_ARROW
drawsprite(userArrow[iPlayers[c]],iPlayers[c],"sprites/arrow.spr",1.0,34.0,0,255,255,0);
#endif
#if DISPLAY_WEAPONS
drawsprite(userWeap[iPlayers[c]][0],iPlayers[c],"sprites/weap.spr",Pistols[0],50.0,0,255,255,0);
drawsprite(userWeap[iPlayers[c]][1],iPlayers[c],"sprites/weap.spr",Rifles[0],50.0,0,255,255,0);
drawsprite(userWeap[iPlayers[c]][2],iPlayers[c],"sprites/weap.spr",4.0,50.0,0,255,255,255);
drawsprite(userWeap[iPlayers[c]][3],iPlayers[c],"sprites/weap.spr",25.0,50.0,0,255,255,255);
drawsprite(userWeap[iPlayers[c]][4],iPlayers[c],"sprites/weap.spr",9.0,50.0,0,255,255,255);
drawsprite(userWeap[iPlayers[c]][5],iPlayers[c],"sprites/weap2.spr",1.0,50.0,0,0,0,255);
drawsprite(userWeap[iPlayers[c]][6],iPlayers[c],"sprites/weap2.spr",3.0,50.0,0,0,0,255);
#endif
}
continue;
}
if (NewRound){
#if DISPLAY_MONEY
for(new i; i<NUMBER_OF_SPRITES; i++)
userSpr[iPlayers[c]][i]=create_entity("env_sprite");
#endif
#if DISPLAY_WEAPONS
for(new i; i<NUMBER_OF_WEAPTYPES; i++)
userWeap[iPlayers[c]][i]=create_entity("env_sprite");
#endif
#if DISPLAY_DOLLARSIGN
userDSign[iPlayers[c]]=create_entity("env_sprite");
#endif
#if DISPLAY_ARROW
userArrow[iPlayers[c]]=create_entity("env_sprite");
#endif
}
#if DISPLAY_MONEY
for (new x; x < NUMBER_OF_SPRITES; x++){
arrayset(tmpstr, 0, sizeof tmpstr);
num_to_str(cs_get_user_money(iPlayers[c]), tmpstr, charsmax(tmpstr))
value[0]=tmpstr[x];
value[1]=0;
if(!tmpstr[x]){
switch(x){
case 0: drawsprite(userSpr[iPlayers[c]][4],iPlayers[c],"sprites/10000.spr",1.0,34.0,0,0,255,0);
case 1: drawsprite(userSpr[iPlayers[c]][3],iPlayers[c],"sprites/1000.spr",1.0,34.0,0,0,255,0);
case 2: drawsprite(userSpr[iPlayers[c]][2],iPlayers[c],"sprites/100.spr",1.0,34.0,0,0,255,0);
case 3: drawsprite(userSpr[iPlayers[c]][1],iPlayers[c],"sprites/10.spr",1.0,34.0,0,0,255,0);
case 4: drawsprite(userSpr[iPlayers[c]][0],iPlayers[c],"sprites/1.spr",1.0,34.0,0,0,255,0);
}
continue;
}
switch(x){
case 0: drawsprite(userSpr[iPlayers[c]][4],iPlayers[c],"sprites/10000.spr",floatstr(value),34.0,255,0,255,0);
case 1: drawsprite(userSpr[iPlayers[c]][3],iPlayers[c],"sprites/1000.spr",floatstr(value),34.0,255,0,255,0);
case 2: drawsprite(userSpr[iPlayers[c]][2],iPlayers[c],"sprites/100.spr",floatstr(value),34.0,255,0,255,0);
case 3: drawsprite(userSpr[iPlayers[c]][1],iPlayers[c],"sprites/10.spr",floatstr(value),34.0,255,0,255,0);
case 4: drawsprite(userSpr[iPlayers[c]][0],iPlayers[c],"sprites/1.spr",floatstr(value),34.0,255,0,255,0);
}
}
#endif
#if DISPLAY_DOLLARSIGN
drawsprite(userDSign[iPlayers[c]],iPlayers[c],"sprites/cash.spr",1.0,34.0,255,0,255,0);
#endif
#if DISPLAY_ARROW
drawsprite(userArrow[iPlayers[c]],iPlayers[c],"sprites/arrow.spr",1.0,34.0,255,255,255,0);
#endif
#if DISPLAY_WEAPONS
weapons = pev(iPlayers[c], pev_weapons);
for(new i; i < sizeof Pistols; i++)
if(weapons & 1<<floatround(Pistols[i])){
drawsprite(userWeap[iPlayers[c]][0],iPlayers[c],"sprites/weap.spr",Pistols[i],50.0,255,255,255,0);
goto jmp1;
}
drawsprite(userWeap[iPlayers[c]][0],iPlayers[c],"sprites/weap.spr",Pistols[0],50.0,0,255,255,0);
jmp1:
for(new i; i < sizeof Rifles; i++)
if(weapons & 1<<floatround(Rifles[i])){
drawsprite(userWeap[iPlayers[c]][1],iPlayers[c],"sprites/weap.spr",Rifles[i],50.0,255,255,255,0);
goto jmp2;
}
drawsprite(userWeap[iPlayers[c]][1],iPlayers[c],"sprites/weap.spr",Rifles[0],50.0,0,255,255,0);
jmp2:
if(weapons & 1<<CSW_HEGRENADE)
drawsprite(userWeap[iPlayers[c]][2],iPlayers[c],"sprites/weap.spr",4.0,50.0,255,255,255,255);
else
drawsprite(userWeap[iPlayers[c]][2],iPlayers[c],"sprites/weap.spr",4.0,50.0,0,255,255,255);
if(weapons & 1<<CSW_FLASHBANG)
drawsprite(userWeap[iPlayers[c]][3],iPlayers[c],"sprites/weap.spr",25.0,50.0,255,255,255,255);
else
drawsprite(userWeap[iPlayers[c]][3],iPlayers[c],"sprites/weap.spr",25.0,50.0,0,255,255,255);
if(weapons & 1<<CSW_SMOKEGRENADE)
drawsprite(userWeap[iPlayers[c]][4],iPlayers[c],"sprites/weap.spr",9.0,50.0,255,255,255,255);
else
drawsprite(userWeap[iPlayers[c]][4],iPlayers[c],"sprites/weap.spr",9.0,50.0,0,255,255,255);
cs_get_user_armor(iPlayers[c],CsArmorType:armor);
if(armor == 2)
drawsprite (userWeap [iPlayers [c]] [5], iPlayers [c], "sprites / ring2.spr", 2.0,50.0,255,0,0,255);
si no (armadura == 1)
drawsprite (userWeap [iPlayers [c]] [5], iPlayers [c], "sprites / ring2.spr", 1.0,50.0,255,0,0,255);
otra cosa
drawsprite (userWeap [iPlayers [c]] [5], iPlayers [c], "sprites / ring2.spr", 1.0,50.0,0,0,0,0,255);
si (armas y 1 << CSW_C4)
drawsprite (userWeap [iPlayers [c]] [6], iPlayers [c], "sprites / ring2.spr", 3.0,50.0,255,0,0,255);
else if (cs_get_user_defuse (iPlayers [c]))
drawsprite (userWeap [iPlayers [c]] [6], iPlayers [c], "sprites / ring2.spr", 4.0,50.0,255,0,0,255);
otra cosa
drawsprite (userWeap [iPlayers [c]] [6], iPlayers [c], "sprites / ring2.spr", 3.0,50.0,0,0,0,0,255);
#endif
}
NewRound = falso;
}
drawsprite (ent, player, str [], float: frame, float: offset, render, r, g, b) {
// if (! is_user_alive (player) ||! is_user_connected (player) || cs_get_user_team (player) == CS_TEAM_SPECTATOR)
// return;
if (NewRound) {
engfunc (EngFunc_SetModel, ent, str);
set_pev (ent, pev_movetype, MOVETYPE_NOCLIP);
set_pev (ent, pev_framerate, 1.0)
set_pev (ent, pev_scale, 0.3)
}
set_pev (ent, pev_frame, frame)
set_rendering (ent, kRenderFxNone, r, g, b, kRenderTransAdd, render)
pev (jugador, pev_origin, userOrig [jugador]);
userOrig [jugador] [2] + = desplazamiento;
set_pev (ent, pev_origin, userOrig [player]);
}
[/ php]