Necklace and Helm

Read log files for errors! If this fails, come here for help

Moderator: Forum Moderator

Post Reply
xiownthisplacex
Peon
Posts: 8
Joined: Tue May 22, 2007 2:49 am

Necklace and Helm

Post by xiownthisplacex » Mon Feb 02, 2009 8:09 am

Hey everyone. I searched for this, but nothing came up about it..
I would like to change the Necklace and Helm to if someone buys them, they are not charged, they can be used always until you die.. How can this be done? Thanks in advance.

User avatar
YamiKaitou
Forum Moderator
Forum Moderator
Posts: 1925
Joined: Wed Feb 01, 2006 4:33 pm
Contact:

Re: Necklace and Helm

Post by YamiKaitou » Mon Feb 02, 2009 9:06 am

Look at the code of an old version, then alter your copy to mimic that
Image

No support via PM or Email

xiownthisplacex
Peon
Posts: 8
Joined: Tue May 22, 2007 2:49 am

Re: Necklace and Helm

Post by xiownthisplacex » Mon Feb 02, 2009 11:41 am

ok, but which file(s)? i haven't used this code before :/
thanks

whosyourdaddy
Spell Breaker
Posts: 398
Joined: Sun Apr 27, 2008 10:11 pm

Re: Necklace and Helm

Post by whosyourdaddy » Mon Feb 02, 2009 12:18 pm

items.inl remove

Code: Select all

g_iFlag[ITEM_NECKLACE]	|= ITEM_CHARGEABLE;
g_iFlag[ITEM_HELM]		|= ITEM_CHARGEABLE;

case ITEM_NECKLACE:
{
	g_iNecklaceCharges[id] += NECKLACE_CHARGES;
}

case ITEM_HELM:
{
	g_iHelmCharges[id] += HELM_CHARGES;
}
case ITEM_NECKLACE:
{
	g_iNecklaceCharges[id] = 0;
}
case ITEM_HELM:
{
	g_iHelmCharges[id] = 0;
}
in events.inl remove

Code: Select all

// Lets remove a charge from the helm!
ITEM_RemoveCharge( iVictim, ITEM_HELM );
in ultimates.inl remove

Code: Select all

ITEM_RemoveCharge( id, ITEM_NECKLACE );
in items.h remove

Code: Select all

#define NECKLACE_CHARGES	4
#define HELM_CHARGES		3
new g_iNecklaceCharges[33];							// Holds the number of charges left in the player's necklace
new g_iHelmCharges[33];								// Holds the number of charges left in the player's helm
thats pretty much it
Image

xiownthisplacex
Peon
Posts: 8
Joined: Tue May 22, 2007 2:49 am

Re: Necklace and Helm

Post by xiownthisplacex » Mon Feb 02, 2009 12:53 pm

thanks for the reply.
i did what whosyourdaddy said to do, i restarted my server with "rcon quit" and it still appears the 4 and 3 charges.. also, in items.inl i changed

Code: Select all

	ITEM_COST[ITEM_HELM]	    = 3000;			// Helm of Excellence
to

Code: Select all

	ITEM_COST[ITEM_HELM]	    = 1500;			// Helm of Excellence
but it still appears as 3000, i don't know why if i changed it and restarted my server.. any ideas?
thanks again.

whosyourdaddy
Spell Breaker
Posts: 398
Joined: Sun Apr 27, 2008 10:11 pm

Re: Necklace and Helm

Post by whosyourdaddy » Mon Feb 02, 2009 1:05 pm

did u recompile the plugin and put it into ur plugins folder?
Image

xiownthisplacex
Peon
Posts: 8
Joined: Tue May 22, 2007 2:49 am

Re: Necklace and Helm

Post by xiownthisplacex » Mon Feb 02, 2009 1:12 pm

ooo, no, didn't realize that i needed to recompile it :D
thanks hehe

xiownthisplacex
Peon
Posts: 8
Joined: Tue May 22, 2007 2:49 am

Re: Necklace and Helm

Post by xiownthisplacex » Mon Feb 02, 2009 1:30 pm

it gives me an error when trying to complie..

Code: Select all

