Raised This Month: $66 Target: $400
 16% 

Buy Zoom v1.2.4


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Fun Stuff        Approver:   Exolent[jNr] (178)
fezh
Veteran Member
Join Date: Dec 2008
Location: BANNED
Old 02-25-2009 , 15:24   Buy Zoom v1.2.4
Reply With Quote #1

.: Description :.
With this plugin, players can buy the AUG's zoom on any weapon (and remove it) with two short commands. After the player dies or the round ends, it is automatically removed.

.: Commands :.
say /zoom - Set zoom on player.
say /remove - Remove the zoom.

.: CVAR :.
amxx_zoom_cost "500" // Set the zoom cost (default 500).

.: Installation :.
Extract .amxx file to your plugins folder, and add its name to plugins.ini
For the proper functioning of the plugin, download the Multilingual File (.txt) and put it in data\lang.

.: Changelog :.
Code:
v1.0 - First release.
v1.1 - Added multilingual support.
v1.2 - Fixed small bug when you die and added a help motd.
v1.2.1 - Fixed again the death's bug, optimization of the code (thanks Exolent) and added some minor stuff. Also, fixed the Spanish translation, because I wrote bad (duh).
v1.2.2 - Plugin updated by joaquimandrade's way.
v1.2.3 - Removed useless stuff.
v1.2.4 - Fixed ML functions, all thanks to arkshine & danielkza.
.: Misc Stuff :..: Download :.
Attached Files
File Type: sma Get Plugin or Get Source (buy_zoom.sma - 4518 views - 2.0 KB)
File Type: txt buy_zoom.txt (6.3 KB, 1980 views)
__________________
"There is no knowledge, that is not power"

Last edited by fezh; 05-07-2009 at 16:33. Reason: Added another language to the ML file.
fezh is offline
crazyeffect
Veteran Member
Join Date: Jul 2008
Location: Belgium
Old 02-25-2009 , 15:33   Re: Buy Zoom
Reply With Quote #2

Good idea

+k


It doesnt matter, but why is there a

PHP Code:
#define ZOOMMSG "You have bought Zoom!" 
If you also can do:

