Raised This Month: $ Target: $400
 0% 

[CSGO]Updates broke my zeus_refill plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
VJScope
Senior Member
Join Date: Jul 2012
Location: Finland
Old 09-24-2015 , 06:52   [CSGO]Updates broke my zeus_refill plugin
Reply With Quote #1

Problem:
It appears that some of the latest updates included that you can't buy 2 tasers in the same round. This also prevents my plugin to work.

Plugin idea:
If you kill a player with taser, you will get another one. If you miss, you will not get another one.

Tests 1:
I replaced weapon_taser with weapon_ak47 and it works every time. I have confirmed in various ways that the problem is:
Code:
GivePlayerItem(client, "weapon_taser");
Code:
Code:
#include <sourcemod>
#include <sdktools>
#include <cstrike>
#include <sdkhooks>
#include <colors>
#include <updater>

#define		MAX_WEAPON_STRING		80

new Handle:ClientTimer[MAXPLAYERS+1] = {INVALID_HANDLE, ...};

public Plugin:myinfo = 
{
	name = "Zeus Refill",
	author = "Original code TnTSCS, modified by VJScope",
	description = "If you kill with taser, you get another one",
	version = "",
	url = ""
}

public OnPluginStart()
{
	HookEvent("player_death", Event_PlayerDeath);
}

public Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
	new killer = GetClientOfUserId(GetEventInt(event, "attacker"));
	
	decl String:weapon[MAX_WEAPON_STRING];
	weapon[0] = '\0';
	
	GetEventString(event, "weapon", weapon, sizeof(weapon));
	
	if (StrEqual(weapon, "taser", false) || StrEqual(weapon, "knife", false))
	{
		ClientTimer[killer] = CreateTimer(0.5, Timer_GiveZeus, killer);
	}
}

public Action:Timer_GiveZeus(Handle:timer, any:client)
{
	ClientTimer[client] = INVALID_HANDLE;
	
	GivePlayerItem(client, "weapon_taser");
}

Tests 2:
We did some further testing with my another plugin which basically should give you taser every time you press mouse1 (fire a weapon). Here are the results.

Buy a taser = you will not get another when you press mouse1. It creates the weapon but forces you to drop it.
Use mouse1 to get a taser + terrorists fire the first taser = Everyone gets new taser after pressing mouse1.
Use mouse1 to get taser + CTs fire the first taser = No one will get another taser when they press mouse1. It creates the weapon but forces to drop it.

Code for 'Tests 2'
Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

new Handle:ClientTimer[MAXPLAYERS+1] = {INVALID_HANDLE, ...};

public Plugin:myinfo = 
{
	name = "Zeus Refill Alltime",
	author = "VJScope",
	description = "Refills taser everytime",
	version = "",
	url = ""
}

public OnPluginStart()
{
	HookEvent("weapon_fire", Event_WeaponFire);
}

public Event_WeaponFire(Handle:event, const String:name[], bool:dontBroadcast)
{
	new client = GetClientOfUserId(GetEventInt(event, "userid"));
	
	ClientTimer[client] = CreateTimer(0.5, Timer_GiveZeus, client);
}

public Action:Timer_GiveZeus(Handle:timer, any:client)
{
	ClientTimer[client] = INVALID_HANDLE;
	
	GivePlayerItem(client, "weapon_taser");
}
Can anyone help?
__________________
Strange women lying in ponds distributing swords is no basis for a system of government. Supreme executive power derives from a mandate from the masses, not from some farcical aquatic ceremony.
VJScope is offline
iGANGNAM
AlliedModders Donor
Join Date: Sep 2012
Location: Lithuania
Old 09-24-2015 , 08:46   Re: [CSGO]Updates broke my zeus_refill plugin
Reply With Quote #2

If it is ZEUS ONLY server than you can use
sv_infinite_ammo 1

Maybe try messing up something with ammo than? Smlib have some functions I think

Last edited by iGANGNAM; 09-24-2015 at 08:48.
iGANGNAM is offline
VJScope
Senior Member
Join Date: Jul 2012
Location: Finland
Old 09-24-2015 , 10:23   Re: [CSGO]Updates broke my zeus_refill plugin
Reply With Quote #3

It's not taser only server but there are few players who like playing with taser only/mostly. This is really bad thing for me. I have played cs games something like 10 years and taser + this plugin was pretty much the only thing that kept me interested...

