AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Unapproved/Old Plugins (https://forums.alliedmods.net/forumdisplay.php?f=27)
-   -   TFC Weapons (https://forums.alliedmods.net/showthread.php?t=51172)

Phantom Warrior 02-12-2007 20:26

TFC Weapons
 
2 Attachment(s)
Team Fortress Classic: TFC Weapons!

Description: TFC WEAPONS allows any user on the server to pick any weapon(gun) they choose. This is not a amx_command it's in 'say'(Global Chat). Only one gun comes with 25rockets, for ammo which is the RPG(Rocket Launcher). This is not a plugin to abuse it.

Current Version: I have currently released version: "0.1" - - - Watch the update log.

Chat Commands: This will list the basic commands players need to type:
  • needrocket - Gives the player RocketLauncher.
  • needshotgun - Gives the player ShotGun(scouts).
  • needknife - Gives the player knife.
  • needsniper - Gives the player the Sniper.
  • needautorifle - Gives player Auto-Rifle.
  • needflamer - Gives player FlameThrower.
  • needrail - Gives player RailGun(medic/scout).
  • needmedkit - Gives player Medikit.
  • needac - Gives the player AC(HWGUY)
  • needsuper - Gives you SuperShotgun.
  • needtranq - Gives you tranquilizer.
  • needgrenadelauncher - Gives you GrenadeLauncher.
Want More: I might take your thought in adding something to this plugin. I will(no doubt) add more weapons to this( Will be displayed in Update Log ).

Code:

===Update Log===

2/12/07. - Plugin Released.
2/12/07. - Added 3 more weapons.
2/13/07. - Added SuperGun.

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <tfcx>
#include <fun>

#define PLUGIN "TFC Weapons"
#define VERSION "1.0"
#define AUTHOR "Phantom Warrior"

public plugin_init() {
    
register_plugin("WeaponMe","0.1","")
    
register_clcmd("say needrocket","fnSayNeedRocket")
    
register_clcmd("say needshotgun","fnSayNeedShotGun")
    
register_clcmd("say needknife","fnSayNeedKnife")
    
register_clcmd("say needsniper","fnSayNeedSniper")
    
register_clcmd("say needautorifle","fnSayNeedAutoRifle")
    
register_clcmd("say needflamer","fnSayNeedFlamer")
    
register_clcmd("say needrail","fnSayNeedRail")
    
register_clcmd("say needmedkit","fnSayNeedMedkit")
    
register_clcmd("say needac","fnSayNeedAc")
    
register_clcmd("say needsuper","fnSayNeedSuper")
    
register_clcmd("say needtranq","fnSayNeedTranq")
    
register_clcmd("say needgrenadelauncher","fnSayNeedGrenLauncher"


Zenith77 02-12-2007 20:45

Re: TFC Weapons
 
You're method is horrible. Instead of registering practically the same command god knows how many times, just remake it to where it can read paramters.

Oh let's say player types in chat:
/need rocket
/need shotgun
/need gaben

Phantom Warrior 02-12-2007 20:46

Re: TFC Weapons
 
Wait, What?

Zenith77 02-12-2007 21:01

Re: TFC Weapons
 
Instead of doing this a bunch of times:

Code:
register_clcmd("say /needshotgun", "fnSayNeedShotGun")

->
Code:
register_clcmd("say /need", "fnHookSayNeed"); // ... public fnHookSayNeed(id) {      // bla bla read_arg here or w/e      if (equal(arg, "shotgun"))            GiveWeapon(WEAPON_SHOTGUN); }

Of course you would create a GiveWeapon() function (hopefully with weapon enumerations). But it would also be better to store all the weapon names or w/e in a cache, loop through them witch matches up with the weapon enumerations, and pass the iterator (I hope I used that correctly).

Phantom Warrior 02-12-2007 21:53

Re: TFC Weapons
 
I really don't get it, I was taught to do it the way I did it, and it works that way.

Zenith77 02-12-2007 22:04

Re: TFC Weapons
 
It's really poor coding, and I was just offering advice. The one infinite question in programming is not how to get something done, but how to get it done efficiently.

Phantom Warrior 02-12-2007 22:08

Re: TFC Weapons
 
Thank you for your advice, i've sent you a PM regarding our issue.

Phantom Warrior 02-12-2007 22:13

Re: TFC Weapons
 
**ATTENTION APPROVERS**

Try not to unapprove/approve this yet, Zenith and I are going over some minor changes. Thank you.

mahooo60 02-13-2007 03:07

Re: TFC Weapons
 
its maybe better if dont have to "type" all of it.
better will be if players have to type only a menu that shows 1234567...and the players can choose their class!

Phantom Warrior 02-13-2007 06:08

Re: TFC Weapons
 
Very VERY Nice idea, I like. I will add this, most likely.


All times are GMT -4. The time now is 11:05.

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