AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   ts_giveweapon ( index, weapon, clips, extra ) (https://forums.alliedmods.net/showthread.php?t=45363)

stupok 09-30-2006 14:27

ts_giveweapon ( index, weapon, clips, extra )
 
I have been running a TS server since before AMXX 1.5, and have never had a problem with ts_giveweapon ( index, weapon, clips, extra )

Now, the plugin below does not give the 'extra' part of the function. The weapon is given, with the correct amount of clips, but no silencer, flashlight, laser, or scope is added. The already approved plugin for ts_giveweapon (search the plugins) does work, meaning it adds the silencer, laser, flashlight or scope. But, it has malfunctioned more than once. For example, I tried several different values for the extra, but it kept giving a weapon with a flashlight.

Besides any insights as to why 'extra' may not work, I'd appreciate some feedback on optimizing this plugin.

Code:
#include <amxmodx> #include <amxmisc> #include <tsfun> #define PLUGIN "Kwik Weps" #define VERSION "1.0" #define AUTHOR "Kamil" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_concmd("say /ruger","say_ruger")     register_concmd("say /deagle","say_deagle")     register_concmd("say /bull","say_bull")     register_concmd("say /ak","say_ak")     register_concmd("say /m4","say_m4")     register_concmd("say /uzi","say_uzi")     register_concmd("say /socom","say_socom")     register_concmd("say /glock","say_glock")     register_concmd("say /mossberg","say_mossberg")     register_concmd("say /benelli","say_benelli")     register_concmd("say /barrett","say_barrett")     register_concmd("say /tmp","say_tmp")     register_concmd("say /aug","say_aug")     register_concmd("say /usas","say_usas")     register_concmd("say /colts","say_colts")     //register_concmd("say /nade","say_nade")     register_concmd("say /m16","say_m16")     register_concmd("say /mp5sd","say_mp5sd")     register_concmd("say /mp5","say_mp5")     register_concmd("say /57","say_57")     register_concmd("say /berettas","say_berettas")     register_concmd("say /m60","say_m60")     register_concmd("say /spas","say_spas")     register_concmd("say /mp7","say_mp7")     register_concmd("say /guns", "gun_say") } public gun_say(id) {     show_motd(id, "zombie_weapons.txt")     return PLUGIN_HANDLED } public say_ruger(id) {     ts_giveweapon(id, 28, 200, 6)     return PLUGIN_HANDLED } public say_deagle(id) {     ts_giveweapon(id, 12, 200, 6)     return PLUGIN_HANDLED } public say_bull(id) {     ts_giveweapon(id, 31, 200,6)     return PLUGIN_HANDLED } public say_ak(id) {     ts_giveweapon(id, 13, 200,18)     return PLUGIN_HANDLED } public say_m4(id) {     ts_giveweapon(id, 5, 200,18)     return PLUGIN_HANDLED } public say_uzi(id) {     ts_giveweapon(id, 3, 200,6)     return PLUGIN_HANDLED } public say_socom(id) {     ts_giveweapon(id, 9, 200,6)     return PLUGIN_HANDLED } public say_glock(id) {     ts_giveweapon(id, 22, 200,6)     return PLUGIN_HANDLED } public say_mossberg(id) {     ts_giveweapon(id, 26, 200,6)     return PLUGIN_HANDLED } public say_benelli(id) {     ts_giveweapon(id, 4, 200,6)     return PLUGIN_HANDLED } public say_barrett(id) {     ts_giveweapon(id, 18, 200,6)     return PLUGIN_HANDLED } public say_tmp(id) {     ts_giveweapon(id, 17, 200,6)     return PLUGIN_HANDLED } public say_aug(id) {     ts_giveweapon(id, 15, 200,6)     return PLUGIN_HANDLED } public say_usas(id) {     ts_giveweapon(id, 11, 200,6)     return PLUGIN_HANDLED } public say_colts(id) {     ts_giveweapon(id, 21, 200,6)     return PLUGIN_HANDLED } public say_nade(id) {     ts_giveweapon(id, 24, 200,0)     return PLUGIN_HANDLED } public say_m16(id) {     ts_giveweapon(id, 27, 200,18)     return PLUGIN_HANDLED } public say_mp5sd(id) {     ts_giveweapon(id, 6, 200,6)     return PLUGIN_HANDLED } public say_mp5(id) {     ts_giveweapon(id, 7, 200,6)     return PLUGIN_HANDLED } public say_57(id) {     ts_giveweapon(id, 14, 200,6)     return PLUGIN_HANDLED } public say_berettas(id) {     ts_giveweapon(id, 8, 200,6)     return PLUGIN_HANDLED } public say_m60(id) {     ts_giveweapon(id, 32, 200,0)     return PLUGIN_HANDLED } public say_spas(id) {     ts_giveweapon(id, 20, 200,6)     return PLUGIN_HANDLED } public say_mp7(id) {     ts_giveweapon(id, 19, 200, 6)     return PLUGIN_HANDLED }

XxAvalanchexX 10-01-2006 00:23

Re: ts_giveweapon ( index, weapon, clips, extra )
 
Code:
public say_ruger(id) {     ts_giveweapon(id, 28, 200, 6)     return PLUGIN_HANDLED }

6 = lasersight (2) + flashlight (4)

I didn't think the Ruger could use a flashlight? Maybe your problem is that the extra field is entered incorrectly for some guns.

stupok 10-01-2006 01:16

Re: ts_giveweapon ( index, weapon, clips, extra )
 
No, if you use too many flags it only puts the ones that the gun is capable of holding. And also, none of the guns obtained by the use of this plugin have any addons at all. M4A1 supports silencer, laser, flashlight and scope yet it has no extras when given with this plugin.


All times are GMT -4. The time now is 04:53.

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