Raised This Month: $51 Target: $400
 12% 

Buy Unflash


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Admin Commands       
travo
Senior Member
Join Date: Aug 2006
Old 12-30-2007 , 10:15   Buy Unflash
Reply With Quote #1

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
Attached Files
File Type: sma Get Plugin or Get Source (buyunflash.sma - 923 views - 2.8 KB)

Last edited by travo; 12-30-2007 at 18:45.
travo is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-30-2007 , 10:58   Re: Buy Unflash
Reply With Quote #2

- 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 ] )
__________________

Last edited by Arkshine; 12-30-2007 at 11:01.
Arkshine is offline
M249-M4A1
I <3 Mac
Join Date: May 2005
Location: Not interested
Old 12-30-2007 , 12:40   Re: Buy Unflash
Reply With Quote #3

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.
__________________
M249-M4A1 is offline
travo
Senior Member
Join Date: Aug 2006
Old 12-30-2007 , 13:10   Re: Buy Unflash
Reply With Quote #4

thanks arkshine


Quote:
Originally Posted by M249-M4A1 View Post
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.

Last edited by travo; 12-30-2007 at 14:48.
travo is offline
M249-M4A1
I <3 Mac
Join Date: May 2005
Location: Not interested
Old 12-30-2007 , 18:17   Re: Buy Unflash
Reply With Quote #5

Quote:
Originally Posted by travo View Post
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.
__________________
M249-M4A1 is offline
soccdoodcss
Veteran Member
Join Date: Nov 2006
Location: Wisconsin
Old 01-01-2008 , 13:36   Re: Buy Unflash
Reply With Quote #6

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.
__________________
"Now safe beneath their wisdom and their feet.
Here I will teach you truly how to sleep."
soccdoodcss is offline
Send a message via AIM to soccdoodcss
M249-M4A1
I <3 Mac
Join Date: May 2005
Location: Not interested
Old 01-01-2008 , 16:44   Re: Buy Unflash
Reply With Quote #7

Quote:
Originally Posted by soccdoodcss View Post
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
__________________
M249-M4A1 is offline
soccdoodcss
Veteran Member
Join Date: Nov 2006
Location: Wisconsin
Old 01-01-2008 , 17:08   Re: Buy Unflash
Reply With Quote #8

I suppose they are pretty similar. However, if you keep it as it is, it still varies a good amount from the others.
__________________
"Now safe beneath their wisdom and their feet.
Here I will teach you truly how to sleep."
soccdoodcss is offline
Send a message via AIM to soccdoodcss
chris
Senior Member
Join Date: Mar 2007
Location: America
Old 01-01-2008 , 21:38   Re: Buy Unflash
Reply With Quote #9

This is nice . But do you know what would piss off the players on my server? If you made this plugin for admins only.
__________________
chris is offline
Send a message via AIM to chris
soccdoodcss
Veteran Member
Join Date: Nov 2006
Location: Wisconsin
Old 01-02-2008 , 12:06   Re: Buy Unflash
Reply With Quote #10

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.
__________________
"Now safe beneath their wisdom and their feet.
Here I will teach you truly how to sleep."
soccdoodcss is offline
Send a message via AIM to soccdoodcss
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 11:05.


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