Raised This Month: $ Target: $400
 0% 

Help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CodeBreaker
Junior Member
Join Date: Mar 2006
Old 03-30-2006 , 23:52   Help
Reply With Quote #1

I need help coding this, First time at AMXX *hides*

Code:
#include <amxmodx> #include <amxmisc> #include <fun> #define PLUGIN "Client Gunz" #define VERSION "1.0" #define AUTHOR "CodeBreaker" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR) } public give_items(id,level,cid) {     if(!(get_user_access(id,&ADMIN_KICK)) {         client_print(id, print_center, "[AMXX] Access not granted.")         return PLUGIN_HANDLED     }     else     {         give_item(id,"weapon_m4a1")         give_item(id,"weapon_m4a1")         give_item(id,"weapon_m4a1")         give_item(id,"weapon_m4a1")         client_print(id,print_chat,"[AMXX] Added Weapon - M4A1")     }

I know there is some stuff missing, but why am I getting errors with that stuff?
__________________
Code:
If you like hawt sawce, paste this into your sig.
CodeBreaker is offline
capndurk
Senior Member
Join Date: Feb 2006
Old 03-30-2006 , 23:58  
Reply With Quote #2

Under the give_items function, put this

Code:
if(!cmd_access(id,level,cid,num) // replace num with the number of arguments (including command) {      return PLUGIN_HANDLED; }

instead of

Code:
if(!(get_user_access(id,&ADMIN_KICK)) {         client_print(id, print_center, "[AMXX] Access not granted.")         return PLUGIN_HANDLED     }

You also need a register_concmd function in plugin_init() to call the give_items function with a function in your console. ;)
__________________
I have left these forums because a certain respected member has been acting immaturely lately and has decided that I am not welcome in this community.
capndurk is offline
CodeBreaker
Junior Member
Join Date: Mar 2006
Old 03-31-2006 , 00:12  
Reply With Quote #3

Ok, I updated my code, Still get errors.

Code:
#include <amxmodx> #include <amxmisc> #include <fun> #define PLUGIN "Client Gunz" #define VERSION "1.0" #define AUTHOR "CodeBreaker" public give_items(id,level,cid) {     if(!cmd_access(id,level,cid,2) {         client_print(id,print_chat,"[AMXX] No access!")         return PLUGIN_HANDLED     }     give_item(id,"weapon_m4a1")     give_item(id,"weapon_m4a1")     give_item(id,"weapon_m4a1")     give_item(id,"weapon_m4a1")     client_print(id,print_center,"[AMXX] Weapon Added!") }     public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_concmd("amx_weapons","give_items","ADMIN_KICK"," : Gives you some weapons") }

Thanks for the fast help.
__________________
Code:
If you like hawt sawce, paste this into your sig.
CodeBreaker is offline
capndurk
Senior Member
Join Date: Feb 2006
Old 03-31-2006 , 00:21  
Reply With Quote #4

Post your errors.
__________________
I have left these forums because a certain respected member has been acting immaturely lately and has decided that I am not welcome in this community.
capndurk is offline
CodeBreaker
Junior Member
Join Date: Mar 2006
Old 03-31-2006 , 00:24  
Reply With Quote #5

Noob question, how do I post my errors?
__________________
Code:
If you like hawt sawce, paste this into your sig.
CodeBreaker is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 03-31-2006 , 00:27  
Reply With Quote #6

Use the web compiler, compile the plugin, copy/paste->post the error messages that it outputs.
__________________
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
CodeBreaker
Junior Member
Join Date: Mar 2006
Old 03-31-2006 , 00:27  
Reply With Quote #7

/home/users/amxmodx/tmp3/phpftgCmc.sma(12) : error 001: expected token: ")", but found "{"
/home/users/amxmodx/tmp3/phpftgCmc.sma(21) : warning 209: function "give_items" should return a value
/home/users/amxmodx/tmp3/phpftgCmc.sma(25) : error 035: argument type mismatch (argument 3)
__________________
Code:
If you like hawt sawce, paste this into your sig.
CodeBreaker is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 03-31-2006 , 00:27  
Reply With Quote #8

Add "return PLUGIN_HANDLED" at the end of your give_items function.

And change 2 to 1 here:
Code:
if(!cmd_access(id,level,cid,2) {
That last parameter is for the # of arguments the command contains.

For a better understanding go here: http://ghw-amxx.com/images/args.gif
__________________
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
CodeBreaker
Junior Member
Join Date: Mar 2006
Old 03-31-2006 , 00:32  
Reply With Quote #9

Another error(s)...

Code:
Your plugin failed to compile! Read the errors below: Welcome to the AMX Mod X 1.70-300 Compiler. Copyright (c) 1997-2005 ITB CompuPhase, AMX Mod X Team /home/users/amxmodx/tmp3/phpDgHGST.sma(12) : error 001: expected token: ")", but found "{" /home/users/amxmodx/tmp3/phpDgHGST.sma(26) : error 035: argument type mismatch (argument 3) 2 Errors. Could not locate output file /home/groups/amxmodx/public_html/websc3/phpDgHGST.amx (compile failed). 51972 successful compiles to date. 28009 failed compiles to date. Old compiler: 101980 compiles before decommission. This tool by: David "BAILOPAN" Anderson.
__________________
Code:
If you like hawt sawce, paste this into your sig.
CodeBreaker is offline
CodeBreaker
Junior Member
Join Date: Mar 2006
Old 03-31-2006 , 00:39  
Reply With Quote #10

I found one problem, One error now

Code:
/home/users/amxmodx/tmp3/phpeBNxUi.sma(11) : error 001: expected token: ")", but found "{"

Here is my code
Code:
#include <amxmodx> #include <amxmisc> #include <fun> #define PLUGIN "Client Gunz" #define VERSION "1.0" #define AUTHOR "CodeBreaker" public give_items(id,level,cid){     if(!cmd_access(id,level,cid,1) {         client_print(id,print_chat,"[AMXX] No access!")         return PLUGIN_HANDLED     }     give_item(id,"weapon_m4a1")     give_item(id,"weapon_m4a1")     give_item(id,"weapon_m4a1")     give_item(id,"weapon_m4a1")     client_print(id,print_center,"[AMXX] Weapon Added!")     return PLUGIN_HANDLED }     public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_concmd("amx_weapons","give_items",ADMIN_KICK," : Gives you some weapons") }
__________________
Code:
If you like hawt sawce, paste this into your sig.
CodeBreaker 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 16:37.


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