AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   TFC Sniper Glow (https://forums.alliedmods.net/showthread.php?t=29916)

GoGo_xD 06-18-2006 18:15

TFC Sniper Glow
 
1 Attachment(s)
Quote:

A lot of (pro)TFC players don't like playing with snipers. And they restrict the Sniper class with the cr_sniper command.

Instead of prohibiting this class, why don't we penalize it?
Description:
  • This plugin will add a glowing effect on all snipers in the game.
    Glowing color is the color of the team, of course.

    The attached file contains the source code of my plugin, and the AMXX compiled plugin.
CVARS:
  • tfc_sniper_glow <0/1> : this will turn ON(1) or OFF(0) the glow effect on snipers. Default is 1.
  • tfc_sniper_map_glow <0/1> : If this is enabled (1), glowing effect will not be set on snipers, during sniper maps ( all the mapnames who contains "sniper" . Ex: 2fortsniper ). Default is 1.
Source Code:

Code:
/*  * Copyright (c) 2006-2006 - Hugo LAFITTE <[email protected]>  *  *  *    TFC Sniper Glow v1.0  *  *  Ce plugin AMX MOD X spécifique au MOD Half-Life: Team Fortress Classic  *  vous permettra de désavantager les Franc-Tireurs sur votre serveur.  *  En effet ceux-ci seront colorés par le très connu effet Glow dans la  *  couleur de leur équipe. Toutes les équipes sont gérées: Bleue, Rouge,  *  Jaune et Verte. CE PLUGIN MARCHE UNIQUEMENT AVEC TEAM FORTRESS CLASSIC.  *  *  *  VERSION      :    1 . 0  *  MOD COMPATIBLE    :   TEAM FORTRESS CLASSIC  *  MODULES UTILISES  :     AMXMODX, FUN, ENGINE  *  *   *  TO-DO LIST:     *  -----------      Permettre de garder la couleur après que le joueur ait  *        utilisé un Teleporteur: lorsque l'on utilise un teleporteur  *        celui-ci ajoute un effet Glow sur votre corps durant quelques  *        minutes, et il remplace l'éventuel effet glow déjà présent avant  *        l'utilisation du teleporteur.  *  *  CVARS:  *  ------        tfc_sniper_glow <0/1> :  *  *            Vous permet d'activer ou non l'effet Glow sur les Franc-Tireurs.  *  *        tfc_sniper_map_glow <0/1>:  *         *            Si l'option est activée (1), lorsqu'une map contenant l'apellation  *            "sniper" est chargée, l'effet glow sur les Franc-Tireurs est désactivé.  *  *  *  *  *  Je remercie tout spécialement CyberGuerrier <www.cyberguerrier.info> pour son aide.           *  */

TODO in future versions:
  • When a glowing user in TFC takes a teleporter, another glowing effect is added to the user, and the primary glow effect is replaced with the new effect. So, I have to make this: I have to get the "teleporter use" event in order to replace or take off the glowing effect of the teleporter.

I hope you'll like this plugin.
That's all.

Xanimos 06-18-2006 23:31

Change the mod to TFC.

Also take out the for loop, you obviously don't understand how to use it and its not needed.

GoGo_xD 06-19-2006 05:55

Does the function get_weaponname() will run if i don't make a loop?
I don't see where is my "error". :?

v3x 06-19-2006 06:11

Engine is not needed :o

GoGo_xD 06-19-2006 06:19

Quote:

Originally Posted by v3x
Engine is not needed :o

I'm sorry :oops:

This is because I'v decided to script the plugin with an other method, but it didn't work, so I forgot to delete the Engine include line.

That's done.

Xanimos 06-19-2006 08:30

Quote:

Originally Posted by GoGo_xD
Does the function get_weaponname() will run if i don't make a loop?
I don't see where is my "error". :?

Let me break it down for you then

Lets see here. Your first mistake is that you make a loop and never use it.
Code:
    for(new a=0; a<get_playersnum(); ++a) //your loop has the variable 'a' and its not used anywhere.         {               get_weaponname(get_user_weapon(id,ammo,clip),wpn,31)                 if(containi(wpn, "sniperrifle") > -1)             {                 switch(get_user_team(id))                 {                     case 1:     set_user_rendering(id, kRenderFxGlowShell, color_BLU[0], color_BLU[1], color_BLU[2],  kRenderNormal, 255)                     case 2:     set_user_rendering(id, kRenderFxGlowShell, color_RED[0], color_RED[1], color_RED[2],  kRenderNormal, 255)                     case 3:     set_user_rendering(id, kRenderFxGlowShell, color_YEL[0], color_YEL[1], color_YEL[2],  kRenderNormal, 255)                     case 4:        set_user_rendering(id, kRenderFxGlowShell, color_GRE[0], color_GRE[1], color_GRE[2],  kRenderNormal, 255)                 }             }         }
So what you are doing is looping through however many players there are and setting a persons glow that many times.

There are a few other things wrong with your loop. But IT IS NOT NEEDED in this plugin and should just be removed.

GoGo_xD 06-19-2006 08:56

So, that would run?

Code:
           get_weaponname(get_user_weapon(id,ammo,clip),wpn,31)                 if(containi(wpn, "sniperrifle") > -1)             {                 switch(get_user_team(id))                 {                     case 1:     set_user_rendering(id, kRenderFxGlowShell, color_BLU[0], color_BLU[1], color_BLU[2],  kRenderNormal, 255)                     case 2:     set_user_rendering(id, kRenderFxGlowShell, color_RED[0], color_RED[1], color_RED[2],  kRenderNormal, 255)                     case 3:     set_user_rendering(id, kRenderFxGlowShell, color_YEL[0], color_YEL[1], color_YEL[2],  kRenderNormal, 255)                     case 4:        set_user_rendering(id, kRenderFxGlowShell, color_GRE[0], color_GRE[1], color_GRE[2],  kRenderNormal, 255)                 }             }

Xanimos 06-19-2006 15:19

Aye.

GoGo_xD 06-20-2006 04:30

Quote:

Originally Posted by Suicid3
Aye.

Package is now updated with new corrections. :)

GoGo_xD 06-24-2006 06:41

Re: TFC Sniper Glow
 
Will my plugin be approved?


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

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