Raised This Month: $51 Target: $400
 12% 

[CSGO] how to fix this?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
darkboss
Member
Join Date: Mar 2020
Location: Street (Homeless)
Old 12-18-2022 , 08:18   [CSGO] how to fix this?
Reply With Quote #1

hi guys i tried make this plugin working, but i'm not good enough.. can someone help?

Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

ConVar g_cvfReloadIncrease;

public OnPluginStart()
{
HookEvent("weapon_fire", Event_WeaponReload);
g_cvfReloadIncrease = CreateConVar("sm_instant_reload", "0", "Should VIP get unlimited ammo?");
}

public begin(Handle:event, int weapon, const String:name[], bool:dontBroadcast)
{
new userid = GetEventInt(event, "userid");
if(StrContains(name, "reload", false) != -1)
{
CreateTimer(0.0, Event_WeaponReload, userid);
return;
}
}

public Action:Event_WeaponReload(Handle:timer, hEvent, Event event, const char[] chName, any:userid)
{
if (!g_cvfReloadIncrease.BoolValue)
return;

int client = GetClientOfUserId(hEvent.GetInt("userid"));
int weapon = GetEntPropEnt(client, Prop_Data, "m_hActiveWeapon");

char ClassN[32];
GetEdictClassname(weapon, ClassN, sizeof(ClassN));

if (IsPlayerVip(client) && IsPlayerAlive(client))
	{
		if (weapon > 0 && (weapon == GetPlayerWeaponSlot(client, CS_SLOT_PRIMARY) || weapon == GetPlayerWeaponSlot(client, CS_SLOT_SECONDARY)))
		{
			if (StrContains(ClassN, "weapon_", false) != -1)
			{
				SetEntProp(weapon, Prop_Send, "m_iClip1", 32);
				SetEntProp(weapon, Prop_Send, "m_iClip2", 32);
			}
		}
	}
}

stock void StripAllWeapons(int client)
{
	int iEnt;
	for (int i = 0; i <= 2; i++)
	{
		while ((iEnt = GetPlayerWeaponSlot(client, i)) != -1)
		{
			RemovePlayerItem(client, iEnt);
			AcceptEntityInput(iEnt, "Kill");
		}
	}
}

stock bool IsPlayerVip(int client)
{
	if (client <= 0)return false;
	if (client > MaxClients)return false;
	if (!IsClientConnected(client))return false;
	if (IsClientReplay(client))return false;
	if (IsFakeClient(client))return false;
	if (IsClientSourceTV(client))return false;
	return IsClientInGame(client);
}
https://imgur.com/wy260A1 and i got this error
darkboss is offline
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 12-18-2022 , 16:40   Re: [CSGO] how to fix this?
Reply With Quote #2

I don't play CSGO, but try adding this include near the top of your code:
PHP Code:
#include <cstrike> 
You used code that was specific to Counterstrike, but didn't include it.
PC Gamer is offline
darkboss
Member
Join Date: Mar 2020
Location: Street (Homeless)
Old 12-19-2022 , 09:09   Re: [CSGO] how to fix this?
Reply With Quote #3

Quote:
Originally Posted by PC Gamer View Post
I don't play CSGO, but try adding this include near the top of your code:
PHP Code:
#include <cstrike> 
You used code that was specific to Counterstrike, but didn't include it.
i tried but i got those errrors

Quote:
// VIP_FastReload.sp(10) : error 100: function prototypes do not match
// VIP_FastReload.sp(19) : error 100: function prototypes do not match
// VIP_FastReload.sp(29) : error 104: cannot find any methods for int
darkboss is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 12-19-2022 , 12:38   Re: [CSGO] how to fix this?
Reply With Quote #4

you have issues with HookEvent and CreateTimer
They don't have the same parameters


https://sm.alliedmods.net/new-api/events/HookEvent
https://sm.alliedmods.net/new-api/events/EventHook

