Исправить/добавить код на проверку игрок

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
41
Реакции
7
Основная информация

Проблема: Исправить/добавить код на проверку игрок

Ошибка:
L 05/22/2017 - 05:21:38: [HAMSANDWICH] Invalid player 2 (not in-game)
L 05/22/2017 - 05:21:38: [AMXX] Displaying debug trace (plugin "vip_custom.amxx")
L 05/22/2017 - 05:21:38: [AMXX] Run time error 10: native error (native "get_pdata_cbase")
L 05/22/2017 - 05:21:38: [AMXX] [0] vip_custom.sma::refill (line 903)
L 05/22/2017 - 05:21:38: [AMXX] [1] vip_custom.sma::GiveItem (line 596)
Дополнительная информация

Amx Mod X: 1.8.2

Билд:
Код:
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.0.0.414-dev
Build date: 22:04:20 Feb 4 2017 (1029)


ReGamedll:
Код:
ReGameDLL version: 5.2.0.176-dev
Build date: 09:55:00 Feb 3 2017


Список модулей:
PHP:
[ 1] CStrike                 1.8.2       AMX Mod X Dev Team   running
[ 2] ReAPI 5.1.0.103- Asmodai & s1lent running
[ 3] dummy_csx 1.0 AGHL.RU Dev Team running
[ 4] ReAimDetector 0.1.6 ReHLDS Team running
[ 5] Ham Sandwich 1.8.2 AMX Mod X Dev Team running
[ 6] FakeMeta 1.8.2 AMX Mod X Dev Team running
[ 7] MySQL 1.8.2 AMX Mod X Dev Team running
[ 8] Engine 1.8.2 AMX Mod X Dev Team running
[ 9] Fun 1.8.2 AMX Mod X Dev Team running
[10] Sockets 1.8.2 HLSW Dev Team running
10 modules, 10 correct


