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

Change Frags For Something


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Gameplay       
Knifesss
Junior Member
Join Date: Mar 2013
Location: Bulgaria/Sofia
Old 06-10-2014 , 17:16   Change Frags For Something
Reply With Quote #1

Delete this topic.
__________________

Last edited by Knifesss; 10-05-2014 at 19:00.
Knifesss is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 06-10-2014 , 17:46   Re: Change Frags For Something
Reply With Quote #2

Da*n, man, you can use arrays instead of creating new variables for all the things. This code may be optimized and reduced with about 350 lines, doing the same stuff, but with arrays. Think about it.
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 06-11-2014 , 06:24   Re: Change Frags For Something
Reply With Quote #3

There is ALOT of better ways to code this. You could reduce the amount of lines down to very small. I could give you example but got no time atm
__________________
Blizzard_87 is offline
ArabicMan
Veteran Member
Join Date: Feb 2014
Location: مصر
Old 06-11-2014 , 08:12   Re: Change Frags For Something
Reply With Quote #4

Useful plugin. Good job.
ArabicMan is offline
Old 06-11-2014, 10:26
Captain.Diez
This message has been deleted by Captain.Diez.
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 06-11-2014 , 10:29   Re: Change Frags For Something
Reply With Quote #5

PHP Code:
new     cvar_money_num_1,
cvar_money_num_2,
cvar_money_num_3,
cvar_money_num_4,
cvar_money_num_5,
cvar_money_num_6,
cvar_money_num_7 
----->

PHP Code:
new cvar_money_num /* 8 since you will use seven cells,one have to be free. Or, you can reserve 7 cell, if you start from 0. */ 
Now you will use it like this: cvar_money_num [ 1 ] , cvar_money_num [ 2 ] , etc

PHP Code:
cvar_money_num_1 register_cvar("cffs_money_num_1""5")
cvar_money_num_2 register_cvar("cffs_money_num_2""10")
cvar_money_num_3 register_cvar("cffs_money_num_3""15")
cvar_money_num_4 register_cvar("cffs_money_num_4""20")
cvar_money_num_5 register_cvar("cffs_money_num_5""25")
cvar_money_num_6 register_cvar("cffs_money_num_6""30")
cvar_money_num_7 register_cvar("cffs_money_num_7""35"
-------------->

PHP Code:
cvar_money_num ]  = register_cvar("cffs_money_num_1""5"//and so on 
PHP Code:
    register_clcmd("say /frags""the_frags_menu")
    
register_clcmd("say_team /frags""the_frags_menu")
    
register_clcmd("say frags""the_frags_menu")
    
register_clcmd("say_team frags""the_frags_menu")
    
register_clcmd("say !frags""the_frags_menu")
    
register_clcmd("say_team !frags""the_frags_menu"
----->

PHP Code:
register_clcmd"say""Say" );
register_clcmd"say_team""Say" ); 
You will make public "Say" :

PHP Code:

public Say id ) {

    new 
szSaid192 ];
    
read_argsszSaidsizeofszSaid ) -);
    
    
remove_quotesszSaid );
    
    if( 
containszSaid"frags" ) != -)
    {
        
the_frags_menu id )
    }


PHP Code:
new msg1[64],msg2[64],msg3[64],msg4[64],msg5[64],msg6[64],msg7[64
---->
PHP Code:
new msg ] [ 64 /* same thins, you can use it like msg  [ 1 ] [ 64 ] , or you can initialize it with 0 ( only seven cell needed ) 
You could use len+= formatex with just one variabile, instand of seven.

In the handler, you use this a lot of time:
PHP Code:
cs_get_user_money(id)
get_user_frags(id
Why not simply cache them before you start the switch ?
PHP Code:
new iMoney =  cs_get_user_money id )
new 
deaths =  get_user_frags id 
If you do this, you can make your code smaller and you will make the compiler happy ( not really, but ... ) . This are some optimizations , I guess that there are more to do, I have not looked carefully through the code.
HamletEagle is offline
Backstabnoob
Veteran Member
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-11-2014 , 10:38   Re: Change Frags For Something
Reply With Quote #6

Quote:
PHP Code:
new cvar_money_num /* 8 since you will use seven cells,one have to be free. Or, you can reserve 7 cell, if you start from 0. */ 
This is exactly the same thing I told you to fix in your plugin (which you never did). Stop giving people bad habits.
__________________
Currently busy working on a very large scale anime database project.
Backstabnoob is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 06-11-2014 , 10:43   Re: Change Frags For Something
Reply With Quote #7

Here is an improvement I did today. It works without mistakes for me, and as far as I could test, it's all okay. If that kind of post is argue with the rules (like thread hijack or something), excuse me, I'll delete it.
Attached Files
File Type: sma Get Plugin or Get Source (ChangeFragsForSometing.sma - 572 views - 4.1 KB)
__________________

Last edited by Flick3rR; 06-11-2014 at 10:44.
Flick3rR is offline
Send a message via Skype™ to Flick3rR
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 06-11-2014 , 10:47   Re: Change Frags For Something
Reply With Quote #8

Quote:
Originally Posted by Backstabnoob View Post
This is exactly the same thing I told you to fix in your plugin (which you never did). Stop giving people bad habits.
Hmm:

PHP Code:
Or, you can reserve 7 cell, if you start from 0. 
I just told him that to understand about how it is working, and I understand what you told me in my theard, thank for that. Btw, I will fix my plugin when I have free time.

Last edited by HamletEagle; 06-11-2014 at 10:48.
HamletEagle is offline
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 06-11-2014 , 11:49   Re: Change Frags For Something
Reply With Quote #9


__________________
Kia is offline
Backstabnoob
Veteran Member
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-11-2014 , 11:59   Re: Change Frags For Something
Reply With Quote #10

This plugin has limited to no functionality and the code is absolute garbage. I almost feel too bad for moving this to unapproved instead of simply trashing it.

Forever unapproved. Please stop posting plugins if you don't know how to code, thanks.
__________________
Currently busy working on a very large scale anime database project.
Backstabnoob is offline
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 04:00.


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