AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Weapon ammo HELP (https://forums.alliedmods.net/showthread.php?t=127219)

DIREKTOR 05-18-2010 13:52

Weapon ammo HELP
 
Hi i need help i know i can give weapons by this command
PHP Code:

give_item(players[i], "weapon_scout"

but can you help me and showme how to make that it gives 0 ammo in clip and backpak 0 BUT i Dont wanna plugin because i wanna include this in my plug

JaGareN 05-18-2010 14:10

Re: Weapon ammo HELP
 
http://www.amxmodx.org/funcwiki.php?go=func&id=208

http://www.amxmodx.org/funcwiki.php?go=func&id=186

drekes 05-18-2010 14:13

Re: Weapon ammo HELP
 
PHP Code:

#include <cstrike>

new wpn give_item(players[i], "weapon_scout")

cs_set_weapon_ammo(wpn0)
cs_set_user_bpammo(players[i], "weapon_scout",  0


DIREKTOR 05-18-2010 14:43

Re: Weapon ammo HELP
 
but i cant compile plugin now ERRORS:
/groups/amxmodx/tmp3/textSYICoN.sma(739) : error 017: undefined symbol "set_weapon_ammo"
/groups/amxmodx/tmp3/textSYICoN.sma(740) : error 017: undefined symbol "set_user_bpammo"

Hx7r 05-18-2010 14:51

Re: Weapon ammo HELP
 
cs_set_*

drekes 05-18-2010 15:19

Re: Weapon ammo HELP
 
Quote:

Originally Posted by DIREKTOR (Post 1184268)
but i cant compile plugin now ERRORS:
/groups/amxmodx/tmp3/textSYICoN.sma(739) : error 017: undefined symbol "set_weapon_ammo"
/groups/amxmodx/tmp3/textSYICoN.sma(740) : error 017: undefined symbol "set_user_bpammo"

Fixed
Wasen't paying attention.

SaM.ThE.MaN 05-18-2010 15:52

Re: Weapon ammo HELP
 
lol -.-

wrecked_ 05-18-2010 16:07

Re: Weapon ammo HELP
 
Quote:

Originally Posted by SaM.ThE.MaN (Post 1184319)
lol -.-

What a useless post.

@OP - You don't need to create a variable if that's all you're doing with the entity. You can simply do
Code:
cs_set_weapon_ammo( give_item( id, "weapon_scout" ), 0 )

ConnorMcLeod 05-19-2010 11:34

Re: Weapon ammo HELP
 
Quote:

Originally Posted by wrecked_ (Post 1184331)
@OP - You don't need to create a variable if that's all you're doing with the entity. You can simply do
Code:
cs_set_weapon_ammo( give_item( id, "weapon_scout" ), 0 )

You are wrong.
You need to create a variable, and check if it's not null before you send cs_set_weapon_ammo.

Code:
new wpn = give_item(id, "weapon_scout") if( wpn > 0 ) {  cs_set_weapon_ammo(wpn, 0) } cs_set_user_bpammo(id, CSW_SCOUT,  0)

wrecked_ 05-19-2010 15:30

Re: Weapon ammo HELP
 
Quote:

Originally Posted by ConnorMcLeod (Post 1185011)
You are wrong.
You need to create a variable, and check if it's not null before you send cs_set_weapon_ammo.

Code:
new wpn = give_item(id, "weapon_scout") if( wpn > 0 ) {  cs_set_weapon_ammo(wpn, 0) } cs_set_user_bpammo(id, CSW_SCOUT,  0)

How would it return as null? I've never had a run-time error in my plugins where I use the method demonstrated above. The only circumstances under which I see this happening is if the player isn't connected/valid or if there's some Item_CanDeploy issues. Chances are, he'll be using the connected check in that function somewhere, so he won't have to worry about that.


All times are GMT -4. The time now is 03:34.

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