Список плагинов:
HTML:
[  1] Admin Loader            2.5.2       neygomon          admin_loader_fo  running
[ 2] FreshBans 1.3.6 kanagava fresh_bans.amxx running
[ 3] DopBan 2.8.2b kanagava dop_ban2.amxx running
[ 4] ReAimDetector API 0.1.6 ReHLDS Team reaimdetector.a running
[ 5] fb_forwards 0.1.5 Kanagava & Realu fb_forwards.amx running
[ 6] CSStatsX SQL 0.7.4 serfreeman1337 csstatsx_sql.am debug
[ 7] AES: StatsX 0.5 Vega serfreeman1337 aes_statsx_cstr debug
[ 8] Advanced Experience Sy 0.5 Vega serfreeman1337 aes_main.amxx running
[ 9] AES: CStrike Addon 0.5 Vega serfreeman1337 aes_exp_cstrike running
[ 10] AES: Informer 0.5 Vega serfreeman1337 aes_informer.am running
[ 11] AES: Bonus CSTRIKE 0.5 Vega serfreeman1337 aes_bonus_cstri running
[ 12] AES: Bonus System 0.5 Vega serfreeman1337 aes_bonus_syste running
[ 13] Stats Configuration 1.8.2 AMXX Dev Team statscfg.amxx running
[ 14] Advanced Gag 1.7.0 neygomon amx_gag.amxx running
[ 15] Advanced MapChooser 1.1.0 neygomon map_chooser.amx running
[ 16] Say me and Say hp 1.4 neygomon sayme.amxx running
[ 17] Map Spawns Editor 1.0.16 iG_os map_spawns_edit running
[ 18] Menus Front-End 1.5 untest neugomon menufront_end.a running
[ 19] Admin Commands 1.8.2 AMXX Dev Team admincmd.amxx running
[ 20] Maps Menu 1.8.2 AMXX Dev Team mapsmenu.amxx running
[ 21] Admin Votes 1.9 [Sib.net] adminvote.amxx running
[ 22] Restrict Weapons 1.8.2 AMXX Dev Team restmenu.amxx running
[ 23] [ReAPI] Custom Models 1.6.1 neugomon custom_models.a running
[ 24] Night VIPs Private Racoon night_vips.amxx running
[ 25] Lite Admin ESP 1.0 neygomon admin_espall.am running
[ 26] Advert Messages 1.22 neygomon adverts.amxx running
[ 27] KiLL Assist poka_4to_b PRoSToTeM@ Kill_assist_rea running
[ 28] Lite Recoder 1.0.1 neygomon amx_demorec_3.a running
[ 29] Dead DHUD Advertising 0.1a Subb98 dhuds.amxx running
[ 30] [reAPI] Flash Control 1.1 neugomon flash_control.a running
[ 31] Players Menu 1.7 neugomon players_menu.am running
[ 32] [ReAPI] Lite TeamBalan 2.3 neugomon lite_balancer_2 running
[ 33] Ping Control 1.31 neygomon Ping_Control.am running
[ 34] FM ResetScore 0.1 neygomon fm_rs.amxx running
[ 35] Block grande info 1.0 neygomon BlockGrenadeInf running
[ 36] Steam Bonus 1.9b neygomon and Aci Steam_Bonus.amx running
[ 37] AFK Control 1.4.1 [Rnd neygomon afk_control.amx running
[ 38] Block HudTextArgs 1.0 ConnorMcLeod hud_blocker.amx running
[ 39] GameName Changer 1.0 neugomon gamename_change running
[ 40] AWP limitter 1.03 neygomon awp_limitter.am running
[ 41] Show Damage 1.0 neygomon damager.amxx running
[ 42] C4 Timer on roundtime 0.3.3a neygomon c4timer.amxx running
[ 43] Player Lists 2.1 Safety1st player_lists.am running
[ 44] Kill's Like CS Online 0.1 fl0wer kills_like_cso. running
[ 45] Blue Screen 1.2 Stimul bluecskin.amxx running
[ 46] Server Menu [INI] 1.0 vk.com/perec_cs server_menu.amx running
[ 47] Mode 2x2 2.5re s1lent mode.amxx running
[ 48] V.I.P Custom Weapons 1.0.0 Vaqtincha vip_custom.amxx debug
[ 49] V.I.P Custom AK-47 1.0.0 Vaqtincha custom_ak47.amx running
[ 50] V.I.P Custom AWP 1.0.0 Vaqtincha custom_awp.amxx running
[ 51] V.I.P Custom DEAGLE 1.0.0 Vaqtincha custom_deagle.a running
[ 52] V.I.P Custom KNIFE 1.0.0 Vaqtincha custom_knife.am running
[ 53] V.I.P Custom M4A1 1.0.0 Vaqtincha custom_m4a1.amx running
[ 54] Chat Manager 1.1.1-11 Mistrick chatmanager.amx running
54 plugins, 54 running


Список метамодулей:
PHP:
[ 1] Reunion          RUN   -    reunion.so        v0.1.75   ini   Start Never
[ 2] SafeNameAndChat RUN - SafeNameAndChat. v1.1 ini ANY
[ 3] ReAuthCheck RUN - reauthcheck_mm_i v0.1.6 ini Start Never
[ 4] ReSemiclip RUN - resemiclip_mm_i3 v2.3.9 ini ANY
[ 5] VoiceTranscoder RUN - VoiceTranscoder. v2017 RC ini ANY
[ 6] Rechecker RUN - rechecker_mm_i38 v2.3 ini ANY
[ 7] AMX Mod X RUN - amxmodx.so v1.8.2 ini Start ANY
[ 8] CStrike RUN - cstrike_amxx_i38 v1.8.2 pl7 ANY
[ 9] ReAPI RUN - reapi_amxx_i386. v5.1.0.1 pl7 ANY Never
[10] ReAimDetector RUN - reaimdetector_am v0.1.6 pl7 ANY Never
[11] Ham Sandwich RUN - hamsandwich_amxx v1.8.2 pl7 ANY
[12] FakeMeta RUN - fakemeta_amxx_i3 v1.8.2 pl7 ANY
[13] MySQL RUN - mysql_amxx_i386. v1.8.2 pl7 ANY
[14] Engine RUN - engine_amxx_i386 v1.8.2 pl7 ANY
[15] Fun RUN - fun_amxx_i386.so v1.8.2 pl7 ANY
15 plugins, 15 running


Исходник:
Код:
// Copyright © 2015 Vaqtincha

/************************ V.I.P Custom Weapons *************************
*
* Last update:
* 05/12/2015
*
* Cmds:
* weaponmenu or (say /vipmenu) - Free guns menu
*
* Credits:
* - Safety1st - for plugin "Weapon Menu Hardcoded" (edited by me)
* - Eg@r4$il - for plugin "Admins are VIPs + grenades + kevlar" (edited by me)
* - ZETA [M|E|N] - for plugin "VSVipPrefix"
* - xPaw - for code "ScoreBoard "VIP" string"
* - ConnorMcLeod for plugin "Bullet Damage" and cstrike_pdatas
* - Subb98 for plugin "No fall damage"
* - MrBone - for pieces of advice
* - Patriot~ua~ - for ideas and testing
* - c-s.net.ua members
*
***********************************************************************/

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta>

#define PLUGIN_NAME "V.I.P Custom Weapons"
#define PLUGIN_VERSION "1.0.0"
#define PLUGIN_AUTHOR "Vaqtincha"

// macro; %1 - variable being modified, %2 - player id
#define CheckFlag(%1,%2) (%1 & (1 << (%2 & 31)))
#define SetFlag(%1,%2) (%1 |= (1 << (%2 & 31)))
#define ClearFlag(%1,%2) (%1 &= ~(1 << (%2 & 31)))

#define SetFlagConnected(%1) g_bConnected |= 1<<(%1 & 31)
#define ClearFlagConnected(%1) g_bConnected &= ~( 1<<(%1 & 31))
#define UserConnected(%1) (g_bConnected & 1<<(%1 & 31))

#define cs_get_user_hasprim(%1,%2) (get_pdata_cbase(%1, m_rgpPlayerItems_CBasePlayer[%2])>0)
#define fm_get_user_money(%1) get_pdata_int(%1, m_iAccount, XO_PLAYER)
#define fm_get_weapon_id(%1) get_pdata_int(%1, m_iId, XO_WEAPON)
#define fm_set_weapon_ammo(%1,%2) set_pdata_int(%1, m_iClip, %2, XO_WEAPON)

#if AMXX_VERSION_NUM < 183
#define HasShield(%1) (get_pdata_int(%1, m_iUserPrefs, XO_PLAYER) & m_bHasShield)
#else
#define HasShield(%1) get_pdata_bool(%1, m_bHasShield)
#endif

#define MAX_PLAYERS 32
#define IsPlayer(%1) ( 1 <= %1 <= g_iMaxPlayers )

#define ITEM_DEAGLE (1<<0)
#define ITEM_HE (1<<1)
#define ITEM_SMOKE (1<<2)
#define ITEM_FLASH (1<<3)
#define ITEM_AMMO (1<<4)
#define ITEM_ARMOR (1<<5)
#define ITEM_DEFUSER (1<<6)

new Trie:vipChannels
new g_iAlive[MAX_PLAYERS+1]
new bool:g_bAccess[MAX_PLAYERS+1]
new g_iPlayerPos[MAX_PLAYERS+1]
new g_iPlayerCol[MAX_PLAYERS+1]
new gbIsUsed, giCounter, g_bConnected, g_iMaxPlayers, target_map

new g_iKNFPluginId, g_iDGLPluginId, g_iM4A1PluginId, g_iAK47PluginId, g_iAWPPluginId
new g_iDGLGive, g_iM4A1Give, g_iAK47Give, g_iAWPGive
new g_iKNFReload, g_iDGLReload, g_iM4A1Reload, g_iAK47Reload, g_iAWPReload

new alw_round_eq, alw_round_fm, alw_round_m4ak, alw_round_awp, alw_round_buy
new vampire, vampire_max, hp_bonus, hp_bonus_hs, item_flags, delay, damager, droptype
new dmgcolors[3], scrtag, prefix, info, remove_limit, openmenu, nofall, recieved
new dglcost, m4cost, akcost, awpcost
static flagaccess, buyaccess

// Offsets
new const m_rgpPlayerItems_CBasePlayer[6] = {367, 368, ...}
#if AMXX_VERSION_NUM < 183
const m_bHasShield = 1<<24
const m_iUserPrefs = 510
#else
const m_bHasShield = 2043
#endif
const m_pNext = 42
const m_iClip = 51
const m_iId = 43
const XO_PLAYER = 5
const XO_WEAPON = 4
#if cellbits == 32
const m_iAccount = 115
#else
const m_iAccount = 140
#endif

const MENUKEYS = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4
|MENU_KEY_5|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8|MENU_KEY_9|MENU_KEY_0
const KEY_EXIT = 10

const PRIMARY_WEAPONS_BIT_SUM = 1<<CSW_SCOUT|1<<CSW_XM1014|1<<CSW_MAC10|1<<CSW_AUG|1<<CSW_UMP45
|1<<CSW_SG550|1<<CSW_GALIL|1<<CSW_FAMAS|1<<CSW_AWP|1<<CSW_MP5NAVY|1<<CSW_M249|1<<CSW_M3
|1<<CSW_M4A1|1<<CSW_TMP|1<<CSW_G3SG1|1<<CSW_SG552|1<<CSW_AK47|1<<CSW_P90

const SECONDARY_WEAPONS_BIT_SUM = 1<<CSW_P228|1<<CSW_ELITE|1<<CSW_FIVESEVEN|1<<CSW_USP|1<<CSW_GLOCK18|1<<CSW_DEAGLE

const NOCLIP_WPN_BS = ((1<<CSW_HEGRENADE)|(1<<CSW_SMOKEGRENADE)|(1<<CSW_FLASHBANG)|(1<<CSW_KNIFE)|(1<<CSW_C4))

// Max BP ammo for weapons
new const MAXBPAMMO[31] = { -1, 52, -1, 90, 1, 32, 1, 100, 90, 1, 120, 100, 100, 90,
90, 90, 100, 120, 30, 120, 200, 32, 90, 120, 90, 2, 35, 90, 90, -1, 100
}
// Max clip for weapons
new const MAXCLIP[CSW_P90+1] = { -1, 13, -1, 10, 1, 7, 1, 30, 30, 1, 30, 20, 25, 30,
35, 25, 12, 20, 10, 30, 100, 8, 30, 30, 20, 2, 7, 30, 30, -1, 50
}
// Ammo Type Names for weapons
new const AMMOTYPE[][] = { "", "357sig", "", "762nato", "", "buckshot", "", "45acp", "556nato",
"", "9mm", "57mm", "45acp", "556nato", "556nato", "556nato", "45acp", "9mm", "338magnum", "9mm",
"556natobox","buckshot", "556nato", "9mm", "762nato", "", "50ae", "556nato", "762nato", "", "57mm"
}

new const Float:g_flCoords[][] = { {0.50, 0.40},{0.56, 0.44},{0.60, 0.50},
{0.56, 0.56},{0.50, 0.60},{0.44, 0.56},{0.40, 0.50},{0.44, 0.44}
}

new const g_iColors[][] = { {0, 127, 255},/*blue*/{255, 127, 0},/*orange*/
{127, 0, 255},/*purple*/{0, 255, 0},/*green*/{255, 24, 119},/*pink*/
{228, 228, 228},/*gray*/{165, 42, 42},/*brown*/{255, 255, 0}/*yellow*/
}

new channels[8][] = {
"#Cstrike_Chat_CT","#Cstrike_Chat_T","#Cstrike_Chat_CT_Dead","#Cstrike_Chat_T_Dead",
"#Cstrike_Chat_Spec","#Cstrike_Chat_All","#Cstrike_Chat_AllDead","#Cstrike_Chat_AllSpec"
}

new newChannels[8][] = {
"^4(^1Counter-Terrorist^4) [^3V.I.P^4] ^3%s1^1 : ^4%s2",
"^4(^1Terrorist^4) [^3V.I.P^4] ^3%s1^1 : ^4%s2",
"^1*DEAD*^4(^1Counter-Terrorist^4) [^3V.I.P^4] ^3%s1^1 : ^4%s2",
"^1*DEAD*^4(^1Terrorist^4) [^3V.I.P^4] ^3%s1^1 : ^4%s2",
"^4(^1Spectator^4) [^3V.I.P^4] ^3%s1^1 : ^4%s2",
"^4[^3V.I.P^4] ^3%s1^1 : ^4%s2",
"^1*DEAD* ^4[^3V.I.P^4] ^3%s1^1 : ^4%s2",
"^1*SPEC* ^4[^3V.I.P^4] ^3%s1^1 : ^4%s2"
}


public plugin_init()
{
new mapname[4]
get_mapname(mapname, charsmax(mapname))
if(equali(mapname, "de_") || equali(mapname, "cs_"))
{
target_map = true
}

register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
register_cvar("vip_custom_version", PLUGIN_VERSION, FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY)
register_concmd("vip_custom_reloadcfg", "cmdReloadCfg", ADMIN_CFG)
register_dictionary ("vip_custom.txt" )
loadconfig()
g_iMaxPlayers = get_maxplayers()

RegisterHam(Ham_Spawn, "player", "playerspawn_post", 1)
RegisterHam(Ham_Killed, "player", "playerkilled_post", 1)

if(nofall) RegisterHam(Ham_TakeDamage, "player", "HamTakeDamagePlayerPre", 0)
if(scrtag) register_message( get_user_msgid("ScoreAttrib"), "msgScoreAttrib" )
if(damager) register_event("Damage", "Event_Damage", "b", "2>0", "3=0")
if(prefix)
{
vipChannels = TrieCreate()
for (new i = 0; i < 8; i++)
{
TrieSetString(vipChannels, channels, newChannels)
}
register_message(get_user_msgid("SayText"), "messageSayText")
}
if(target_map)
{
// Cmds
register_clcmd( "weaponmenu", "MenuCommand" )
register_clcmd( "say /vipmenu", "MenuCommand" )
// Menu
register_menucmd( register_menuid( "WeaponMenu" ),MENUKEYS, "MenuHandler" )
register_menucmd( register_menuid( "BuyMenu" ),MENUKEYS, "MenuHandlerCustom" )
// Events
register_event( "HLTV", "Event_NewRound", "a", "1=0", "2=0" )
register_event( "TextMsg", "Event_NewGame", "a", "2=#Game_will_restart_in", "2=#Game_Commencing" )
if(vampire) register_event( "DeathMsg", "Event_DeathMsg", "a")
if(remove_limit) register_event( "BarTime", "event_bomb_planting", "be", "1=3")
}
}

public cmdReloadCfg(id, level, cid)
{
if (!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED

set_task(0.2, "delayed_load")
return PLUGIN_HANDLED
}

public delayed_load()
{
item_flags = 0
loadconfig()
if( g_iKNFPluginId > 0 && g_iKNFReload > 0)
{
callfunc_begin_i(g_iKNFReload, g_iKNFPluginId)
callfunc_end()
}
if( g_iDGLPluginId > 0 && g_iDGLReload > 0)
{
callfunc_begin_i(g_iDGLReload, g_iDGLPluginId)
callfunc_end()
}
if(g_iM4A1PluginId > 0 && g_iM4A1Reload > 0)
{
callfunc_begin_i(g_iM4A1Reload, g_iM4A1PluginId)
callfunc_end()
}
if(g_iAK47PluginId > 0 && g_iAK47Reload > 0)
{
callfunc_begin_i(g_iAK47Reload, g_iAK47PluginId)
callfunc_end()
}
if(g_iAWPPluginId > 0 && g_iAWPReload > 0)
{
callfunc_begin_i(g_iAWPReload, g_iAWPPluginId)
callfunc_end()
}
}

public loadconfig()
{
new ConfigFile[64], szMsg[128] // "addons/amxmodx/configs/vip_custom.ini" 37
get_localinfo("amxx_configsdir", ConfigFile, charsmax(ConfigFile))
add(ConfigFile, charsmax(ConfigFile), "/vip_custom.ini")
if( !file_exists(ConfigFile) )
{
formatex( szMsg, charsmax(szMsg), "%s Config File Not Found!", PLUGIN_NAME )
set_fail_state(szMsg)
return
}

new fp = fopen(ConfigFile, "rt")
if( fp )
{
new Datas[86], Setting[32], Value[15]
while( !feof(fp) )
{
fgets(fp, Datas, charsmax(Datas))
trim(Datas)
if(!Datas[0] || Datas[0] == ';' || Datas[0] == '#' || Datas[0] == '/' || Datas[0] == '[')
{
continue
}
new Sign[3]
parse(Datas, Setting, charsmax(Setting), Sign, charsmax(Sign), Value, charsmax(Value))
if( equali(Setting, "flag_access"))
{
flagaccess = read_flags(Value)
}else if( equali(Setting, "buy_access")){
buyaccess = read_flags(Value)
}else if( equali(Setting, "give_item_flags"))
{
if (containi(Value, "p") != -1)
{
item_flags |= ITEM_DEAGLE
}
if (containi(Value, "h") != -1)
{
item_flags |= ITEM_HE
}
if (containi(Value, "s") != -1)
{
item_flags |= ITEM_SMOKE
}
if (containi(Value, "f") != -1)
{
item_flags |= ITEM_FLASH
}
if (containi(Value, "a") != -1)
{
item_flags |= ITEM_AMMO
}
if (containi(Value, "v") != -1)
{
item_flags |= ITEM_ARMOR
}
if (containi(Value, "d") != -1)
{
item_flags |= ITEM_DEFUSER
}
}else if( equali(Setting, "allowed_round_equip")){
alw_round_eq = str_to_num(Value)
}else if( equali(Setting, "vip_tag")){
scrtag = str_to_num(Value) ? true : false
}else if( equali(Setting, "vip_prefix")){
prefix = str_to_num(Value) ? true : false
}else if( equali(Setting, "vip_info")){
info = str_to_num(Value) ? true : false
}else if( equali(Setting, "drop_type")){
droptype = str_to_num(Value)
}else if( equali(Setting, "no_fall_damage")){
nofall = str_to_num(Value) ? true : false
}else if( equali(Setting, "remove_limit")){
remove_limit = str_to_num(Value) ? true : false
}else if( equali(Setting, "bullet_damage")){
damager = str_to_num(Value)
}else if( equali(Setting, "bullet_damage_recieved")){
recieved = str_to_num(Value) ? true : false
}else if( equali(Setting, "bullet_damage_color")){
new red[10], green[10], blue[10]
parse(Value, red, charsmax(red), green, charsmax(green), blue, charsmax(blue))
dmgcolors[0] = str_to_num(red)
dmgcolors[1] = str_to_num(green)
dmgcolors[2] = str_to_num(blue)
}else if( equali(Setting, "vampire")){
vampire = str_to_num(Value) ? true : false
}else if( equali(Setting, "vampire_max_hp")){
vampire_max = str_to_num(Value)
}else if( equali(Setting, "vampire_hp")){
hp_bonus = str_to_num(Value)
}else if( equali(Setting, "vampire_hp_hs")){
hp_bonus_hs = str_to_num(Value)
}else if( equali(Setting, "open_menu")){
openmenu = str_to_num(Value) ? true : false
}else if( equali(Setting, "close_delay")){
delay = str_to_num(Value)
}else if( equali(Setting, "allowed_round_famas")){
alw_round_fm = str_to_num(Value)
}else if( equali(Setting, "allowed_round_m4ak")){
alw_round_m4ak = str_to_num(Value)
}else if( equali(Setting, "allowed_round_awp")){
alw_round_awp = str_to_num(Value)
}else if( equali(Setting, "allowed_round_buymenu")){
alw_round_buy = str_to_num(Value)
}else if( equali(Setting, "deagle_cost")){
dglcost = str_to_num(Value)
}else if( equali(Setting, "m4a1_cost")){
m4cost = str_to_num(Value)
}else if( equali(Setting, "ak47_cost")){
akcost = str_to_num(Value)
}else if( equali(Setting, "awp_cost")){
awpcost = str_to_num(Value)
}
}
formatex( szMsg, charsmax(szMsg), "%s Config Successfully Loaded!", PLUGIN_NAME )
server_print(szMsg)
}
}

public plugin_cfg()
{
g_iKNFPluginId = is_plugin_loaded("V.I.P Custom KNIFE")
if( g_iKNFPluginId > 0 )
{
g_iKNFReload = get_func_id("loadconfig", g_iKNFPluginId)
}
g_iDGLPluginId = is_plugin_loaded("V.I.P Custom DEAGLE")
if( g_iDGLPluginId > 0 )
{
g_iDGLGive = get_func_id("buyCMD", g_iDGLPluginId)
g_iDGLReload = get_func_id("loadconfig", g_iDGLPluginId)
}
g_iM4A1PluginId = is_plugin_loaded("V.I.P Custom M4A1")
if( g_iM4A1PluginId > 0 )
{
g_iM4A1Give = get_func_id("buyCMD", g_iM4A1PluginId)
g_iM4A1Reload = get_func_id("loadconfig", g_iM4A1PluginId)
}
g_iAK47PluginId = is_plugin_loaded("V.I.P Custom AK-47")
if( g_iAK47PluginId > 0 )
{
g_iAK47Give = get_func_id("buyCMD", g_iAK47PluginId)
g_iAK47Reload = get_func_id("loadconfig", g_iAK47PluginId)
}
g_iAWPPluginId = is_plugin_loaded("V.I.P Custom AWP")
if( g_iAWPPluginId > 0 )
{
g_iAWPGive = get_func_id("buyCMD", g_iAWPPluginId)
g_iAWPReload = get_func_id("loadconfig", g_iAWPPluginId)
}
}

public client_putinserver(id)
{
g_iAlive[id] = 0
g_bAccess[id] = get_user_flags(id) & flagaccess ? true : false

if(info)
{
set_task(1.0, "vip_connected", id)
if(target_map)
{
set_task(30.0, "vip_help", id)
}
}
if(!is_user_hltv(id))
{
SetFlagConnected(id)
}
}

public client_disconnect(id)
{
ClearFlagConnected(id)
}

public playerspawn_post(id)
{
g_iAlive[id] = is_user_alive(id)
g_bAccess[id] = get_user_flags(id) & flagaccess ? true : false
set_task(0.2, "GiveItem", id + 6910)
}

public playerkilled_post(id, attacker, shouldgib)
{
g_iAlive[id] = 0
}

public Event_NewRound()
{
gbIsUsed = 0
giCounter++
}

public Event_NewGame()
{
giCounter = 0
}

// Vip connected info/help
public vip_connected(id)
{
if(g_bAccess[id])
{
new name[32]
get_user_name(id, name, 31)
ChatColor(0, "%L", LANG_SERVER,"VIP_CONNECTED", name)
}
}

public vip_help(id)
{
if(g_bAccess[id])
{
new name[32]
get_user_name(id, name, 31)
ChatColor(id, "%L", LANG_SERVER,"VIP_HELP", name)
}
}

// ScoreBoard "VIP" String
public msgScoreAttrib(const MsgId, const MsgType, const MsgDest)
{
static id; id = get_msg_arg_int(1)
if(get_msg_arg_int(2) || !(g_bAccess[id]))
return
set_msg_arg_int(2, ARG_BYTE, (1<<2))
}

// [V.I.P] prefix and green chat
public messageSayText(msgid, msgdest, id)
{
new channel[64]
get_msg_arg_string(2, channel, charsmax(channel))

if(!TrieGetString(vipChannels, channel, channel, charsmax(channel)))
{
return
}
new sender = get_msg_arg_int(1)
if(g_bAccess[sender])
{
set_msg_arg_string(2, channel)
}
}

public plugin_end()
{
TrieDestroy(vipChannels)
}

// Bullet Damage
public Event_Damage(iVictim)
{
if((read_data(4) || read_data(5) || read_data(6)))
{
static damage; damage = read_data(2)
if( recieved && IsPlayer(iVictim) && UserConnected(iVictim))
{
if(g_bAccess[iVictim])
{
set_hudmessage(255, 0, 0, 0.45, 0.50, 0, 6.0, 3.0, _, _, 3)
show_hudmessage(iVictim, "%d", damage)
}
}
new id = get_user_attacker(iVictim)
if( IsPlayer(id) && UserConnected(id))
{
new iPos = ++g_iPlayerPos[id]
if( iPos == sizeof(g_flCoords))
{
iPos = g_iPlayerPos[id] = 0
}
new iCol = ++g_iPlayerCol[id]
if( iCol == sizeof(g_iColors))
{
iCol = g_iPlayerCol[id] = 0
}
if(g_bAccess[id])
{
switch(damager)
{ case 1:{
set_hudmessage(dmgcolors[0], dmgcolors[1], dmgcolors[2], 0.51, 0.51, 0, 6.0, 3.0, _, _, 3)
}
case 2:{
set_hudmessage(dmgcolors[0], dmgcolors[1], dmgcolors[2], Float:g_flCoords[iPos][0], Float:g_flCoords[iPos][1], 0, 0.1, 2.5, 0.02, 0.02, -1)
}
case 3:{
set_hudmessage(g_iColors[iCol][0], g_iColors[iCol][1], g_iColors[iCol][2], Float:g_flCoords[iPos][0], Float:g_flCoords[iPos][1], 0, 0.1, 2.5, 0.02, 0.02, -1)
}
}
show_hudmessage(id, "%d", damage)
}
}
}
}

// Vampire
public Event_DeathMsg()
{
new KillerId = read_data(1)
new VictimId = read_data(2)
new HeadShot = read_data(3)

if(KillerId == VictimId || !IsPlayer(KillerId)
|| !g_iAlive[KillerId] || !(g_bAccess[KillerId])
|| get_user_team(KillerId) == get_user_team(VictimId))
{
return
}

new KillerHealth = get_user_health(KillerId)
new KillerMaxHealth = vampire_max
if(KillerHealth < KillerMaxHealth)
{
new BonusKillerHealth = HeadShot ? hp_bonus_hs : hp_bonus
new NewKillerHealth = min(KillerHealth + BonusKillerHealth, KillerMaxHealth)
fm_set_user_health(KillerId, NewKillerHealth)
set_hudmessage(0, 255, 100, -1.0, 0.15, 0, 1.0, 1.0, 0.1, 0.1, -1)
show_hudmessage(KillerId, "Healed +%d hp", NewKillerHealth - KillerHealth)
}
}

// Terrorist planter :D
public event_bomb_planting(id)
{
if(!g_iAlive[id] || !g_bAccess[id])
return
set_pev(id, pev_maxspeed, 250.0)
}

// No fall damage
public HamTakeDamagePlayerPre(victim, inflictor, attacker, Float:dmg, dmg_type)
{
if(g_bAccess[victim])
{
if(dmg_type & (1<<5)/* dmg fall */)
{
return HAM_SUPERCEDE
}
}
return HAM_IGNORED
}

// Equip/Deagle giving
public GiveItem(TaskID)
{
new id = TaskID - 6910

if( !( g_bAccess[id]) || !g_iAlive[id])
{
return
}
if(item_flags & ITEM_AMMO)
{
giveammo(id)
refill(id)
}
if(!target_map)
{
return
}
if(giCounter >= alw_round_eq)
{
if(item_flags & ITEM_DEAGLE)
{
if(user_has_weapon(id,CSW_DEAGLE))
{
ExecuteHamB(Ham_GiveAmmo, id, 35, "50ae", 35)
}else{
drop_weapons(id, 2)
fm_give_item(id,"weapon_deagle")
ExecuteHamB(Ham_GiveAmmo, id, 35, "50ae", 35)
}
}
if(item_flags & ITEM_HE)
{
fm_give_item(id,"weapon_hegrenade")
}
if(item_flags & ITEM_SMOKE)
{
fm_give_item(id,"weapon_smokegrenade")
}
if(item_flags & ITEM_FLASH)
{
fm_give_item(id,"weapon_flashbang")
fm_give_item(id,"weapon_flashbang")
}
if(item_flags & ITEM_ARMOR)
{
fm_give_item(id,"item_assaultsuit")
fm_set_user_armor(id,100)
}
if(item_flags & ITEM_DEFUSER)
{
if(get_user_team(id) == 2)
{
fm_give_item(id,"item_thighpack")
}
}
}
if(openmenu)
{
if(!cs_get_user_hasprim(id, 1) && giCounter >= alw_round_fm)
{
MenuCommand(id)
}
}
}

// Weapon Menu
public MenuCommand(id)
{
new szMenu[512] // it is maximum allowed menu size
new iKeys
new iLen = formatex( szMenu, charsmax(szMenu), "\y%L\R%L^t^n^n", LANG_SERVER,"WEAPONS_MENU", LANG_SERVER,"ROUND")

new iItemsDisabled
if( !( g_bAccess[id]) || !g_iAlive[id] || CheckFlag( gbIsUsed, id ))
iItemsDisabled = 1

if( iItemsDisabled || giCounter < alw_round_fm )
{
iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\d1.^t%L\R\r%d^t^n", LANG_SERVER,"WEAPON_FAMAS", alw_round_fm)
}else{
iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\y1.^t\w%L\R\y%d^t^n", LANG_SERVER,"WEAPON_FAMAS", alw_round_fm)
iKeys |= MENU_KEY_1
}
if( iItemsDisabled || giCounter < alw_round_m4ak )
{
iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\d2.^t%L\R\r%d^t^n", LANG_SERVER, "WEAPON_M4A1", alw_round_m4ak)
}else{
iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\y2.^t\w%L\R\y%d^t^n", LANG_SERVER, "WEAPON_M4A1", alw_round_m4ak)
iKeys |= MENU_KEY_2
}
if( iItemsDisabled || giCounter < alw_round_m4ak )
{
iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\d3.^t%L\R\r%d^t^n", LANG_SERVER,"WEAPON_AK-47", alw_round_m4ak)
}else{
iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\y3.^t\w%L\R\y%d^t^n", LANG_SERVER,"WEAPON_AK-47", alw_round_m4ak)
iKeys |= MENU_KEY_3
}
if( iItemsDisabled || giCounter < alw_round_awp )
{
iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\d4.^t%L\R\r%d^t^n", LANG_SERVER,"WEAPON_AWP", alw_round_awp)
}else{
iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\y4.^t\w%L\R\y%d^t^n", LANG_SERVER,"WEAPON_AWP", alw_round_awp)
iKeys |= MENU_KEY_4
}
if(!( get_user_flags(id) & buyaccess) || !g_iAlive[id] || giCounter < alw_round_buy)
{
iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "^n\d5.^t%L^n", LANG_SERVER,"BUY_MENU")
}else{
iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "^n\y5.^t\w%L^n", LANG_SERVER,"BUY_MENU")
iKeys |= MENU_KEY_5
}

formatex( szMenu[iLen], charsmax(szMenu) - iLen, "^n\y0.^t\w%L", LANG_SERVER, "EXIT" )
iKeys |= MENU_KEY_0|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8|MENU_KEY_9
show_menu( id, iKeys, szMenu, delay, .title = "WeaponMenu" )

return PLUGIN_HANDLED
}

