Amxx studio error!
Hii guys i am making a plugin.
I needed help. I have scripted my plugin but theres an error while compiling... It says smthing about line 36. And guys i shall send the code only on request pls help me and tell me whats wrong... |
Re: Amxx studio error!
Post the code and the error
|
Re: Amxx studio error!
Sir yamikitou pls understand I am making a new plugin but if it leaks ill have nothing left so pls can I send u the code personally?
|
Re: Amxx studio error!
No, if you want assistance on this Public forum, post all the needed details publicly
|
Re: Amxx studio error!
Quote:
Nobody wants to steal your code because someone already made it and/or someone can make it without even looking at your code. At least copy the error produced so we can take guesses. |
Re: Amxx studio error!
/* Plugin generated by AMXX-Studio */
#include <amxmodx> #include <amxmisc> #include <fun> #include <cstrike> #define PLUGIN "Headshot Double Frag" #define VERSION "1.0" #define AUTHOR "Phantom~" new toggle new frags new sound new pun_list[][] { "%s has turned %s head into a red jello!!" "%s gave %s a glimpse of his cold blooded murder !!!!" }; new plugin_precache() { precache_sound("sound/headshot.wav") } public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_event("deathmsg", "hook_death", "a"); toggle = register_pcvar("hsdf_enabled" "1"); sounds = register_cvar("kdf_sounds","1"); frags = register_pcvar("hsdf_frags" "1"); } public hook_death() { if(get_pcvar_num(toggle) != 1) return PLUGIN_HANDLED; new amount = 0; new killer = read_data(1); new victim = read_data(2); new kname[32]; get_user_name(killer,kname,31); new vname[32]; get_user_name(victim,vname,31); new weapon[24]; new namount[32]; read_data(4,weapon,23); if(weapon[0] == 'k' && get_user_team(killer) != get_user_team(victim)) { inc_frag(killer); if(get_pcvar_num(getmoney) == 1) { amount = cs_get_user_frags(victim)*random(5)/4; } num_to_str(amount, namount, 32); if(bsounds(sounds)) client_cmd(0,"spk misc/headshot"); } return PLUGIN_HANDLED; } inc_frag(index) { if(!is_user_connected(index)) return; set_user_frags(index,get_user_frags(index)+ge t_pcvar_num(frags)); } bool: bsounds(pcvar) { if(get_pcvar_num(pcvar) == 1) return true; return false; } This is the code its not compiling. The Errors: Welcome to the AMX Mod X 1.8.1-300 Compiler. Copyright (c) 1997-2013 ITB CompuPhase, AMX Mod X Team Error: Start of function body without function header on line 17 Error: Invalid function or declaration on line 20 Error: Expected token: ";", but found "(" on line 22 Error: Undefined symbol "register_pcvar" on line 31 Warning: Expression has no effect on line 31 Error: Expected token: ";", but found ")" on line 31 Error: Invalid expression, assumed zero on line 31 Error: Too many error messages on one line on line 31 Compilation aborted. 7 Errors. Could not locate output file (compile failed). |
Re: Amxx studio error!
Done.
Attention you are not using pun_list and you cant register pcvar you need to regist cvar and use get_pcvar_num or something. Code:
|
Re: Amxx studio error!
I have a couple comments still.
Code:
Code:
Code:
You could also add "3=1" to make it only for headshots. Here's a full example that will only get called if the killer is not the server/map/worldspawn (suicide), it's a headshot and it's done with a knife: Code:
To make sure the killer is a player and not an entity you should check if the player is in the range of 1 and maxplayers. Create a global variable named g_maxplayers and retrieve get_maxplayers() on plugin_init(). Assign that value to the global variable. In the DeathMsg event you need to check if ( killer <= g_maxplayers ) before running any player based functions (like get_user_name(), get_user_team() or get_user_frags()) on that id. I can see that it's not done so I will stop there for now and let you try for yourself a bit. Just come back if you have more problems. But at least register a cvar for the getmoney pointer because you will get runtime errors if trying to retrieve a value on a cvar pointer that doesn't exist. |
Re: Amxx studio error!
Yes sound/ is not needed amxx assumes the sound is in sound folder.
My mistake :P |
Re: Amxx studio error!
Hii ty guys I am a newbie to this and ty for correcting errors so I shall be posting the plugin asap :D
|
| All times are GMT -4. The time now is 06:04. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.