war3ft/war3ft.inl(1911) : error 017: undefined symbol "g_iNecklaceCharges"
i'm guessing that there is more code to be removed besides the one you mentioned?

whosyourdaddy
Spell Breaker
Posts: 398
Joined: Sun Apr 27, 2008 10:11 pm

Re: Necklace and Helm

Post by whosyourdaddy » Mon Feb 02, 2009 1:37 pm

xiownthisplacex wrote:it gives me an error when trying to complie..

Code: Select all

war3ft/war3ft.inl(1911) : error 017: undefined symbol "g_iNecklaceCharges"
i'm guessing that there is more code to be removed besides the one you mentioned?
ya sorry forgot one line just go into war3ft.inl and remove

Code: Select all

	g_iNecklaceCharges[id]			= 0;
	g_iHelmCharges[id]				= 0;
Image

xiownthisplacex
Peon
Posts: 8
Joined: Tue May 22, 2007 2:49 am

Re: Necklace and Helm

Post by xiownthisplacex » Mon Feb 02, 2009 4:13 pm

thanks, that seemed to work!
another thing though :p how can i check to see if the user is an admin? like, if i want to disable mole for all users besides admin, what kind of code would i use to check that validation?

whosyourdaddy
Spell Breaker
Posts: 398
Joined: Sun Apr 27, 2008 10:11 pm

Re: Necklace and Helm

Post by whosyourdaddy » Mon Feb 02, 2009 5:47 pm

you can do is_user_admin(id)
Image

xiownthisplacex
Peon
Posts: 8
Joined: Tue May 22, 2007 2:49 am

Re: Necklace and Helm

Post by xiownthisplacex » Mon Feb 02, 2009 7:18 pm

hmm, you mean like this? :

Code: Select all

// Observe Chat for players wanting to play sounds
// Plugin by MistaGee
//
// Whenever a player sez "* something", the server will look for
// /sounds/misc/something.wav. If the file exists, all players
// will play it (if they have got it).
//

#include <amxmodx>
#include <amxmisc>

public plugin_init(){
	register_plugin("Chat Sounds", "1.0", "MistaGee")
	register_concmd("say", "cmd_chatsnd", -1, " ")
	register_cvar("amx_csnd_dir", "misc")	// Directory to search the sounds in
	register_cvar("amx_csnd_hide", "0")		// Alows to hide the sound CMD if it is valid
	}

public cmd_chatsnd(id,level,cid){
	
	new csnd_saidtext[32]
	
	read_argv(1, csnd_saidtext, 31)
	
	// Only procees if said text starts with a /
	// prevents unwanted sound playing
///////////////////////////////////////////////////////////////////// CODE IS HERE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
	if(is_user_admin(id) && csnd_saidtext[0] != '/'){      //////////////////// CODE IS HERE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
		// Put together the sound's filename
		new csnd_file[63]
		new csnd_dir[32]
		get_cvar_string("amx_csnd_dir", csnd_dir, 32)
		format(csnd_file, 62, "sound/%s%s.wav", csnd_dir, csnd_saidtext)
		
		if(file_exists(csnd_file)){
			// Get the player's name who started all this shit
			new plname[32]
			get_user_name(id, plname, 31)
			
			// Get all players
			new players[32], plnum = 0
			get_players(players, plnum)
			for(new i = 0; i < plnum; i++){
				console_print(players[i], "[AMXX] %s asked to play sound '%s'!", plname, csnd_file)
				console_cmd(players[i], "spk %s", csnd_file)
				}// play the sound to each player
			
			// To hide the said CMD, suppress further scripts
			if(get_cvar_num("amx_csnd_hide")) return PLUGIN_HANDLED
		
		} // If the wanted file exists
		
		// Function that tests if a file exists: bool:file_exists(file[])
	
	} // slash-start check
	return PLUGIN_CONTINUE
	} // Function :: cmd_chatsnd

whosyourdaddy
Spell Breaker
Posts: 398
Joined: Sun Apr 27, 2008 10:11 pm

Re: Necklace and Helm

Post by whosyourdaddy » Wed Feb 04, 2009 1:53 am

for the is_user_admin part ya
Image

Post Reply