AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Spawning weapons with no ammo (https://forums.alliedmods.net/showthread.php?t=295186)

TheeDeer 03-18-2017 20:48

Spawning weapons with no ammo
 
Hello, I am i need of a little help. I am trying to spawn a Deagle at the feet of a player but that Deagle can not have any ammo, and if possible be named "Toy gun"

edon1337 03-19-2017 05:44

Re: Spawning weapons with no ammo
 
With 'at the feet of a player' you mean in the drop position ? And what naming are you talking about ?
Code:
#include < amxmodx > #include < cstrike > #include < fun > #include < hamsandwich > public plugin_init( ) {     register_plugin( "Toy Guns", "1.0", "DoNii" ) ;         RegisterHam( Ham_Spawn, "player", "fw_HamSpawnPost", 1 ) ; } public fw_HamSpawnPost( id ) {     if( is_user_alive( id ) ) {             give_item( id, "weapon_deagle" ) ;         cs_set_user_bpammo( id, CSW_DEAGLE, 0 ) ;         engclient_cmd( id, "drop weapon_deagle" ) ;     } }

OciXCrom 03-19-2017 10:51

Re: Spawning weapons with no ammo
 
@killerZM - What if he isn't holding the deagle?
@edon1337 - Use engclient_cmd.

HamletEagle 03-19-2017 11:47

Re: Spawning weapons with no ammo
 
Even if he is not holding deagle, weapon will be dropped if the player has it.

edon1337 03-19-2017 12:42

Re: Spawning weapons with no ammo
 
Quote:

Originally Posted by killerZM (Post 2504826)
drop is used to drop current weapon if it drop able

Please don't talk no sense, what if player changes the weapon at that moment? It will drop another weapon.

HamletEagle 03-19-2017 12:57

Re: Spawning weapons with no ammo
 
If command is simply "drop", it will drop the active item. If command is "drop weapon_name" it will drop that specific weapon no matter what.

killerZM 03-19-2017 13:23

Re: Spawning weapons with no ammo
 
use create entity for it ? create_entity(weapon_box) better

EFFx 03-19-2017 13:31

Re: Spawning weapons with no ammo
 
Just a question, why giving the deagle and drop it after? Also, is_user_alive() check should be used.

edon1337 03-19-2017 14:46

Re: Spawning weapons with no ammo
 
Quote:

Originally Posted by EFFx (Post 2504849)
Just a question, why giving the deagle and drop it after?

Because :

Quote:

Originally Posted by TheeDeer (Post 2504718)
I am trying to spawn a Deagle at the feet of a player

Quote:

Originally Posted by killerZM (Post 2504847)
use create entity for it ? create_entity(weapon_box) better

Better just stop.

EFFx 03-19-2017 14:48

Re: Spawning weapons with no ammo
 
Got it.


All times are GMT -4. The time now is 17:48.

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