mirror of
https://github.com/Jackzmc/sourcemod-plugins.git
synced 2025-05-07 21:23:22 +00:00
feedthetrolls: Fix UziRules allowing spam pickup
This commit is contained in:
parent
e19e449690
commit
961c468a1d
2 changed files with 30 additions and 34 deletions
Binary file not shown.
|
@ -29,18 +29,18 @@
|
||||||
*/
|
*/
|
||||||
#define TROLL_MODE_COUNT 12
|
#define TROLL_MODE_COUNT 12
|
||||||
enum TROLL_MODE {
|
enum TROLL_MODE {
|
||||||
ResetUser, //0
|
Troll_ResetUser, //0
|
||||||
SlowSpeed, //1
|
Troll_SlowSpeed, //1
|
||||||
HigherGravity, //2
|
Troll_HigherGravity, //2
|
||||||
HalfPrimaryAmmo, //3
|
Troll_HalfPrimaryAmmo, //3
|
||||||
UziRules, //4
|
Troll_UziRules, //4
|
||||||
PrimaryDisable, //5
|
Troll_PrimaryDisable, //5
|
||||||
SlowDrain, //6
|
Troll_SlowDrain, //6
|
||||||
Clumsy, //7
|
Troll_Clumsy, //7
|
||||||
iCantSpellNoMore, //8
|
Troll_iCantSpellNoMore, //8
|
||||||
CameTooEarly, //9
|
Troll_CameTooEarly, //9
|
||||||
KillMeSoftly, //10
|
Troll_KillMeSoftly, //10
|
||||||
ThrowItAll //1
|
Troll_ThrowItAll //1
|
||||||
}
|
}
|
||||||
static const char TROLL_MODES_NAMES[TROLL_MODE_COUNT][32] = {
|
static const char TROLL_MODES_NAMES[TROLL_MODE_COUNT][32] = {
|
||||||
"Reset User", //0
|
"Reset User", //0
|
||||||
|
@ -253,9 +253,6 @@ public int ChoosePlayerHandler(Menu menu, MenuAction action, int param1, int par
|
||||||
char info[16];
|
char info[16];
|
||||||
menu.GetItem(param2, info, sizeof(info));
|
menu.GetItem(param2, info, sizeof(info));
|
||||||
int userid = StringToInt(info);
|
int userid = StringToInt(info);
|
||||||
int client = GetClientOfUserId(userid);
|
|
||||||
|
|
||||||
ReplyToCommand(param1, "You selected player: %N (userid: %d)", client, userid);
|
|
||||||
|
|
||||||
Menu trollMenu = new Menu(ChooseModeMenuHandler);
|
Menu trollMenu = new Menu(ChooseModeMenuHandler);
|
||||||
trollMenu.SetTitle("Choose a troll mode");
|
trollMenu.SetTitle("Choose a troll mode");
|
||||||
|
@ -292,12 +289,11 @@ public Action Event_ItemPickup(int client, int weapon) {
|
||||||
|| StrContains(wpnName, "shotgun") > -1
|
|| StrContains(wpnName, "shotgun") > -1
|
||||||
) {
|
) {
|
||||||
//If 4: Only UZI, if 5: Can't switch.
|
//If 4: Only UZI, if 5: Can't switch.
|
||||||
if(iTrollUsers[client] == 4) {
|
if(iTrollUsers[client] == view_as<int>(Troll_UziRules)) {
|
||||||
char currentWpn[16];
|
char currentWpn[32];
|
||||||
//TODO: Fix new weapons being given when user has one??
|
GetClientWeaponName(client, 0, currentWpn, sizeof(currentWpn));
|
||||||
GetClientWeapon(client, currentWpn, sizeof(currentWpn));
|
|
||||||
if(StrEqual(wpnName, "weapon_smg", true)) {
|
if(StrEqual(wpnName, "weapon_smg", true)) {
|
||||||
return StrEqual(currentWpn, "weapon_smg", true) ? Plugin_Stop : Plugin_Continue;
|
return Plugin_Continue;
|
||||||
} else if(StrEqual(currentWpn, "weapon_smg", true)) {
|
} else if(StrEqual(currentWpn, "weapon_smg", true)) {
|
||||||
return Plugin_Stop;
|
return Plugin_Stop;
|
||||||
}else{
|
}else{
|
||||||
|
@ -307,9 +303,10 @@ public Action Event_ItemPickup(int client, int weapon) {
|
||||||
SetCommandFlags("give", flags|FCVAR_CHEAT);
|
SetCommandFlags("give", flags|FCVAR_CHEAT);
|
||||||
return Plugin_Stop;
|
return Plugin_Stop;
|
||||||
}
|
}
|
||||||
}else{
|
}else if(iTrollUsers[client] == view_as<int>(Troll_PrimaryDisable)) {
|
||||||
return Plugin_Stop;
|
return Plugin_Stop;
|
||||||
}
|
}
|
||||||
|
return Plugin_Continue;
|
||||||
}else{
|
}else{
|
||||||
return Plugin_Continue;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
@ -319,7 +316,7 @@ public Action Event_ItemPickup(int client, int weapon) {
|
||||||
public Action Timer_ThrowTimer(Handle timer) {
|
public Action Timer_ThrowTimer(Handle timer) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for(int i = 1; i < MaxClients; i++) {
|
for(int i = 1; i < MaxClients; i++) {
|
||||||
if(IsClientConnected(i) && iTrollUsers[i] == 11) {
|
if(IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i) && iTrollUsers[i] == 11) {
|
||||||
ThrowAllItems(i);
|
ThrowAllItems(i);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
@ -331,7 +328,7 @@ public Action Timer_Main(Handle timer) {
|
||||||
for(int i = 1; i < MaxClients; i++) {
|
for(int i = 1; i < MaxClients; i++) {
|
||||||
if(IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i)) {
|
if(IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i)) {
|
||||||
switch(iTrollUsers[i]) {
|
switch(iTrollUsers[i]) {
|
||||||
case SlowDrain:
|
case Troll_SlowDrain:
|
||||||
if(loop % 4 == 0) {
|
if(loop % 4 == 0) {
|
||||||
int hp = GetClientHealth(i);
|
int hp = GetClientHealth(i);
|
||||||
if(hp > 50) {
|
if(hp > 50) {
|
||||||
|
@ -349,19 +346,19 @@ public Action Timer_Main(Handle timer) {
|
||||||
void ApplyModeToClient(int client, int victim, int mode, bool single) {
|
void ApplyModeToClient(int client, int victim, int mode, bool single) {
|
||||||
ResetClient(victim);
|
ResetClient(victim);
|
||||||
switch(mode) {
|
switch(mode) {
|
||||||
case SlowDrain:
|
case Troll_SlowDrain:
|
||||||
SetEntPropFloat(victim, Prop_Send, "m_flLaggedMovementValue", 0.8);
|
SetEntPropFloat(victim, Prop_Send, "m_flLaggedMovementValue", 0.8);
|
||||||
case HigherGravity:
|
case Troll_HigherGravity:
|
||||||
SetEntityGravity(victim, 1.3);
|
SetEntityGravity(victim, 1.3);
|
||||||
case HalfPrimaryAmmo: {
|
case Troll_HalfPrimaryAmmo: {
|
||||||
int current = GetPrimaryReserveAmmo(victim);
|
int current = GetPrimaryReserveAmmo(victim);
|
||||||
SetPrimaryReserveAmmo(victim, current / 2);
|
SetPrimaryReserveAmmo(victim, current / 2);
|
||||||
}
|
}
|
||||||
case UziRules:
|
case Troll_UziRules:
|
||||||
SDKHook(victim, SDKHook_WeaponEquip, Event_ItemPickup);
|
SDKHook(victim, SDKHook_WeaponCanUse, Event_ItemPickup);
|
||||||
case PrimaryDisable:
|
case Troll_PrimaryDisable:
|
||||||
SDKHook(victim, SDKHook_WeaponEquip, Event_ItemPickup);
|
SDKHook(victim, SDKHook_WeaponCanUse, Event_ItemPickup);
|
||||||
case Clumsy: {
|
case Troll_Clumsy: {
|
||||||
int wpn = GetClientSecondaryWeapon(victim);
|
int wpn = GetClientSecondaryWeapon(victim);
|
||||||
bool hasMelee = DoesClientHaveMelee(victim);
|
bool hasMelee = DoesClientHaveMelee(victim);
|
||||||
if(hasMelee) {
|
if(hasMelee) {
|
||||||
|
@ -382,9 +379,9 @@ void ApplyModeToClient(int client, int victim, int mode, bool single) {
|
||||||
SDKHooks_DropWeapon(victim, wpn);
|
SDKHooks_DropWeapon(victim, wpn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case CameTooEarly:
|
case Troll_CameTooEarly:
|
||||||
ReplyToCommand(client, "This troll mode is not implemented.");
|
ReplyToCommand(client, "This troll mode is not implemented.");
|
||||||
case ThrowItAll: {
|
case Troll_ThrowItAll: {
|
||||||
ThrowAllItems(victim);
|
ThrowAllItems(victim);
|
||||||
if(hThrowTimer == INVALID_HANDLE && !single) {
|
if(hThrowTimer == INVALID_HANDLE && !single) {
|
||||||
PrintToServer("Created new throw item timer");
|
PrintToServer("Created new throw item timer");
|
||||||
|
@ -440,7 +437,6 @@ void ResetClient(int victim) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThrowAllItems(int victim) {
|
void ThrowAllItems(int victim) {
|
||||||
|
|
||||||
float vicPos[3], destPos[3];
|
float vicPos[3], destPos[3];
|
||||||
int clients[4];
|
int clients[4];
|
||||||
GetClientAbsOrigin(victim, vicPos);
|
GetClientAbsOrigin(victim, vicPos);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue