AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Unapproved/Old Plugins (https://forums.alliedmods.net/forumdisplay.php?f=27)
-   -   Buy Unflash (https://forums.alliedmods.net/showthread.php?t=65024)

travo 12-30-2007 10:15

Buy Unflash
 
1 Attachment(s)
Buyunflash.amxx

About
If a player gets flashed he may press the IN_USE key and if he has enough money he will be unflashed and the money will be subtracted. If the player presses the use key and they are not flashed then the plugin will do nothing.

Commands
Press +IN_USE (default 'e') - Buy unflash

CVars
amx_buyunflash (default 1) - toggle on and off
amx_unflashprice (default 4000) - price for unflashing

Modules
#include <amxmodx>
#include <fakemeta>

Versions
1.1 - Used suggestions by arkshine

Arkshine 12-30-2007 10:58

Re: Buy Unflash
 
- Since you're using fakemeta, you can use it to get/set user money, so no more need cstrike module.
Something like :

Code:
    #define OFFSET_CSMONEY    115     #define LINUX_EXTRAOFFSET 5     new g_iMsg_Money;     public plugin_init()     {         g_iMsg_Money = get_user_msgid( "Money" );     }     get_user_money( id )         return get_pdata_int( id, OFFSET_CSMONEY, LINUX_EXTRAOFFSET );     set_user_money( id, iNew_money, iFlash = 1 )     {         set_pdata_int( id, OFFSET_CSMONEY, iNew_money, LINUX_EXTRAOFFSET );         message_begin( MSG_ONE, g_iMsg_Money, _, id );         write_long( iNew_money );         write_byte( iFlash ? 1 : 0);         message_end();     }
- Optimization. Use formatex() instead of format().

- It's ugly to use an array for pvars. If you like this way, at least you should using an enum for a better readability. Something like:
Code:
    enum e_Unflash     {         buy_unflash,         unflash_price     }     new pcvar[ e_Unflash ];         public plugin_init()     {         pcvar[ buy_unflash ]   = register_cvar( "amx_buyunflash"  , "1", FCVAR_SERVER|FCVAR_UNLOGGED );         pcvar[ unflash_price ] = register_cvar( "amx_unflashprice", "2000", FCVAR_SERVER|FCVAR_UNLOGGED );     }     // ...     get_pcvar_num( pcvar[ buy_unflash ] )     get_pcvar_num( pcvar[ unflash_price ] )

M249-M4A1 12-30-2007 12:40

Re: Buy Unflash
 
Maybe it would be better if you had the user bind it to another command instead of setting it to the use key. I wouldn't want to be pressing something and finding out I'm losing money. And a couple HUD/client_print's wouldn't be that bad either.

travo 12-30-2007 13:10

Re: Buy Unflash
 
thanks arkshine


Quote:

Originally Posted by M249-M4A1 (Post 568301)
Maybe it would be better if you had the user bind it to another command instead of setting it to the use key. I wouldn't want to be pressing something and finding out I'm losing money. And a couple HUD/client_print's wouldn't be that bad either.

The use key is only active if you are flashed, so when your pressing the use key are are not flashed, this plugin does nothing. I also added a hud so everyone will see who uses a unflash.

M249-M4A1 12-30-2007 18:17

Re: Buy Unflash
 
Quote:

Originally Posted by travo (Post 568311)
The use key is only active if you are flashed, so when your pressing the use key are are not flashed, this plugin does nothing. I also added a hud so everyone will see who uses a unflash.

That's cool then! You should add something about that in the About section incase someone else thinks the same thing.

soccdoodcss 01-01-2008 13:36

Re: Buy Unflash
 
Yea, this sounds pretty intense. Perhaps add the ability to pay a little bit more beforehand, but it prevents you from being flashed at all. Maybe even pay more but you can't be flashed all round. Just some ideas, tell me what you think.

M249-M4A1 01-01-2008 16:44

Re: Buy Unflash
 
Quote:

Originally Posted by soccdoodcss (Post 568883)
Yea, this sounds pretty intense. Perhaps add the ability to pay a little bit more beforehand, but it prevents you from being flashed at all. Maybe even pay more but you can't be flashed all round. Just some ideas, tell me what you think.


Hm now that I think of it, this is pretty close to:
http://forums.alliedmods.net/showthread.php?p=188147
http://forums.alliedmods.net/showthread.php?p=7802

soccdoodcss 01-01-2008 17:08

Re: Buy Unflash
 
I suppose they are pretty similar. However, if you keep it as it is, it still varies a good amount from the others.

chris 01-01-2008 21:38

Re: Buy Unflash
 
This is nice :D. But do you know what would piss off the players on my server? If you made this plugin for admins only.

soccdoodcss 01-02-2008 12:06

Re: Buy Unflash
 
That is because admin-only should only be used to administrate the server. Any other way can easily lead to abuse of a plugin by an admin. However, this is not an admin-only plugin and if anyone sets it to admin-only, they are a joke.

Zenith77 01-02-2008 21:06

Re: Buy Unflash
 
Pretty much already done, also there's problems when auto-binding an often used key such as use. Unapproved.


All times are GMT -4. The time now is 20:38.

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