Raised This Month: $ Target: $400
 0% 

Instagib plugin showing lots of errors


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DarlD
Senior Member
Join Date: Aug 2004
Old 10-18-2005 , 12:54   Instagib plugin showing lots of errors
Reply With Quote #1

Ok so here is what i've got right now
Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <fun> #define PLUGIN "Meta-Addons" #define VERSION "0.1" #define AUTHOR "Meta" // Setting all the cvars and others here. public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_event("ResetHUD","event_resethud","b")     register_cvar("ma_details", "1")     register_cvar("ma_instagib", "0")     register_cvar("ma_weed", "1"); } /* Starting the plugins functions */ public event_resethud(id) {     if(is_user_connected(id)) {         set_task(0.1,"ma_instagib",id)     } } // ma_details is set here public ma_details(id) {             } // ma_instagib is set here public ma_instagib(id) {     if ( ma_instagib == 1 )     show_hudmessage(id,"Meta-Addons: Instagib Mode has been activated!")     if(is_user_alive(id))          set_user_health(id,20)     cs_set_user_money(id,1,0)          strip_user_weapons(id)          give_item(id,"weapon_scout")          cs_set_weapon_ammo(id,60); }

why is it not compiling i keep getting shitloads of errors!
__________________
DarlD is offline
Send a message via MSN to DarlD
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 10-18-2005 , 14:50  
Reply With Quote #2

1.
Code:
if ( ma_instagib == 1 )
I'm assuming you want to check the cvar's value, in which case you have to use get_cvar_num. So it would look like this instead:
Code:
if ( get_cvar_num("ma_instagib") == 1 )
.

2. You use some cs_* commands without including cstrike, so just add
Code:
#include <cstrike>
to your includes list.

3. It looks like maybe some of your if statements should have more than one condition, which means you have to use curly braces to define what happens inside of them. As of now it will only execute the first line after the if statement if the conidition is true, which looks like it will cause a lot of weird things if the statements aren't true.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
DarlD
Senior Member
Join Date: Aug 2004
Old 10-18-2005 , 15:42  
Reply With Quote #3

Ok it compiles now, but weidly, when i type amx_help 1, 11, 21, 31, 41, 51, 61, i dont see my cvars (ex.: ma_instagib)

Code:
public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_event("ResetHUD","event_resethud","b")     register_cvar("ma_details", "1")     register_cvar("ma_instagib", "0")     register_cvar("ma_weed", "1");^

did i forget anything?

Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <cstrike> #include <fun> #define PLUGIN "Meta-Addons" #define VERSION "0.1" #define AUTHOR "Meta" // Setting all the cvars and others here. public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_event("ResetHUD","event_resethud","b")     register_cvar("ma_details", "1")     register_cvar("ma_instagib", "0")     register_cvar("ma_weed", "1"); } /* Starting the plugins functions */ public event_resethud(id) {     if(is_user_connected(id)) {         set_task(0.1,"ma_instagib",id)     } } // ma_details is set here public ma_details(id) {             } // ma_instagib is set here public ma_instagib(id) {     if ( get_cvar_num("ma_instagib") == 1 )     show_hudmessage(id,"Meta-Addons: Instagib Mode has been activated!")     if(is_user_alive(id))         set_user_health(id,20)     cs_set_user_money(id,1,0)         strip_user_weapons(id)         give_item(id,"weapon_scout")         cs_set_weapon_ammo(id,60); }
__________________
DarlD is offline
Send a message via MSN to DarlD
MistaGee
Senior Member
Join Date: Aug 2004
Location: Germany (Fulda)
Old 10-18-2005 , 16:13  
Reply With Quote #4

checked "amxx cvars"? it's a lot easier than using the help thingy and shows your cvars for sure if they are correctly registered...

BTW: there should be an empty statement error when you compile cuz you didn't do anything in this ma_details function. Maybe (maybe...) this screwz up the compiler so that your plugin isn't correctly compiled (I've had this once). Do something there to prevent this...

Greetz MGee
__________________
Ich hab nie behauptet dass ich kein Genie bin!
Mumble-Django: A web interface for Mumble
MistaGee is offline
Send a message via ICQ to MistaGee
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 10-18-2005 , 17:19  
Reply With Quote #5

Quote:
Originally Posted by DarlD
Ok it compiles now, but weidly, when i type amx_help 1, 11, 21, 31, 41, 51, 61, i dont see my cvars (ex.: ma_instagib)
cvars are data stored by the server, not commands. amx_help only shows commands registered by amxx.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
DarlD
Senior Member
Join Date: Aug 2004
Old 10-18-2005 , 17:58  
Reply With Quote #6

ok but what is wrong??

how come my cvars arent registered???
__________________
DarlD is offline
Send a message via MSN to DarlD
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 10-18-2005 , 18:04  
Reply With Quote #7

They are, but they don't show up in amx_help because they are cvars, not commands.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
DarlD
Senior Member
Join Date: Aug 2004
Old 10-18-2005 , 18:06  
Reply With Quote #8

ok so how to i creat commands?

register_concmd?

Code:
/* Plugin Created by DarlD on amxmodx forums, Real nick = Meta */ #include <amxmodx> #include <amxmisc> #include <cstrike> #include <fun> #define PLUGIN "Meta-Addons" #define VERSION "0.1" #define AUTHOR "Meta" // Setting all the cvars and others here. public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_event("ResetHUD","event_resethud","b")     register_cvar("ma_details", "1")     register_cvar("ma_instagib", "0")     register_concmd("ma_instagib","instagib",ADMIN_KICK,"Instagib command")     register_cvar("ma_weed", "1"); } /* Starting the plugins functions */ public event_resethud(id) {     if(is_user_connected(id)) {         set_task(0.1,"ma_instagib",id)     } } // ma_details is set here public ma_details(id) {     return PLUGIN_CONTINUE } // ma_instagib is set here public ma_instagib(id) {     if ( get_cvar_num("ma_instagib") == 1 )     show_hudmessage(id,"Meta-Addons: Instagib Mode has been activated!")     if(is_user_alive(id))     set_user_health(id,1)     cs_set_user_money(id,1,0)     strip_user_weapons(id)     give_item(id,"weapon_scout")     cs_set_weapon_ammo(id,60);         return PLUGIN_CONTINUE }

it still aint working even with the register_concmd
__________________
DarlD is offline
Send a message via MSN to DarlD
Zenith77
Veteran Member
Join Date: Aug 2005
Old 10-18-2005 , 18:42  
Reply With Quote #9

register_clcmd() only allow clients to run this command


register_concmd() allows the server and clients to run commands
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
DarlD
Senior Member
Join Date: Aug 2004
Old 10-18-2005 , 19:08  
Reply With Quote #10

yeah i know that, but the register_concmd in my plugin doesnt seam to work. any ideas
__________________
DarlD is offline
Send a message via MSN to DarlD
Reply


Thread Tools
Display Modes

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 23:48.


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