Разработчик
Скриптер
Проверенный
- Сообщения
- 2,751
- Реакции
- 3,016
- Помог
- 61 раз(а)
set_entvar(iWeaponBox, var_movetype, MOVETYPE_NONE);
set_entvar(iWeaponBox, varr_viewmodel, NULL_STRING); // по желанию, можешь туже пушку поставить для сравнения
fCopyCorpse
? Почему он не bool по венгерской нотации?!void respawn(entvars_t *pev, BOOL fCopyCorpse = FALSE);
void respawn(entvars_t *pev, BOOL fCopyCorpse)
{
if (gpGlobals->coop || gpGlobals->deathmatch)
{
if (CSGameRules()->m_iTotalRoundsPlayed > 0)
CSGameRules()->MarkSpawnSkipped();
CBasePlayer *pPlayer = GetClassPtr<CCSPlayer>((CBasePlayer *)pev);
if (CSGameRules()->IsCareer() && CSGameRules()->ShouldSkipSpawn() && pPlayer->IsAlive())
g_skipCareerInitialSpawn = true;
pPlayer->Spawn();
g_skipCareerInitialSpawn = false;
}
else if (pev->deadflag > DEAD_NO)
{
SERVER_COMMAND("reload\n");
}
}
// called by ClientKill and DeadThink
void respawn(entvars_t* pev, BOOL fCopyCorpse)
{
if (gpGlobals->coop || gpGlobals->deathmatch)
{
if ( fCopyCorpse )
{
// make a copy of the dead body for appearances sake
CopyToBodyQue(pev);
}
// respawn player
GetClassPtr( (CBasePlayer *)pev)->Spawn( );
}
else
{ // restart the entire server
SERVER_COMMAND("reload\n");
}
}
// make a body que entry for the given ent so the ent can be respawned elsewhere
// GLOBALS ASSUMED SET: g_eoBodyQueueHeadstion
void CopyToBodyQue(entvars_t *pev)
{
#if 0
if (pev->effects & EF_NODRAW)
return;
entvars_t *pevHead = VARS(g_pBodyQueueHead);
pevHead->angles = pev->angles;
pevHead->model = pev->model;
pevHead->modelindex = pev->modelindex;
pevHead->frame = pev->frame;
pevHead->colormap = pev->colormap;
pevHead->movetype = MOVETYPE_TOSS;
pevHead->velocity = pev->velocity;
pevHead->flags = 0;
pevHead->deadflag = pev->deadflag;
pevHead->renderfx = kRenderFxDeadPlayer;
pevHead->renderamt = ENTINDEX(ENT(pev));
pevHead->effects = pev->effects | EF_NOINTERP;
pevHead->sequence = pev->sequence;
pevHead->animtime = pev->animtime;
UTIL_SetOrigin(pevHead, pev->origin);
UTIL_SetSize(pevHead, pev->mins, pev->maxs);
g_pBodyQueueHead = pevHead->owner;
#endif
}
Почему он не bool по венгерской нотации?!
#include <amxmodx>
#include <hamsandwich>
public plugin_init()
{
register_srvcmd("fkb_add_gift", "CMD_AddGift");
RegisterHam(Ham_Spawn, "player", "CBasePlayer_Spawn", .Post = true);
}
// For tests
public CBasePlayer_Spawn(id)
{
if(g_iArraySize_Items != 0)
{
GiveAGift(id);
}
}
enum Gift_Type_s
{
_money,
_item,
_health,
_armor,
}
enum _:Item_s
{
Gift_Type_s: Type,
Name[32],
Count
}
new Array: g_aItems, g_iArraySize_Items;
public CMD_AddGift()
{
new args_count = read_argc();
if(args_count < 1)
{
return;
}
if(!g_aItems) g_aItems = ArrayCreate(Item_s);
enum _:args { arg_cmd , arg_name, arg_item, arg_count };
new szArgs[args][32];
for(new iArg; iArg < sizeof szArgs; iArg++)
{
read_argv(iArg, szArgs[iArg], charsmax(szArgs[]));
}
new Gift_Type_s: iType = GetGiftType(szArgs[arg_name]);
if(_:iType == -1)
{
log_amx("[WARN]: Undefinded gift type: '%s'", szArgs[arg_name]);
return;
}
new ItemArray[Item_s];
ItemArray[Type] = iType;
ItemArray[Name] = szArgs[arg_name];
ItemArray[Count] = szArgs[arg_count];
g_iArraySize_Items = ArraySize(g_aItems);
}
Gift_Type_s: GetGiftType(szName[])
{
if(!strcmp("money", szName))
return _money;
if(!strcmp("item", szName))
return _item;
if(!strcmp("health", szName))
return _health;
if(!strcmp("armor", szName))
return _armor;
return -1;
}
GiveAGift(id)
{
item = random_num(0, g_iArraySize_Items);
}
// CFG
// fkb_add_gift "money" "500"
// fkb_add_gift "money" "1500"
//
// fkb_add_gift "item "weapon_awp"
// fkb_add_gift "item" "weapon_ak47"
// fkb_add_gift "item" "weapon_hegrenade"
// fkb_add_gift "item" "weapon_smokegrenade"
// fkb_add_gift "item" "item_longjump"
//
// fkb_add_gift "health" "50"
// fkb_add_gift "health" "10"
//
// fkb_add_gift "armor" "15"
//
// fkb_minplayers "4"
// fkb_maxHP "100"