// Custom Menu
public MenuCommandCustom(id)
{
new szMenu[512] // it is maximum allowed menu size
new iKeys
new usermoney = fm_get_user_money(id)
new iLen = formatex( szMenu, charsmax(szMenu), "\y%L\R$^t^t%L^t^n^n", LANG_SERVER,"BUY_MENU", LANG_SERVER,"COST")

new iItemsDisabled
if( !( get_user_flags(id) & buyaccess) || !g_iAlive[id] /*|| CheckFlag( gbIsUsed, id )*/)
iItemsDisabled = 1

if( iItemsDisabled || g_iDGLPluginId < 0 )
{
iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\r1.^t%L^t^n", LANG_SERVER,"CUSTOM_DEAGLE")
}else if( iItemsDisabled || usermoney < dglcost ){
iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\d1.^t%L\R\r%d^t^n", LANG_SERVER,"CUSTOM_DEAGLE", dglcost)
}else{
iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\y1.^t\w%L\R\y%d^t^n", LANG_SERVER,"CUSTOM_DEAGLE", dglcost)
iKeys |= MENU_KEY_1
}
if( iItemsDisabled || g_iM4A1PluginId < 0 )
{
iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\r2.^t%L^t^n", LANG_SERVER,"CUSTOM_M4A1")
}else if( iItemsDisabled || usermoney < m4cost){
iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\d2.^t%L\R\r%d^t^n", LANG_SERVER,"CUSTOM_M4A1", m4cost)
}else{
iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\y2.^t\w%L\R\y%d^t^n", LANG_SERVER,"CUSTOM_M4A1", m4cost)
iKeys |= MENU_KEY_2
}
if( iItemsDisabled || g_iAK47PluginId < 0 )
{
iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\r3.^t%L^t^n", LANG_SERVER, "CUSTOM_AK-47")
}else if( iItemsDisabled || usermoney < akcost){
iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\d3.^t%L\R\r%d^t^n", LANG_SERVER, "CUSTOM_AK-47", akcost)
}else{
iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\y3.^t\w%L\R\y%d^t^n", LANG_SERVER, "CUSTOM_AK-47", akcost)
iKeys |= MENU_KEY_3
}
if( iItemsDisabled || g_iAWPPluginId < 0 )
{
iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\r4.^t%L^t^n", LANG_SERVER, "CUSTOM_AWP")
}else if( iItemsDisabled || usermoney < awpcost){
iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\d4.^t%L\R\r%d^t^n", LANG_SERVER, "CUSTOM_AWP", awpcost)
}else{
iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\y4.^t\w%L\R\y%d^t^n", LANG_SERVER, "CUSTOM_AWP", awpcost)
iKeys |= MENU_KEY_4
}
if( !( g_bAccess[id]) || !g_iAlive[id])
{
iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "^n\d5.^t%L^n", LANG_SERVER,"BACK")
}else{
iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "^n\y5.^t\w%L^n", LANG_SERVER,"BACK")
iKeys |= MENU_KEY_5
}

