Page 1 of 1
Necklace and Helm
Posted: Mon Feb 02, 2009 8:09 am
by xiownthisplacex
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.
Re: Necklace and Helm
Posted: Mon Feb 02, 2009 9:06 am
by YamiKaitou
Look at the code of an old version, then alter your copy to mimic that
Re: Necklace and Helm
Posted: Mon Feb 02, 2009 11:41 am
by xiownthisplacex
ok, but which file(s)? i haven't used this code before :/
thanks
Re: Necklace and Helm
Posted: Mon Feb 02, 2009 12:18 pm
by whosyourdaddy
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
Re: Necklace and Helm
Posted: Mon Feb 02, 2009 12:53 pm
by xiownthisplacex
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.
Re: Necklace and Helm
Posted: Mon Feb 02, 2009 1:05 pm
by whosyourdaddy
did u recompile the plugin and put it into ur plugins folder?
Re: Necklace and Helm
Posted: Mon Feb 02, 2009 1:12 pm
by xiownthisplacex
ooo, no, didn't realize that i needed to recompile it

thanks hehe
Re: Necklace and Helm
Posted: Mon Feb 02, 2009 1:30 pm
by xiownthisplacex
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?
Re: Necklace and Helm
Posted: Mon Feb 02, 2009 1:37 pm
by whosyourdaddy
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;
Re: Necklace and Helm
Posted: Mon Feb 02, 2009 4:13 pm
by xiownthisplacex
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?
Re: Necklace and Helm
Posted: Mon Feb 02, 2009 5:47 pm
by whosyourdaddy
you can do is_user_admin(id)
Re: Necklace and Helm
Posted: Mon Feb 02, 2009 7:18 pm
by xiownthisplacex
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
Re: Necklace and Helm
Posted: Wed Feb 04, 2009 1:53 am
by whosyourdaddy
for the is_user_admin part ya