Raised This Month: $ Target: $400
 0% 

Please Help me on plugins.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Chex
Junior Member
Join Date: Jun 2006
Old 06-01-2006 , 22:49   Please Help me on plugins.
Reply With Quote #1

Hi.
I am new to small and I need a little bit of help. I am trying to get a plugin that if you type /frisk you get the number of guns the player has. I have tryed many thing but they do not work. Can I get a little bit of help?
Code:
    }     new weaponsid     new id, clip, ammo, mode, extra     weaponsid = ts_getuserwpn(id,clip,ammo,mode,extra)     client_print(id,print_chat,"Player has %i weapon(s).^n",weaponsid)     return PLUGIN_HANDLED }
Thank you for you time.
Chex is offline
Caesar
BANNED
Join Date: Nov 2004
Old 06-02-2006 , 01:47  
Reply With Quote #2

Im kinda noob at the scripting thing too but it looks like your setting your variables to nothing

shouldn't it be

new id, blah, blah = (something)????
Caesar is offline
Chex
Junior Member
Join Date: Jun 2006
Old 06-02-2006 , 02:05  
Reply With Quote #3

Like they all start off to be zero? That may be a reason.

Edit: Well that does not work but thanks for the try.

I have it working enough for it to register if there is not a gun. But I just found out that ts_getuserwpn finds a single weapon or some thing along those lines. So is there a way to code some thing like this?

if (weaponsid = 0) {
client_print(id,print_chat,"Player does not have a weapon.")
}

Again thank you for your help.
Chex is offline
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 06-02-2006 , 04:38  
Reply With Quote #4

not sure about ts, but maybe this works
Code:
public func(id) {     new weapons[32], num     get_user_weapons(id, weapons,num)     client_print(id,print_chat, "You have %d weapons",num) }
__________________
plop
p3tsin is offline
Chex
Junior Member
Join Date: Jun 2006
Old 06-02-2006 , 19:09  
Reply With Quote #5

Nope, get_user_weapons does not work on ts. But thanks for the help.
Chex is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 06-02-2006 , 19:12  
Reply With Quote #6

At least show us (1) the full code or (2) the whole function.
__________________
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
Chex
Junior Member
Join Date: Jun 2006
Old 06-03-2006 , 00:21  
Reply With Quote #7

Sorry.
Code:
#include <amxmodx> #include <amxmisc> #include <tsfun> #include <tsxaddon> #define PLUGIN "Frisker" #define VERSION "1.0" #define AUTHOR "Chexmix" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         register_concmd("/frisk", "check", ADMIN_IMMUNITY )     } public check (id)     {     if(!(get_user_flags(id) & ADMIN_IMMUNITY)) {         client_print(id, print_console, "You do not have access to this command!^n")         return PLUGIN_HANDLED     }     new entid, entbody     get_user_aiming(id,entid,entbody,100)     if(!is_user_connected(entid)){         client_print(id,print_chat,"Trust me, the air does not have any guns!^n")         return PLUGIN_HANDLED     }     new weaponsid         new id, clip = 0, ammo =0, mode = 0, extra = 0         weaponsid = ts_getuserwpn(entid,clip,ammo,mode,extra)         client_print(id,print_chat,"Player has %i weapon(s).^n",weaponsid)             if(weaponsid = 0){                 client_print(id,print_chat,"The player does not have any thing him.")     }     if(weaponsid = 1) {         client_print(id,print_chat,"You do not find any thing.^n*")                 return PLUGIN_HANDLED     } }

I have been testing with diffrent things so some things are there that don't need to be.
Chex is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 06-03-2006 , 00:37  
Reply With Quote #8

I added comments so you would know what I did.
Code:
#include <amxmodx> #include <amxmisc> #include <tsfun> #include <tsxaddon> #define PLUGIN "Frisker" #define VERSION "1.0" #define AUTHOR "Chexmix" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_concmd("say /frisk", "check", ADMIN_IMMUNITY ) // added "say " } public check(id) {     if(!(get_user_flags(id) & ADMIN_IMMUNITY)) {         client_print(id, print_console, "You do not have access to this command!^n")         return PLUGIN_HANDLED     }     new entid, entbody     get_user_aiming(id,entid,entbody,100)     if(!is_user_alive(entid)) { // changed to !is_user_alive instead of !is_user_connected         client_print(id,print_chat,"Trust me, the air does not have any guns!^n")         return PLUGIN_HANDLED     }     new weaponsid         new id, clip = 0, ammo =0, mode = 0, extra = 0         weaponsid = ts_getuserwpn(entid,clip,ammo,mode,extra)         client_print(id,print_chat,"Player has %i weapon%s.^n",weaponsid,(!weaponsid || weaponsid > 1) ? "s" : "")     // if you need me to explain what I did here I will ;-)         if(weaponsid == 0) { // added an extra =         client_print(id,print_chat,"The player does not have any thing him.")         return PLUGIN_HANDLED // added this return     }     if(weaponsid == 1) { // added an extra =         client_print(id,print_chat,"You do not find any thing.^n*")         return PLUGIN_HANDLED     }     return PLUGIN_HANDLED // added this return }
I also cleaned up the code a little bit ;)
__________________
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
Chex
Junior Member
Join Date: Jun 2006
Old 06-03-2006 , 00:45  
Reply With Quote #9

Thank you so much! If this works I will put the little v3x is a PIMP thing in my sig.

Also please do tell me what you did there, because I am new to scripting and want to learn how to do the best I can. Thank you again.

Edit: Some thing is wrong with the
Code:
if(weaponsid == 1) {
If the person does not have guns it prints the msg about weaponsid ==0. But if the person does have a gun it does not say any thing.
Chex is offline
Chex
Junior Member
Join Date: Jun 2006
Old 06-03-2006 , 01:09  
Reply With Quote #10

Ok I just had to change it to weaponsid >= 1. Again thank you very much for your help.

I have a new problem now. When a person picks up a gun and then drops it, weaponsid does not seem to go back to 0. So even if they do not have a gun it will still say they do.
Chex is offline
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 16:33.


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