formatex( szMenu[iLen], charsmax(szMenu) - iLen, "^n\y0.^t\w%L", LANG_SERVER, "EXIT" )
iKeys |= MENU_KEY_0|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8|MENU_KEY_9
show_menu( id, iKeys, szMenu, delay, .title = "BuyMenu" )

return PLUGIN_HANDLED
}

// Weapon Menu Func
public MenuHandler(id, key)
{
if(key == KEY_EXIT - 1 || !g_iAlive[id])
return PLUGIN_HANDLED

switch(key)
{
case 0:{
if(user_has_weapon(id,CSW_FAMAS))
{
client_print(id, print_center, "%L", LANG_SERVER,"ALREADY_OWN_WEAPON")
}
else{
drop_weapons(id, 1)
fm_give_item(id,"weapon_famas")
ExecuteHamB(Ham_GiveAmmo, id, 90, "556nato", 90)
SetFlag( gbIsUsed, id )
}
}
case 1:{
if(user_has_weapon(id,CSW_M4A1))
{
client_print(id, print_center, "%L", LANG_SERVER,"ALREADY_OWN_WEAPON")
}
else{
drop_weapons(id, 1)
fm_give_item(id,"weapon_m4a1")
ExecuteHamB(Ham_GiveAmmo, id, 90, "556nato", 90)
SetFlag( gbIsUsed, id )
}
}
case 2:{
if(user_has_weapon(id,CSW_AK47))
{
client_print(id, print_center, "%L", LANG_SERVER,"ALREADY_OWN_WEAPON")
}
else{
drop_weapons(id, 1)
fm_give_item(id,"weapon_ak47")
ExecuteHamB(Ham_GiveAmmo, id, 90, "762nato", 90)
SetFlag( gbIsUsed, id )
}
}
case 3:{
if(user_has_weapon(id,CSW_AWP))
{
client_print(id, print_center, "%L", LANG_SERVER,"ALREADY_OWN_WEAPON")
}
else{
drop_weapons(id, 1)
fm_give_item(id,"weapon_awp")
ExecuteHamB(Ham_GiveAmmo, id, 30, "338magnum", 30)
SetFlag( gbIsUsed, id )
}
}
case 4:{
MenuCommandCustom(id)
}
}
return PLUGIN_HANDLED
}