https://sm.alliedmods.net/new-api/timers/CreateTimer
https://sm.alliedmods.net/new-api/timers/Timer
__________________
Marttt is offline
bklol
Member
Join Date: May 2019
Location: on my chair
Old 12-20-2022 , 07:21   Re: [CSGO] how to fix this?
Reply With Quote #5

compile with sm1.11
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike> 

ConVar g_cvfReloadIncrease;

public 
OnPluginStart()
{
    
HookEvent("weapon_fire"Event_WeaponReload);
    
g_cvfReloadIncrease CreateConVar("sm_instant_reload""0""Should VIP get unlimited ammo?");
}

public 
void Event_WeaponReload(Event event, const char[] namebool dontBroadcast)
{
    
int userid GetEventInt(event"userid");
    if(
StrContains(name"reload"false) != -1)
    {
        
CreateTimer(0.0beginuserid);
        return;
    }
}

public 
Action begin(Handle timerany userid)
{
    if (!
g_cvfReloadIncrease.BoolValue)
        return 
Plugin_Handled;

    
int client GetClientOfUserId(userid);
    
int weapon GetEntPropEnt(clientProp_Data"m_hActiveWeapon");

    
char ClassN[32];
    
GetEdictClassname(weaponClassNsizeof(ClassN));

    if (
IsPlayerVip(client) && IsPlayerAlive(client))
    {
        if (
weapon && (weapon == GetPlayerWeaponSlot(clientCS_SLOT_PRIMARY) || weapon == GetPlayerWeaponSlot(clientCS_SLOT_SECONDARY)))
        {
            if (
StrContains(ClassN"weapon_"false) != -1)
            {
                
SetEntProp(weaponProp_Send"m_iClip1"32);
                
SetEntProp(weaponProp_Send"m_iClip2"32);
            }
        }
    }
    return 
Plugin_Continue;
}

stock void StripAllWeapons(int client)
{
    
int iEnt;
    for (
int i 0<= 2i++)
    {
        while ((
iEnt GetPlayerWeaponSlot(clienti)) != -1)
        {
            
RemovePlayerItem(clientiEnt);
            
AcceptEntityInput(iEnt"Kill");
        }
    }
}

