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

HL2DM Plugin wouldn't compile, now won't work...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ventus
Junior Member
Join Date: Jul 2014
Old 07-06-2014 , 11:35   HL2DM Plugin wouldn't compile, now won't work...
Reply With Quote #1

Hi, i have been trying to build a simple plugin for my server, mostly to play 4fun, that regenerates your SMG's Grenades when sm_ifrag is used, in HL2DM (it's also supposed to regenerate regular Grenades, but i wanted to try the SMG first).
At first, the plugin wouldn't compile because of a few errors, the initial code looked something like this:
Code:
#pragma semicolon 1

#include <sdktools>
#include <sdkhooks>

#define PLUGIN_VERSION "1.0"


public Plugin:myinfo =
{
	name = "Infinite Grenades",
	author = "Ventus",
	
	description = "Infinite SMG secondary & Grenades",
	
	version = PLUGIN_VERSION,
	url="https://steamcommunity.com/id/ventusik"
}

public OnPluginStart ()
{
	CreateConVar ("sm_ifrag_version", PLUGIN_VERSION, "Infinite Grenades", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_NOTIFY|FCVAR_DONTRECORD);
	RegAdminCmd ("sm_ifrag", Command_SetIFRAG, ADMFLAG_CHEATS, "Give Infinite Grenades to the target - Usage: sm_ifrag");
	AutoExecConfig(true, "InfiniteGrenades");
}

////////////
//Commands//
////////////

public Action:Command_SetIFRAG(client, args)
{
	GivePlayerAmmo(client, 100,GetEntProp(GetPlayerWeaponSlot(client, 5),Prop_Send, "m_iPrimaryAmmoType"), false);
	//native GivePlayerAmmo (client, 100, SMG1_Grenade, true);
	//native GivePlayerAmmo (client, 100, grenade, true);
	//GivePlayerAmmo(client, 123, GetEntProp(GetPlayerWeaponSlot(client, TFWeaponSlot_Secondary), Prop_Send, "m_iPrimaryAmmoType"), true); 
	return Plugin_Handled;
}
Obviously, that didn't work, and i'm not sure how it was supposed to work
But anyway, i was able to compile doing this:
Code:
#pragma semicolon 1

#include <sdktools>
#include <sdkhooks>

#define PLUGIN_VERSION "1.0"


public Plugin:myinfo =
{
	name = "Infinite Grenades",
	author = "Ventus",
	
	description = "Infinite SMG secondary & Grenades",
	
	version = PLUGIN_VERSION,
	url="https://steamcommunity.com/id/ventusik"
}

public OnPluginStart ()
{
	CreateConVar ("sm_ifrag_version", PLUGIN_VERSION, "Infinite Grenades", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_NOTIFY|FCVAR_DONTRECORD);
	RegAdminCmd ("sm_ifrag", Command_SetIFRAG, ADMFLAG_CHEATS, "Give Infinite Grenades to the target - Usage: sm_ifrag");
	AutoExecConfig(true, "InfiniteGrenades");
}

////////////
//Commands//
////////////

public Action:Command_SetIFRAG(client, args)
{
	GivePlayerAmmo(client, 100,GetPlayerWeaponSlot(client, 5), false);
	//native GivePlayerAmmo (client, 100, SMG1_Grenade, true);
	//native GivePlayerAmmo (client, 100, grenade, true);
	//GivePlayerAmmo(client, 123, GetEntProp(GetPlayerWeaponSlot(client, TFWeaponSlot_Secondary), Prop_Send, "m_iPrimaryAmmoType"), true); 
	return Plugin_Handled;
}
But the problem now is that the plugin won't work... I know SourceMod can execute it because typing sm_ifrag in the console won't bring an "unknown command" error...
So i'm out of clues now... How exactly is "GivePlayerAmmo()" supposed to work? I'm aware of the syntax, "GivePlayerAmmo(client, amount, ammotype, bool:suppressSound=false);", but nothing i have tried worked so far...
__________________
Ventus is offline
Send a message via Skype™ to Ventus
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 07-06-2014 , 12:02   Re: HL2DM Plugin wouldn't compile, now won't work...
Reply With Quote #2

-_-"
what is this?
Quote:
GivePlayerAmmo(client, 100,GetPlayerWeaponSlot(client, 5), false);
if you cant compile it then give us what the compiler say about your plugin.
__________________
If i happen to insulted you unintentionally,
it was me and Google Translate who did it.
GsiX is offline
Ventus
Junior Member
Join Date: Jul 2014
Old 07-06-2014 , 13:11   Re: HL2DM Plugin wouldn't compile, now won't work...
Reply With Quote #3

Ok, so, i went into compiling the faulty code and it worked today 0.o (yesterday it did not). But anyway, it was worse than the other "successive" one, this time, sm_ifrag did give back the "Unknown command" error.

Quote:
what is this?
Quote:
GivePlayerAmmo(client, 100,GetPlayerWeaponSlot(client, 5), false);
Well, GivePlayerAmmo is a function from the current stable snapshots... I'm not sure if that's what you meant, but i think that's it.
In any case, the errors from yesterday were something about lines 33 and 36, more specifically, the GetPlayerWeaponSlot function (although i don't remember what was the error...).
__________________
Ventus is offline
Send a message via Skype™ to Ventus
Ventus
Junior Member
Join Date: Jul 2014
Old 07-07-2014 , 23:23   Re: HL2DM Plugin wouldn't compile, now won't work...
Reply With Quote #4

Anyone? Please, i need help ;-;
(sorry for "bump" posting, i'm a little desperate)
__________________
Ventus is offline
Send a message via Skype™ to Ventus
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 07-08-2014 , 03:26   Re: HL2DM Plugin wouldn't compile, now won't work...
Reply With Quote #5

I m not sure what the problem is as I m replying from mobile phone. Anyway, have you try #include <sourcemod>. Guessing here since I can compile nothing for you.
__________________
If i happen to insulted you unintentionally,
it was me and Google Translate who did it.
GsiX is offline
Ventus
Junior Member
Join Date: Jul 2014
Old 07-08-2014 , 03:36   Re: HL2DM Plugin wouldn't compile, now won't work...
Reply With Quote #6

Well, i'll be testing tomorrow, i'm on the phone too
Could work, but i hardly think so... I mean, all functions in there are based on sdkhooks....
__________________

Last edited by Ventus; 07-08-2014 at 03:41. Reason: spelled wrong
Ventus is offline
Send a message via Skype™ to Ventus
Ventus
Junior Member
Join Date: Jul 2014
Old 07-08-2014 , 03:48   Re: HL2DM Plugin wouldn't compile, now won't work...
Reply With Quote #7

In any case, can you check if i'm right? The 5 in GetPlayerWeaponSlot refers to the smg grenade, as:
0 - Crowbar;
1 - Stunstick;
2 - GGun;
3 - Pistol;
4 - Revolver;
5 - SMG;

I have no idea if that is correct, and i also decided to use 5 to trh it first on the primary ammo in the SMG.
__________________
Ventus is offline
Send a message via Skype™ to Ventus
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 14:23.


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