// Custom Menu func
public MenuHandlerCustom(id, key)
{
if(key == KEY_EXIT - 1 || !g_iAlive[id])
return PLUGIN_HANDLED

switch(key)
{
case 0:{
if(g_iDGLPluginId > 0 && g_iDGLGive > 0)
{
callfunc_begin_i(g_iDGLGive, g_iDGLPluginId)
callfunc_push_int(id)
callfunc_end()
// SetFlag( gbIsUsed, id )
}
}
case 1:{
if(g_iM4A1PluginId > 0 && g_iM4A1Give > 0)
{
callfunc_begin_i(g_iM4A1Give, g_iM4A1PluginId)
callfunc_push_int(id)
callfunc_end()
// SetFlag( gbIsUsed, id )
}
}
case 2:{
if(g_iAK47PluginId > 0 && g_iAK47Give > 0)
{
callfunc_begin_i(g_iAK47Give, g_iAK47PluginId)
callfunc_push_int(id)
callfunc_end()
// SetFlag( gbIsUsed, id )
}
}
case 3:{
if(g_iAWPPluginId > 0 && g_iAWPGive > 0)
{
callfunc_begin_i(g_iAWPGive, g_iAWPPluginId)
callfunc_push_int(id)
callfunc_end()
// SetFlag( gbIsUsed, id )
}
}
case 4:{
MenuCommand(id)
}
}
return PLUGIN_HANDLED
}

//================================ STOCKS ==============================//

stock giveammo(id)
{
new weap_ids[32], num_weaps
num_weaps = 0
get_user_weapons(id, weap_ids, num_weaps)
for (new i = 0; i < num_weaps; i++)
{
new weap_id = weap_ids
new ammo = MAXBPAMMO[weap_id]
if(!( NOCLIP_WPN_BS & (1<<weap_id)))
{
ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[weap_id], AMMOTYPE[weap_id], MAXBPAMMO[weap_id], ammo)
}
}
}

stock refill(id)
{
for(new slot = 1; slot<= 2; slot++)
{
new iWeapon = get_pdata_cbase(id, m_rgpPlayerItems_CBasePlayer[slot])
while( iWeapon > 0 )
{
new iId = fm_get_weapon_id(iWeapon)
if( !( NOCLIP_WPN_BS & (1<<iId) ) )
{
fm_set_weapon_ammo(iWeapon, MAXCLIP[iId])
iWeapon = get_pdata_cbase(iWeapon, m_pNext, XO_WEAPON)
}
}
}
}

stock drop_weapons(id, dropwhat)
{
static weapons[32], num, i, weaponid
num = 0
get_user_weapons(id, weapons, num)

for (i = 0; i < num; i++)
{
weaponid = weapons
if((dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM) || HasShield(id))
|| (dropwhat == 2 && ((1<<weaponid) & SECONDARY_WEAPONS_BIT_SUM )))
{
static wname[32]
get_weaponname(weaponid, wname, charsmax(wname))
switch(droptype)
{
case 0: ham_strip_weapon(id, wname)
case 1: engclient_cmd(id, "drop", wname)
}
}
}
}