stock bool IsPlayerVip(int client)
{
    if (
client <= 0) return false;
    if (
client MaxClients) return false;
    if (!
IsClientConnected(client)) return false;
    if (
IsClientReplay(client)) return false;
    if (
IsFakeClient(client)) return false;
    if (
IsClientSourceTV(client)) return false;
    return 
IsClientInGame(client);

bklol is offline
darkboss
Member
Join Date: Mar 2020
Location: Street (Homeless)
Old 12-27-2022 , 20:03   Re: [CSGO] how to fix this?
Reply With Quote #6

Quote:
Originally Posted by bklol View Post
compile with sm1.11
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike> 

ConVar g_cvfReloadIncrease;

public 
OnPluginStart()
{
    
HookEvent("weapon_fire"Event_WeaponReload);
    
g_cvfReloadIncrease CreateConVar("sm_instant_reload""0""Should VIP get unlimited ammo?");
}

public 
void Event_WeaponReload(Event event, const char[] namebool dontBroadcast)
{
    
int userid GetEventInt(event"userid");
    if(
StrContains(name"reload"false) != -1)
    {
        
CreateTimer(0.0beginuserid);
        return;
    }
}

public 
Action begin(Handle timerany userid)
{
    if (!
g_cvfReloadIncrease.BoolValue)
        return 
Plugin_Handled;

    
int client GetClientOfUserId(userid);
    
int weapon GetEntPropEnt(clientProp_Data"m_hActiveWeapon");

    
char ClassN[32];
    
GetEdictClassname(weaponClassNsizeof(ClassN));

    if (
IsPlayerVip(client) && IsPlayerAlive(client))
    {
        if (
weapon && (weapon == GetPlayerWeaponSlot(clientCS_SLOT_PRIMARY) || weapon == GetPlayerWeaponSlot(clientCS_SLOT_SECONDARY)))
        {
            if (
StrContains(ClassN"weapon_"false) != -1)
            {
                
SetEntProp(weaponProp_Send"m_iClip1"32);
                
SetEntProp(weaponProp_Send"m_iClip2"32);
            }
        }
    }
    return 
Plugin_Continue;
}

stock void StripAllWeapons(int client)
{
    
int iEnt;
    for (
int i 0<= 2i++)
    {
        while ((
iEnt GetPlayerWeaponSlot(clienti)) != -1)
        {
            
RemovePlayerItem(clientiEnt);
            
AcceptEntityInput(iEnt"Kill");
        }
    }
}

stock bool IsPlayerVip(int client)
{
    if (
client <= 0) return false;
    if (
client MaxClients) return false;
    if (!
IsClientConnected(client)) return false;
    if (
IsClientReplay(client)) return false;
    if (
IsFakeClient(client)) return false;
    if (
IsClientSourceTV(client)) return false;
    return 
IsClientInGame(client);

this dont working the speed of reload remain the same
darkboss is offline
darkboss
Member
Join Date: Mar 2020
Location: Street (Homeless)
Old 01-09-2023 , 20:37   Re: [CSGO] how to fix this?
Reply With Quote #7

idk how to solve this can u do it for me plz?
darkboss is offline
alasfourom
Senior Member
Join Date: Feb 2022
Location: Saudi Arabia
Old 01-09-2023 , 23:26   Re: [CSGO] how to fix this?
Reply With Quote #8

I'm not familiar with CSS/CSGO, you could try this one

PHP Code:
#include <sourcemod>
#include <sdkhooks>
#include <sdktools>

#pragma semicolon 1
#pragma newdecls required

#define PLUGIN_VERSION "1.0"

ConVar g_Cvar_Plugin_Enable;
ConVar g_Cvar_Weapons_Speed;

public 
void OnPluginStart()
{
    
CreateConVar ("weapons_speed_version"PLUGIN_VERSION"Weapons Speed"FCVAR_SPONLY FCVAR_NOTIFY FCVAR_DONTRECORD);
    
g_Cvar_Plugin_Enable CreateConVar("enable_weapons_speed""1""Enable Plugin [1 = Enable, 0 = Disable]"FCVAR_NOTIFYtrue0.0true1.0);
    
g_Cvar_Weapons_Speed CreateConVar("set_weapons_speed""2.0""Set The Weapons Speed, Normal Speed Is Equal To 1.0"FCVAR_NOTIFY);
    
AutoExecConfig(true"Weapons Speed");
    
    
HookEvent("weapon_fire"Event_WeaponsSpeed);
    
HookEvent("weapon_reload"Event_WeaponsSpeed);
}

void Event_WeaponsSpeed(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId (event.GetInt("userid"));
    if (!
client || !IsClientInGame(client) || GetClientTeam(client) == || !IsPlayerAlive(client)) return;
    
    if(
g_Cvar_Weapons_Speed.FloatValue 1.0 && g_Cvar_Plugin_Enable.BoolValue)
        
RequestFrame(Weapons_Frameclient);
}

void Weapons_Frame(int client)
{
    
int iWeapon GetEntPropEnt(clientProp_Data"m_hActiveWeapon");
    
float fGameTime GetGameTime();
    
float fSpeedTime GetEntPropFloat(iWeaponProp_Send"m_flNextPrimaryAttack");
    
    
fSpeedTime -= fGameTime;
    
fSpeedTime *= 1.0 g_Cvar_Weapons_Speed.FloatValue;
    
fSpeedTime += fGameTime;
    
    
SetEntPropFloat(iWeaponProp_Send"m_flNextPrimaryAttack"fSpeedTime);
    
SetEntPropFloat(iWeaponProp_Send"m_flPlaybackRate"g_Cvar_Weapons_Speed.FloatValue);
    
SetEntPropFloat(clientProp_Send"m_flNextAttack"0.0);
    
SetEntPropVector(clientProp_Send"m_vecPunchAngle"NULL_VECTOR);

__________________
alasfourom is offline
darkboss
Member
Join Date: Mar 2020
Location: Street (Homeless)
Old 01-31-2023 , 19:33   Re: [CSGO] how to fix this?
Reply With Quote #9

Quote:
Originally Posted by alasfourom View Post
I'm not familiar with CSS/CSGO, you could try this one

PHP Code:
#include <sourcemod>
#include <sdkhooks>
#include <sdktools>

#pragma semicolon 1
#pragma newdecls required

#define PLUGIN_VERSION "1.0"

ConVar g_Cvar_Plugin_Enable;
ConVar g_Cvar_Weapons_Speed;

public 
void OnPluginStart()
{
    
CreateConVar ("weapons_speed_version"PLUGIN_VERSION"Weapons Speed"FCVAR_SPONLY FCVAR_NOTIFY FCVAR_DONTRECORD);
    
g_Cvar_Plugin_Enable CreateConVar("enable_weapons_speed""1""Enable Plugin [1 = Enable, 0 = Disable]"FCVAR_NOTIFYtrue0.0true1.0);
    
g_Cvar_Weapons_Speed CreateConVar("set_weapons_speed""2.0""Set The Weapons Speed, Normal Speed Is Equal To 1.0"FCVAR_NOTIFY);
    
AutoExecConfig(true"Weapons Speed");
    
    
HookEvent("weapon_fire"Event_WeaponsSpeed);
    
HookEvent("weapon_reload"Event_WeaponsSpeed);
}

void Event_WeaponsSpeed(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId (event.GetInt("userid"));
    if (!
client || !IsClientInGame(client) || GetClientTeam(client) == || !IsPlayerAlive(client)) return;
    
    if(
g_Cvar_Weapons_Speed.FloatValue 1.0 && g_Cvar_Plugin_Enable.BoolValue)
        
RequestFrame(Weapons_Frameclient);
}

void Weapons_Frame(int client)
{
    
int iWeapon GetEntPropEnt(clientProp_Data"m_hActiveWeapon");
    
float fGameTime GetGameTime();
    
float fSpeedTime GetEntPropFloat(iWeaponProp_Send"m_flNextPrimaryAttack");
    
    
fSpeedTime -= fGameTime;
    
fSpeedTime *= 1.0 g_Cvar_Weapons_Speed.FloatValue;
    
fSpeedTime += fGameTime;
    
    
SetEntPropFloat(iWeaponProp_Send"m_flNextPrimaryAttack"fSpeedTime);
    
SetEntPropFloat(iWeaponProp_Send"m_flPlaybackRate"g_Cvar_Weapons_Speed.FloatValue);
    
SetEntPropFloat(clientProp_Send"m_flNextAttack"0.0);
    
SetEntPropVector(clientProp_Send"m_vecPunchAngle"NULL_VECTOR);


bro i need the reload of weapon to be fast not the fireshoot ...
darkboss is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 02-01-2023 , 06:52   Re: [CSGO] how to fix this?
Reply With Quote #10

bro



Thiz crap du s0m3 grazy shieet.
PHP Code:

//    "items" -> "2" -> "prefab"        "weapon_elite_prefab"
//  "prefabs" -> "weapon_awp_prefab" -> "attributes" -> "primary clip size"        "30"


#define ITEMSGAMEFILE "scripts/items/items_game.txt"

#define ADMCOMMAND    "access_infinite_ammo" // admin access

#include <cstrike>

enum struct WpnInfo
{
    
ArrayList data;

    
int GetPrimaryClipSize(int itemdefinition)
    {
        if(
this.data == null)
            return -
1;

        
int index this.data.FindValue(itemdefinition0);
        
        if(
index == -1)
            return -
1;
        
        return 
this.data.Get(index1);
    }

    
void StorePrimaryClipSize(int itemdefinitionint size)
    {
        
int tmp[2];
        
tmp[0] = itemdefinition;
        
tmp[1] = size;

        if(
this.data != null)
            
this.data.PushArray(tmpsizeof(tmp));
    }
    
    
void CreateData()
    {
        if(
this.data == null)
            
this.data = new ArrayList(2);
        
        
this.data.Clear();
    }
}
WpnInfo wpninfo;


ConVar cvar;

public 
void OnPluginStart()
{
    
KeyValues items_game = new KeyValues("items_game");

    if(!
items_game.ImportFromFile(ITEMSGAMEFILE))
        
SetFailState("Couldn't import file %s"ITEMSGAMEFILE);

    
wpninfo.CreateData();


    
char key[250], value[100];
    
int itemdefinition = -1;
    
int clip = -1;

    for(
CSWeaponID id CSWeapon_NONEid CSWeapon_MAX_WEAPONSid++)
    {
        
itemdefinition = -1;
        
clip = -1;

        if(!
CS_IsValidWeaponID(id))
            continue;

        
itemdefinition CS_WeaponIDToItemDefIndex(id);

        
Format(keysizeof(key), "items/%i/prefab"itemdefinition);

        if(
items_game.JumpToKey(key))
        {
            
items_game.GetString(NULL_STRINGvaluesizeof(value), "-1");
            
items_game.GoBack();
        }

        
Format(keysizeof(key), "prefabs/%s/attributes/primary clip size"value);


        if(
items_game.JumpToKey(key))
        {
            
items_game.GetString(NULL_STRINGvaluesizeof(value), "-1");
            
items_game.GoBack();

            
clip StringToInt(value);
        }

        if(
clip == -1)
            continue;

        
//PrintToServer("itemdefinition %i, clip %i", itemdefinition, clip);
        
wpninfo.StorePrimaryClipSize(itemdefinitionclip);

    }

    
delete items_game;

    
cvar CreateConVar("sm_instant_reload""0""Should VIP get unlimited ammo?");

    
HookEvent("weapon_fire"weapon_fire);
    
HookEvent("weapon_fire_on_empty"weapon_fire);
}

public 
void weapon_fire(Event event, const char[] namebool dontBroadcast)
{
    if(!
cvar.BoolValue)
        return;

    
int userid event.GetInt("userid");
    
int client GetClientOfUserId(userid);



    if(
IsFakeClient(client) || !CheckCommandAccess(clientADMCOMMAND0true))
        return;



    
int m_hActiveWeapon GetEntPropEnt(clientProp_Send"m_hActiveWeapon");

    if(!
HasEntProp(m_hActiveWeaponProp_Send"m_iItemDefinitionIndex"))
        return;

    if(
wpninfo.data == null)
        return;

    
int itemdefinition GetEntProp(m_hActiveWeaponProp_Send"m_iItemDefinitionIndex");

    
int m_iClip1 wpninfo.GetPrimaryClipSize(itemdefinition);

    
//PrintToServer("Client %N weapon %i GetPrimaryClipSize %i  itemdefinition %i", client, m_hActiveWeapon, m_iClip1, itemdefinition);

    
if(m_iClip1 != -1)
        
SetEntProp(m_hActiveWeaponProp_Send"m_iClip1"m_iClip1+1);


Add this "word" override in your admin_overrides.cfg or in one of admin groups override.
Code:
"access_infinite_ammo"
By default, all humans get infinite ammo when cvar is enabled.

- This not speed up reloading, I have got lot of problem with those animations.
The idea is set Clip1 count to right size, so you can't start reload.

Plugin read weapons Clip1 default size, from items_game.txt file.

For now, only shooting reset clip count.
I have not much time to add more triggers like weapon switch etc. etc.
__________________
Do not Private Message @me
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 04:15.


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