Администратор
- Сообщения
- 3,023
- Реакции
- 1,731
- Помог
- 79 раз(а)
- Ошибка
-
money_frag_counter.sma(40) : error 020: invalid symbol name ""
- Компилятор
- Локальный
- Amx Mod X
- 1.9.0
- Исходный код
-
/**
* Simple plugin to use HUD money as frag counter.
*
* Home post:
* http://c-s.net.ua/forum/index.php?act=findpost&pid=872122
*
* Last update:
* 12/16/2015
*/
/* Copyright 2015 Safety1st
'Money as Frag Counter' is free software;
you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#define PLUGIN "Money as Frag Counter"
#define VERSION "0.1"
#define AUTHOR "Safety1st"
const PDATA_SAFE = 2
const m_iHideHUD = 361
const m_iClientHideHUD = 362
const HIDEHUD_MONEY = 1<<5
const MAX_CLIENTS = 32
new giFrags[MAX_CLIENTS + 1]
new giMsgMoney
public plugin_init() {
register_plugin( PLUGIN, VERSION, AUTHOR )
giMsgMoney = get_user_msgid( "Money" )
set_msg_block( giMsgMoney, BLOCK_SET )
register_event( "DeathMsg", "Event_DeathMessage", "a", "1!0" ) // killed by a player ('1')
RegisterHam( Ham_Spawn, "player", "OnCBasePlayer_Spawn_Post", .Post = 1 )
}
public client_putinserver(id) {
giFrags[id] = 0
// to hide money from client's HUD when entering to a game
if( pev_valid(id) == PDATA_SAFE )
// must have check for bots, for safety for players
set_pdata_int( id, m_iHideHUD, get_pdata_int( id, m_iHideHUD ) | HIDEHUD_MONEY )
}
public OnCBasePlayer_Spawn_Post(id) {
if( is_user_alive(id) )
SendMoneyMsg( id, giFrags[id] = 0, .flag = 0 )
}
public Event_DeathMessage() {
const KillerID = 1
const VictimID = 2
new iKiller = read_data(KillerID)
new iVictim = read_data(VictimID)
if( iKiller != iVictim /* except suicides; BTW death due to amx_slay is a suicide too */ )
SendMoneyMsg( iKiller, ++giFrags[iKiller], .flag = 1 )
}
stock SendMoneyMsg( player, money, flag ) {
// if 'flag' = 1 then display the additional new-old amount difference
message_begin( MSG_ONE_UNRELIABLE, giMsgMoney, _, player )
write_long(money)
write_byte(flag)
message_end()
}
на 1.8.2, 1.8.3 компилируется, на 190 нет
В этой теме было размещено решение! Перейти к решению.
Вложения
-
2.5 KB Просмотры: 379