stock ham_strip_weapon(id,weapon[])
{
if(!equal(weapon,"weapon_",7)) return 0

new wId = get_weaponid(weapon)
if(!wId) return 0

new wEnt
while((wEnt = engfunc(EngFunc_FindEntityByString, wEnt, "classname", weapon)) && pev(wEnt, pev_owner) != id) {}
if(!wEnt) return 0

new iTmp
if(get_user_weapon(id, iTmp, iTmp) == wId) ExecuteHamB(Ham_Weapon_RetireWeapon, wEnt)

if(!ExecuteHamB(Ham_RemovePlayerItem, id, any:wEnt)) return 0

ExecuteHamB(Ham_Item_Kill, wEnt)
set_pev(id, pev_weapons, pev(id, pev_weapons) & ~(1<<wId))

return 1
}

stock ChatColor(const id, const input[], any:...)
{
new count = 1, players[32], i
static msg[191]
vformat(msg, 190, input, 3)

replace_all(msg, 190, "!g", "^4") // Green Color
replace_all(msg, 190, "!n", "^1") // Default Color
replace_all(msg, 190, "!t", "^3") // Team Color

if(id)players[0] = id; else get_players(players, count, "ch")
{
for(i = 0; i < count; i++)
{
if(is_user_connected(players))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players)
write_byte(players)
write_string(msg)
message_end()
}
}
}
}

