Raised This Month: $ Target: $400
 0% 

Help my noob code please!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 05-01-2006 , 16:20   Help my noob code please!
Reply With Quote #1

Hi, could someone tell me what I screwed up on here... I am new to coding like this, I know some Pascal, Java, and Visual Basic from school... so i'm not a total noob coder ! Anyhow, this fails to compile... it is a plugin for the mod TFC and is supposed to check the super nailguns ammo, and if it goes below 50 ammo, it should keep the ammo at 50.

Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <tfcx> #define PLUGIN "NoName" #define VERSION "1.0" #define AUTHOR "hlstriker" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     return PLUGIN_CONTINUE } public ammoCheck() {     tfc_getweaponbammo ( id, TFC_WPN_SUPERNG )     If (tfc_getweaponbammo < 50)    {         tfc_setweaponbammo ( id, TFC_WPN_SUPERNG, 50)     }     return PLUGIN_CONTINUE }
hlstriker is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 05-01-2006 , 16:22  
Reply With Quote #2

You need to find a list of TFC events. Although they should be the same as regular HL events.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 05-01-2006 , 16:23  
Reply With Quote #3

You don't ever set up the variable "id"

I don't know if that function is a forward or not I don't know tfc.

but if you had
public ammoCheck(id)
it would compile
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 05-01-2006 , 16:28   Re: Help my noob code please!
Reply With Quote #4

You could try this:
Code:
#include <amxmodx> #include <amxmisc> #include <tfcx> #define PLUGIN "NoName" #define VERSION "1.0" #define AUTHOR "hlstriker" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_event("AmmoX" , "ammoCheck" , "b");     return PLUGIN_CONTINUE } public ammoCheck(id) {     new ammo = tfc_getweaponbammo ( id, TFC_WPN_SUPERNG )     if (ammo < 50) {         tfc_setweaponbammo ( id, TFC_WPN_SUPERNG, 50)     }     return PLUGIN_CONTINUE }
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 05-01-2006 , 16:51  
Reply With Quote #5

Thanks for the replies. Even with what you posted v3x, it still compiles with errors.

Quote:
/home/users/amxmodx/tmp3/phpWfdBJ1.sma(20) : error 017: undefined symbol "id"
/home/users/amxmodx/tmp3/phpWfdBJ1.sma(20) : warning 215: expression has no effect
/home/users/amxmodx/tmp3/phpWfdBJ1.sma(20) : error 001: expected token: ";", but found ")"
/home/users/amxmodx/tmp3/phpWfdBJ1.sma(20) : error 029: invalid expression, assumed zero
/home/users/amxmodx/tmp3/phpWfdBJ1.sma(20) : fatal error 107: too many error messages on one line
hlstriker is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 05-01-2006 , 16:52  
Reply With Quote #6

It compiles fine for me.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 05-01-2006 , 17:00  
Reply With Quote #7

I think he still left out the (id) in the function header.
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 05-01-2006 , 17:01  
Reply With Quote #8

Hmm, i'm using the compiler on the amxmodx.org website. The AMXX-Studio doesn't seem to work for me.

I got the id in the function header too.
hlstriker is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 05-01-2006 , 17:13  
Reply With Quote #9

post your current code
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 05-01-2006 , 17:20  
Reply With Quote #10

I got it working, I tested exactly what v3x has posted to compile, and that didn't work. I guess my firefox doesn't like to upload the sma files, I had to copy and paste the code to compile it.

Anyhow, the plugin works, but sometimes I see the ammo go into the 40s then shoot back up to 50. Is there a way to make it always be at 50?

Thank you everyone for your help, i'm sure i'll be needing you all later on ! I'm really motivated to learn this.
hlstriker is offline
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 05:05.


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