From 99ec49b4410f155a6d8934a47b7ce320d389c77f Mon Sep 17 00:00:00 2001 From: Hexah Date: Sun, 3 Jun 2018 17:55:26 +0200 Subject: [PATCH] Bug Fixes + Travis --- .travis.yml | 4 +-- addons/sourcemod/scripting/hexvips.sp | 14 +++++----- addons/sourcemod/scripting/vipmenu.sp | 37 +++++++++++++++------------ 3 files changed, 31 insertions(+), 24 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9e7dd29..8519a39 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,9 +19,9 @@ deploy: provider: releases api_key: secure: Q4xBL32wClC9pldR/gMwBfMjx5yncC15hxR1OAmb+4LuPc5oGfHSqwD4fSbGUFiOmhgfHaALw9MXFiPm3YueXSprmsJbEBu3zLmqb6LQZA14GFEiwLHXtyoy47Z6mFQ5qQEOX3Iop9s6OlCeJy/Bs3DASv4RC5AOQ5psfWLmqIeS8nNnR9I5L9tt/xBSZrl8EyDPsJJJAegu8U8+j6N/0W1FwAwixRFtKety2O1tB29gS5wU8m/YzZRMo+U9vLDxJdUcY9h6HzBf6NxFGpwCk1sHA254zaroMNtl/WPbwvmz8tOiR+BfRCZ00EsN2NxVh4Kgcp/2+mALKK3GGFnQMO1hABIsgDBqEVRIFVRFwkPq5gcjxk5usgg5RwE3ezSJcESXWqqDhNeiQYz28Y56/1WrSeeD988bnYcJkZcRhGMsuq6S+cxRKieahYbzdNFlhTPp7ydBHT9Yk+roNu7AfrMLAI+NCPkTjr31Me1imNS14+ol+ZPHj5oIGeYUE6C0Rcp2unSdW1ivI2UQRk+5XkumO39Ty/+spTBd2ZrZxEVM3H54EELx+GBzfm/UM4EgEv7wWeNN5UJJ+wozg2QuqI5UCoMjI+fPRaV54XIxdghPYqPFpY1Q19mDGDzwdAdX69QLMi1xQ2QnzB1YAmg6g1xZw1NIAeDGIgn2d7KnxEA= - file: VipBonus.zip + file: HexVips.zip skip_cleanup: true on: branch: master tags: true - repo: Hexer10/VipMenu-Bonuses + repo: Hexer10/HexVips diff --git a/addons/sourcemod/scripting/hexvips.sp b/addons/sourcemod/scripting/hexvips.sp index 5cff33f..405ea47 100644 --- a/addons/sourcemod/scripting/hexvips.sp +++ b/addons/sourcemod/scripting/hexvips.sp @@ -135,14 +135,17 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int max_err fOnVipStatusUpdate = CreateGlobalForward("HexVips_VipStatusUpdated", ET_Ignore, Param_Cell, Param_Cell); #if (VIPMENU != 0) + CreateNative("Vip_ResetItems", Native_ResetItems); + + CreateNative("HexVips_ResetItems", Native_ResetItems); fOnPlayerUseMenu = CreateGlobalForward("HexVip_OnPlayerUseMenu", ET_Ignore, Param_Cell, Param_String); - Menu_AskPluginLoad2(); #endif bLateLoad = late; return APLRes_Success; } + public void OnPluginStart() { LoadTranslations("HexVips.phrases"); @@ -151,7 +154,6 @@ public void OnPluginStart() //Convars CreateConVar("hexvips_version", PLUGIN_VERSION, "HexVips Version", FCVAR_NOTIFY | FCVAR_DONTRECORD | FCVAR_SPONLY | FCVAR_REPLICATED); - if (CreateDirectoryEx("cfg/HexVips")) PrintToServer("Created HexVips cfg directory!"); @@ -553,7 +555,7 @@ stock bool IsValidTeam(int client, int convar) *********************************************************************************************************************************/ -Action OnBonusSet(int client) +void OnBonusSet(int client) { Action res = Plugin_Continue; @@ -563,7 +565,7 @@ Action OnBonusSet(int client) if (res >= Plugin_Handled) { - return Plugin_Handled; + return; } #if (VIPMENU != 0) @@ -572,7 +574,7 @@ Action OnBonusSet(int client) if (bIsMYJBAvaible && cv_bDisableOnEventday.BoolValue) if (MyJailbreak_IsEventDayRunning()) - return Plugin_Handled; + return; if (cv_iVipSpawnHP.IntValue >= 1 || cv_fVipSpawnArmour.IntValue >= 1) { @@ -583,7 +585,7 @@ Action OnBonusSet(int client) { GivePlayerItem(client, "item_defuser"); } - return Plugin_Continue; + return; } public int Native_CheckVip(Handle plugin, int argc) diff --git a/addons/sourcemod/scripting/vipmenu.sp b/addons/sourcemod/scripting/vipmenu.sp index 1dbd481..a4d0731 100644 --- a/addons/sourcemod/scripting/vipmenu.sp +++ b/addons/sourcemod/scripting/vipmenu.sp @@ -31,6 +31,7 @@ bool bRegen[MAXPLAYERS + 1] = false; bool bBhop[MAXPLAYERS + 1] = false; bool bDoubleJump[MAXPLAYERS + 1] = false; +bool bResetGravity[MAXPLAYERS + 1] = false; bool bUsed[MAXPLAYERS + 1][13]; /* 0 - Life @@ -114,11 +115,6 @@ ConVar cv_fGravity; ConVar cv_sVipMenuComm; ConVar cv_sWeapon; -public void Menu_AskPluginLoad2() -{ - CreateNative("Vip_ResetItems", Native_ResetItems); -} - public void OnVipMenuStart() { RegConsoleCmd("sm_vipmenu", Command_VipMenu, "Open VipMenu for VIPs"); @@ -128,8 +124,8 @@ public void OnVipMenuStart() AutoExecConfig_SetCreateFile(true); cv_bEnableVipMenu = AutoExecConfig_CreateConVar("vip_menu_vipmenu", "1", " 1 - Enable VipMenu. 0 - Disable", 0, true, 0.0, true, 1.0); cv_sVipMenuComm = AutoExecConfig_CreateConVar("vip_menu_vipmenucmds", "vmenu", "Commands to open the Vipmenu (no need of sm_ or ! or /)(separeted by a comma ',')"); - cv_iMenuUse = AutoExecConfig_CreateConVar("vip_menu_uses", "1", "Max VipMenu uses per round", 0, true, 0.0, true, 1.0); - cv_bMenuDoubleUses = AutoExecConfig_CreateConVar("vip_menu_use_once", "1", " 1 - Same item can be used only once. 0 - Same item can be used multiple times"); + cv_iMenuUse = AutoExecConfig_CreateConVar("vip_menu_uses", "1", "Max VipMenu uses per round", 0, true, 0.0); + cv_bMenuDoubleUses = AutoExecConfig_CreateConVar("vip_menu_use_once", "1", " 1 - Same item can be used only once. 0 - Same item can be used multiple times", 0, true, 0.0, true, 1.0); cv_bDisableLR = AutoExecConfig_CreateConVar("vip_menu_disable_lr", "1", "Disable VipMenu in sm_hosties LR", 0, true, 0.0, true, 1.0); cv_bMenuLife = AutoExecConfig_CreateConVar("vip_menu_life", "1", " 1 - Enable VipMenu Life. 0 - Disable ", 0, true, 0.0, true, 1.0); cv_iLifeHP = AutoExecConfig_CreateConVar("vip_menu_life_amount", "50", "Amount +HP"); @@ -190,7 +186,6 @@ public void OnMapStart() *********************************************************************************************************************************/ - public Action Command_ResMenu(int client, int args) { if (args == 0) @@ -353,11 +348,11 @@ public int hRespawnMenu(Handle menu, MenuAction action, int client, int param2) } void vmenu(int client) //MENU { - Menu menu = CreateMenu(hMenu, MENU_ACTIONS_ALL); + Menu menu = new Menu(hMenu); Format(sMenuName, sizeof(sMenuName), "%t", "Menu_Title"); menu.SetTitle(sMenuName); - if (cv_bMenuDoubleUses) + if (!cv_bMenuDoubleUses.BoolValue) { for (int i = 0; i < sizeof(bUsed[]); i++) { @@ -477,7 +472,7 @@ public int hMenu(Handle menu, MenuAction action, int client, int param2) //MENU CPrintToChat(client, "%t %t", "Prefix", "Get_Speed"); SetEntitySpeed(client, cv_fSpeed.FloatValue); iMenuUse[client]++; - bUsed[client][4] = true; + bUsed[client][5] = true; } else if (strcmp(info, "Gravity") == 0) { @@ -485,7 +480,8 @@ public int hMenu(Handle menu, MenuAction action, int client, int param2) //MENU CPrintToChat(client, "%t %t", "Prefix", "Get_Gravity"); SetEntityGravity(client, cv_fGravity.FloatValue); iMenuUse[client]++; - bUsed[client][5] = true; + bResetGravity[client] = true; + bUsed[client][6] = true; } else if (strcmp(info, "Regen") == 0) { @@ -499,7 +495,7 @@ public int hMenu(Handle menu, MenuAction action, int client, int param2) //MENU } hRegenTimer[client] = CreateTimer(cv_fHpTimer.FloatValue, Timer_Regen, GetClientUserId(client), TIMER_REPEAT); iMenuUse[client]++; - bUsed[client][6] = true; + bUsed[client][7] = true; } else if (strcmp(info, "Bhop") == 0) { @@ -507,7 +503,7 @@ public int hMenu(Handle menu, MenuAction action, int client, int param2) //MENU CPrintToChat(client, "%t %t", "Prefix", "Get_Bhop"); bBhop[client] = true; iMenuUse[client]++; - bUsed[client][7] = true; + bUsed[client][8] = true; } else if (strcmp(info, "Double") == 0) @@ -516,14 +512,14 @@ public int hMenu(Handle menu, MenuAction action, int client, int param2) //MENU CPrintToChat(client, "%t %t", "Prefix", "Get_DoubleJump"); bDoubleJump[client] = true; iMenuUse[client]++; - bUsed[client][8] = true; + bUsed[client][9] = true; } else if (strcmp(info, "NadeKit") == 0) { Forward_OnPlayerUseMenu(client, info); iMenuUse[client]++; - bUsed[client][9] = true; + bUsed[client][4] = true; if (cv_iNadeMolotov.IntValue != 0) { if (GetClientTeam(client) == CS_TEAM_T) @@ -617,6 +613,15 @@ public void Menu_PlayerSpawn(Event event, const char[] name, bool dontBroadcast) if (!IsValidClient(client, false, true)) return; + if (bResetGravity[client]) + { + SetEntityGravity(client, 1.0); + bResetGravity[client] = false; + } + + for (int i = 0; i < sizeof(bUsed[]); i++) + bUsed[i][client] = false; + iMenuUse[client] = 0; bRegen[client] = false; bBhop[client] = false;