Raised This Month: $ Target: $400
 0% 

Scripting Question


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
FoX Rider
Member
Join Date: Feb 2005
Location: AK
Old 02-21-2005 , 21:36   Scripting Question
Reply With Quote #1

I would like to make a plugin that can give weapons to players.

Code:
#include <amxmodx>
#include <fun>

public plugin_init() {
	register_plugin("Give-Weapon","1.00","FoX")
	register_clcmd("amx_giveweapon","giveweapon",ADMIN_LEVEL_A,"Gives client a weapon")
}

public giveweapon(id) {
Would I just have to add get_user_weapon(m4a1,4,90) and then compile it?

Yes, I'm a newb.
__________________
Ride for fox..Die for fox.
FoX Rider is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-21-2005 , 21:55  
Reply With Quote #2

You would do it like this:

Code:
#include <amxmodx> #include <fun> public plugin_init() {    register_plugin("Give-Weapon","1.00","FoX")    register_clcmd("amx_giveweapon","giveweapon",ADMIN_LEVEL_A,"Gives client a weapon") } public giveweapon(id) {    give_item(id,"weapon_m4a1"); }
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
FoX Rider
Member
Join Date: Feb 2005
Location: AK
Old 02-21-2005 , 22:05  
Reply With Quote #3

Thanks.
__________________
Ride for fox..Die for fox.
FoX Rider is offline
FoX Rider
Member
Join Date: Feb 2005
Location: AK
Old 02-22-2005 , 01:06  
Reply With Quote #4

Heres what I have so far...

Code:
#include <amxmodx> 
#include <fun> 

public plugin_init() { 
   register_plugin("Give-Weapon","1.00","FoX") 
   register_clcmd("amx_giveweapon","giveweapon",ADMIN_LEVEL_A,"- Gives client a weapon")
   register_clcmd("amx_giveammo","giveammo",ADMIN_LEVEL_A,"- Gives client ammo") 
} 
public giveweapon(id) { 
   give_item(id,"weapon_m4a1");
   return PLUGIN_HANDLED
}
   
public giveammo(id) {
	give_item(id,"ammo_m4a1")
	return PLUGIN_CONTINUE
}
But for some reason it wont give any ammo..Help?
__________________
Ride for fox..Die for fox.
FoX Rider is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-22-2005 , 16:07  
Reply With Quote #5

ammo_m4a1 is not a valid entity name for Counter-Strike.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
FoX Rider
Member
Join Date: Feb 2005
Location: AK
Old 02-22-2005 , 19:12  
Reply With Quote #6

Where would I find a list of valid entitys?

Or would i just have to use..

create_entity(ammo_m4a1)

??
__________________
Ride for fox..Die for fox.
FoX Rider is offline
Votorx
Senior Member
Join Date: Jun 2004
Old 02-22-2005 , 19:19  
Reply With Quote #7

You should use the easiest and most simple possible method given to you

*Hint Hint*
cs_set_weapon_ammo(index, newammo)
__________________
Currently Looking for a mod team.
Votorx is offline
Send a message via AIM to Votorx Send a message via MSN to Votorx Send a message via Yahoo to Votorx
FoX Rider
Member
Join Date: Feb 2005
Location: AK
Old 02-22-2005 , 19:30  
Reply With Quote #8

Ok heres my updated script..

Code:
#include <amxmodx> 
#include <cstrike>
#include <fun> 

public plugin_init() { 
   register_plugin("Give-Weapon","1.00","FoX") 
   register_clcmd("amx_giveweapon","giveweapon",ADMIN_LEVEL_A,"- Gives client a weapon") 
   register_clcmd("amx_giveammo","giveammo",ADMIN_LEVEL_A,"- Gives client ammo") 
} 
public giveweapon(id) { 
   give_item(id,"weapon_m4a1"); 
   return PLUGIN_HANDLED 
} 
    
public giveammo(id) { 
   cs_set_weapon_ammo(id,90) 
   return PLUGIN_CONTINUE 
}
Yet when I go in and test it, it says "Unknown command: amx_giveammo"
__________________
Ride for fox..Die for fox.
FoX Rider is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 02-22-2005 , 19:35  
Reply With Quote #9

Try..
Code:
#include <amxmodx> #include <cstrike> #include <fun> public plugin_init() {    register_plugin("Give-Weapon","1.00","FoX")    register_concmd("amx_giveweapon","giveweapon",ADMIN_LEVEL_A,"- Gives client a weapon")    register_concmd("amx_giveammo","giveammo",ADMIN_LEVEL_A,"- Gives client ammo") } public giveweapon(id) {    give_item(id,"weapon_m4a1");    return PLUGIN_CONTINUE }     public giveammo(id) {    cs_set_weapon_ammo(id,90)    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
FoX Rider
Member
Join Date: Feb 2005
Location: AK
Old 02-22-2005 , 19:46  
Reply With Quote #10

That didnt work..

Ok, heres my current code.

Code:
#include <amxmodx> 
#include <cstrike> 
#include <fun> 

public plugin_init() { 
   register_plugin("Give-Weapon","1.00","FoX") 
   register_concmd("amx_giveweapon","giveweapon",ADMIN_LEVEL_A,"- Gives client a weapon")  
} 
public giveweapon(id) {
   give_item(id,"weapon_m4a1");
   give_item(id,"ammo_m4a1")
   client_print(id,print_chat,"[AMXX] The admin has given you a weapon")
   return PLUGIN_CONTINUE
}
It only gives me m4a1 with 30 bullets.
__________________
Ride for fox..Die for fox.
FoX Rider 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 14:00.


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