PHP Code:
        client_print(idprint_chat"[AMXX] You have bought Zoom!"
(With the other 2 msg's too )

And maybe you could make it multilang
__________________
crazyeffect is offline
Send a message via MSN to crazyeffect
fezh
Veteran Member
Join Date: Dec 2008
Location: BANNED
Old 02-25-2009 , 16:13   Re: Buy Zoom
Reply With Quote #3

Because my way is more useful for users who have a little-know scripting or simply nothing.
__________________
"There is no knowledge, that is not power"
fezh is offline
minimiller
Veteran Member
Join Date: Aug 2007
Location: United Kingdom
Old 02-25-2009 , 16:16   Re: Buy Zoom
Reply With Quote #4

why not make it ML?
then ppl can change the ML file rather than edit the source and recompile
nice plugin (Y)
__________________
minimiller is offline
Send a message via MSN to minimiller
crazyeffect
Veteran Member
Join Date: Jul 2008
Location: Belgium
Old 02-26-2009 , 10:03   Re: Buy Zoom
Reply With Quote #5

Quote:
Originally Posted by fezh View Post
Because my way is more useful for users who have a little-know scripting or simply nothing.
This is way easier
Attached Files
File Type: txt buyzoom.txt (277 Bytes, 319 views)
File Type: sma Get Plugin or Get Source (buyzoom.sma - 1187 views - 1.6 KB)
__________________
crazyeffect is offline
Send a message via MSN to crazyeffect
fezh
Veteran Member
Join Date: Dec 2008
Location: BANNED
Old 02-26-2009 , 11:58   Re: Buy Zoom
Reply With Quote #6

Quote:
Originally Posted by crazyeffect View Post
This is way easier
Yea, but my plugin doesn't get warnings on compilation..
Code:
/home/groups/amxmodx/tmp3/phpXioGQs.sma(16) : warning 217: loose indentation
/home/groups/amxmodx/tmp3/phpXioGQs.sma(18) : warning 217: loose indentation
Also, thanks, but ML isn't a requeriment for post new plugins, only the english is a must. And for this reason I added the three lines to edit the text.
__________________
"There is no knowledge, that is not power"
fezh is offline
BOYSplayCS
BANNED
Join Date: Apr 2008
Location: Gainesville, FL
Old 02-26-2009 , 12:02   Re: Buy Zoom
Reply With Quote #7

Quote:
Originally Posted by fezh View Post
Yea, but my plugin doesn't get warnings on compilation..
Luls, owned.
BOYSplayCS is offline
Starsailor
horrible hahah
Join Date: Aug 2008
Location: Buenos Aires
Old 02-26-2009 , 12:17   Re: Buy Zoom
Reply With Quote #8

i have indented the code for you

PHP Code:
#include <amxmodx>
#include <cstrike>

#define ZOOMMSG "You have bought Zoom!"
#define REMMSG "Your Zoom has been removed."
#define DONTZOOM "You don't have enough money to buy Zoom."

new zoom_cost 
new bool:g_hasZoom[33]

public 
plugin_init() 
{
    
register_plugin("Buy Zoom""1.0""fezh")
    
register_event("ResetHUD","new_round","b")
    
register_event("DeathMsg""user_dead""a")
    
register_clcmd("say /zoom""set_zoom")
    
register_clcmd("say_team /zoom""set_zoom")
    
register_clcmd("say /remove""remove_zoom")
    
register_clcmd("say_team /remove""remove_zoom")
    
zoom_cost register_cvar("amxx_zoom_cost""500")
}

public 
client_connect(id)
{
    
g_hasZoom[id] = false
}

public 
client_disconnect(id)
{
    
g_hasZoom[id] = false
}

public 
user_dead(id)
{
    
g_hasZoom[id] = false
}

public 
new_round(id)
{
    
g_hasZoom[id] = false
}

public 
remove_zoom(id)
{
    
g_hasZoom[id] = false
    cs_set_user_zoom
(idCS_RESET_ZOOM0)
    
client_print(idprint_chat"[AMXX] %s"REMMSG)
    
    return 
PLUGIN_HANDLED
}

public 
set_zoom(id)
{
    if (
cs_get_user_money(id) < get_pcvar_num(zoom_cost))
    {
        
client_print(idprint_chat"[AMXX] %s"DONTZOOM)
        
        return 
PLUGIN_HANDLED
    
}
    
    
g_hasZoom[id] = true
    cs_set_user_money
(idcs_get_user_money(id) - get_pcvar_num(zoom_cost), 1)
    
cs_set_user_zoom(idCS_SET_AUGSG552_ZOOM0)
    
client_print(idprint_chat"[AMXX] %s"ZOOMMSG)
    
    return 
PLUGIN_HANDLED

and gHasZoom isnt used

you have to put

PHP Code:
if(!g_hasZoom[id]) {
    
g_hasZoom[id] = true
    cs_set_user_money
(idcs_get_user_money(id) - get_pcvar_num(zoom_cost), 1)
    
cs_set_user_zoom(idCS_SET_AUGSG552_ZOOM0)
    
client_print(idprint_chat"[AMXX] %s"ZOOMMSG)
}
else
    
client_print(idprint_chat"[AMXX] You already have a zoom"
__________________
Find my plugins here..

Ex - Spanish Moderator.

Last edited by Starsailor; 02-27-2009 at 12:38.
Starsailor is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-26-2009 , 13:05   Re: Buy Zoom
Reply With Quote #9

Some suggestions :

- You should indent your code properly ; either use tab or space but not both.
- You should provide a command to toggle zoom so it can be bindable and used more easily.
- set_zoom() ; cache the value from cs_get_user_money and get_pcvar_num.
- g_hasZoom is not used at all.
- You could keep the zoom until you die, as feature.
- Using ML system ?
- Don't use ResetHud as new round ; see this tuto : http://forums.alliedmods.net/showthread.php?t=42159

Quote:
Well, this is my first "real" plugin
Read that : http://forums.alliedmods.net/showthread.php?t=11201
Arkshine is offline
fezh
Veteran Member
Join Date: Dec 2008
Location: BANNED
Old 03-02-2009 , 16:39   Re: Buy Zoom
Reply With Quote #10

Plugin updated to version 1.2
__________________
"There is no knowledge, that is not power"

Last edited by fezh; 03-16-2009 at 11:12.
fezh is offline
Reply


Thread Tools
Display Modes

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 23:15.


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