stock fm_set_user_armor(index, armor)
{
set_pev(index, pev_armorvalue, float(armor))
return 1
}

stock fm_set_user_health(index, health)
{
health > 0 ? set_pev(index, pev_health, float(health)) : dllfunc(DLLFunc_ClientKill, index)
return 1
}

stock fm_give_item(index, const item[])
{
if (!equal(item, "weapon_", 7) && !equal(item, "ammo_", 5) && !equal(item, "item_", 5))
return 0

new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, item))
if (!pev_valid(ent))
return 0

new Float:origin[3]
pev(index, pev_origin, origin)
set_pev(ent, pev_origin, origin)
set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN)
dllfunc(DLLFunc_Spawn, ent)

new save = pev(ent, pev_solid)
dllfunc(DLLFunc_Touch, ent, index)
if (pev(ent, pev_solid) != save)
return ent

engfunc(EngFunc_RemoveEntity, ent)

return -1
}


Комментарий:
Ошибка возникает у многих,найдя темы решения проблемы я не понимаю что поменять на что.Спасибо заранее!
 
В этой теме было размещено решение! Перейти к решению.

Вложения

Сообщения
2,751
Реакции
3,016
Помог
61 раз(а)
Код:
stock refill(id)
{
if(!is_user_connected(id)) return

for(new slot = 1; slot<= 2; slot++)
{
 
Сообщения
657
Реакции
562
Предупреждения
8
Помог
9 раз(а)
Пцц....какой ужос я написал те времена
 
Статус
В этой теме нельзя размещать новые ответы.

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

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