"Maybe try messing up something with ammo than?" I guess, I have to look into that too..
__________________
Strange women lying in ponds distributing swords is no basis for a system of government. Supreme executive power derives from a mandate from the masses, not from some farcical aquatic ceremony.
VJScope is offline
blaacky
Senior Member
Join Date: Oct 2012
Old 09-24-2015 , 11:31   Re: [CSGO]Updates broke my zeus_refill plugin
Reply With Quote #4

This works for me:

PHP Code:
public OnPluginStart()
{
    
HookEvent("player_death"Event_PlayerDeath);
}

public 
Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
killer GetClientOfUserId(GetEventInt(event"attacker"));
    if(
killer != 0)
    {
        
decl String:weapon[64];
        
GetEventString(event"weapon"weaponsizeof(weapon));
        
        if(
StrEqual(weapon"taser"false) || StrContains(weapon"knife"false) != -1)
        {
            
CreateTimer(0.5Timer_GiveZeusGetClientUserId(killer));
        }
    }
}

public 
Action:Timer_GiveZeus(Handle:timerany:userid)
{
    new 
client GetClientOfUserId(userid);
    
    if(
client != 0)
    {
        
GivePlayerItem(client"weapon_taser");
    }

I killed bots with a zeus and it gave me a new one every time.

And this gives me a zeus almost instantly:
PHP Code:
public OnPluginStart()
{
    
HookEvent("player_death"Event_PlayerDeath);
}

public 
Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
killer GetClientOfUserId(GetEventInt(event"attacker"));
    if(
killer != 0)
    {
        
decl String:sWeapon[64];
        
GetEventString(event"weapon"sWeaponsizeof(sWeapon));
        
        
bool bGiveZeus;
        if(
StrEqual(sWeapon"taser"false))
        {
            
int weapon Client_GetActiveWeapon(killer);
            
AcceptEntityInput(weapon"Kill");
            
            
bGiveZeus true;
        }
        else if(
StrContains(sWeapon"knife"false) != -1)
        {
            
bGiveZeus true;
        }
        
        if(
bGiveZeus == true)
        {
            
RequestFrame(GiveZeusGetClientUserId(killer));
        }
        
    }
}

public 
void GiveZeus(any userid)
{
    new 
client GetClientOfUserId(userid);
    
    if(
client != 0)
    {
        
GivePlayerItem(client"weapon_taser");
    }


Last edited by blaacky; 09-24-2015 at 11:45.
blaacky is offline
lingzhidiyu
Senior Member
Join Date: Mar 2014
Old 09-24-2015 , 11:38   Re: [CSGO]Updates broke my zeus_refill plugin
Reply With Quote #5

PHP Code:
public Action:CS_OnBuyCommand(client, const String:weapon[])
{
    if (
StrEqual(weapon"taser"true))
    {
        
GivePlayerItem(client"weapon_taser");
        return 
Plugin_Handled;
    }

    return 
Plugin_Continue;

lingzhidiyu is offline
VJScope
Senior Member
Join Date: Jul 2012
Location: Finland
Old 09-25-2015 , 03:30   Re: [CSGO]Updates broke my zeus_refill plugin
Reply With Quote #6

blaacky I tried your code but still doesn't work.. What other plugins did you have on? I took all off - except the default sourcemod plugins...
__________________
Strange women lying in ponds distributing swords is no basis for a system of government. Supreme executive power derives from a mandate from the masses, not from some farcical aquatic ceremony.

Last edited by VJScope; 09-25-2015 at 03:31.
VJScope is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 09-25-2015 , 03:41   Re: [CSGO]Updates broke my zeus_refill plugin
Reply With Quote #7

You could set the ammo and fire rates in the weapon script also.
__________________
Neuro Toxin is offline
lingzhidiyu
Senior Member
Join Date: Mar 2014
Old 09-25-2015 , 04:43   Re: [CSGO]Updates broke my zeus_refill plugin
Reply With Quote #8

Quote:
Originally Posted by VJScope View Post
blaacky I tried your code but still doesn't work.. What other plugins did you have on? I took all off - except the default sourcemod plugins...
I am sure it does't work when i bought it and kill someone, dont use give cheat command.
You can use my code and need check money team buyzone and buytime.
lingzhidiyu is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 09-25-2015 , 05:58   Re: [CSGO]Updates broke my zeus_refill plugin
Reply With Quote #9

@VJScope, this give you problem I assume
http://ranut.omafoorumi.net/t288-tas...tulen-rajoitin

*updated my post in there
__________________
Do not Private Message @me

Last edited by Bacardi; 09-25-2015 at 06:24.
Bacardi is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:42.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode