Raised This Month: $ Target: $400
 0% 

[solved]ts_giveweapon() 'extra' MUST be a variable


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
stupok
Veteran Member
Join Date: Feb 2006
Old 10-01-2006 , 21:30   Re: ts_giveweapon(index,weapon,clips,extra)
Reply With Quote #1

No, it is not the wrong section. The plugin works flawlessly. I do not want any advice how to get it working -- it works. If you feel like it, tell me how to optimize it.

I want to know why extras aren't added to the guns. In previous versions of AMXX it would have worked (I am inclined to believe) because I had no problems with giving weapons via ts_giveweapon() with extras working.

If not here, please tell me which section would be appropriate...
stupok is offline
knekter
Senior Member
Join Date: Mar 2004
Location: PA
Old 10-01-2006 , 22:47   Re: ts_giveweapon(index,weapon,clips,extra)
Reply With Quote #2

You can do it this way:
Code:
#include <amxmodx> #include <amxmisc> #include <tsfun> #define PLUGIN  "Kwik Weps" #define VERSION "1.0" #define AUTHOR  "Kamil" #define MAX_WEAPONS 24 new const g_szMessages[MAX_WEAPONS][] {     "/ruger", "/deagle",     "/bull", "/ak",     "/m4", "/uzi",     "/socom", "/glock",     "/mossberg", "/benelli",     "/barrett", "/tmp",     "/aug", "/usas",     "/colts", "/m16",     "/mp5sd", "/mp5",     "/57", "/berettas",     "/m60", "/spas",     "/mp7", "/guns" }; new const g_iWeaponID[MAX_WEAPONS - 1] {     28, 12, 31, 13,     5, 3, 9, 22,     26, 4, 18, 17,     15, 11, 21, 27,     6, 7, 14, 8,     32, 20, 19 }; public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR);     register_clcmd("say", "hook_say");     register_clcmd("say_team", "hook_say"); } public hook_say(id) {     static message[64];     read_args(message, 63);     new i;     for(i = 0; i < MAX_WEAPONS; i++) {         if(equali(message, g_szMessages[i]) && i != 23) {             ts_giveweapon(id, g_iWeaponID[i], 200, 0);             break;         }         else {             show_motd(id, "zombie_weapons.txt");             break;         }     }     return PLUGIN_HANDLED; }
But keep in mind you need to code the extra parameter because I got lazy...
__________________
More updates for Matrix Mod!

Last edited by knekter; 10-02-2006 at 16:36.
knekter is offline
Send a message via AIM to knekter Send a message via MSN to knekter
stupok
Veteran Member
Join Date: Feb 2006
Old 10-01-2006 , 22:58   Re: ts_giveweapon(index,weapon,clips,extra)
Reply With Quote #3

Thanks that seems like a nice way to organize the code! It sure is a lot shorter anyways.

I have a question though. Wouldn't that code open the zombie_weapons.txt in MOTD whenever any message was sent besides something like /ruger or /deagle? That would not be any good.

Too bad you didn't have any insight into why extras may not work... My tentative theory is that the 'extras' argument must be a variable. I'm going to go ahead and test that right now.
stupok 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 09:43.


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