This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Dynamic KD


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Day of Defeat        Category:   General Purpose       
Elite_Fallen_Angel
Member
Join Date: Dec 2006
Location: HELL.....AkA, Texas
Old 10-03-2007 , 07:29   Dynamic KD
Reply With Quote #1

I would like to start off by saying that this is my first plugin with very little experience. I don't plan on getting this approved but rather get some POSITIVE criticism on the structure, style, and efficiency of the whole plugin.

The whole idea of this plugin along with some of the coding was derived from Arion's "Custom Frags and Deaths" plugin. The differences with this plugin is it is made specifically for Day of Defeat unlike Arion's Counter-Strike specific plugin. Also, with this plugin you can alter a player Score (flag caps) rather then just Kill and Deaths.

Please don't tear me apart.....

I present Dynamic KD!

Commands:

amx_alterkill <player> <desired kills>
Changes the specified players kills to the desired amount

amx_alterdeath <player> <desired deaths>
Changes the specified players deaths to the desired amount

amx_alterscore <player> <desired score>
Changes the specified players score to the desired amount


Also, Unlike Arion's plugin the alterations are immediate.
__________________
amXXX The new generation......



Last edited by Elite_Fallen_Angel; 11-28-2007 at 21:14. Reason: Wrong Mod! Oops
Elite_Fallen_Angel is offline
Send a message via AIM to Elite_Fallen_Angel Send a message via Yahoo to Elite_Fallen_Angel
Pro Patria Finland
Senior Member
Join Date: Apr 2006
Location: BaronPub.com
Old 10-03-2007 , 07:41   Re: Dynamic KD
Reply With Quote #2

No need for fun module, you shouldn't include that.

Also, when you script, you can do
Code:
else    dod_set_user_score (player, alteredScorez)

instead of:
Code:
    else     {     dod_set_user_score (player, alteredScorez)     }

Other stuff I'll tell after further look / if I have more to tell.

Edit: And of course like this too:
Code:
    if(!is_user_connected(player))           return PLUGIN_HANDLED
__________________
I am not a number. I am Gordon Freeman!

Last edited by Pro Patria Finland; 10-03-2007 at 07:45.
Pro Patria Finland is offline
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 10-03-2007 , 10:20   Re: Dynamic KD
Reply With Quote #3

cool. gj
Styles is offline
Send a message via AIM to Styles
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-03-2007 , 10:29   Re: Dynamic KD
Reply With Quote #4

Also "Modification: ALL" . It's wrong since it's for dod only. ;)
__________________
Arkshine is offline
Elite_Fallen_Angel
Member
Join Date: Dec 2006
Location: HELL.....AkA, Texas
Old 10-03-2007 , 10:32   Re: Dynamic KD
Reply With Quote #5

Quote:
Originally Posted by Styles
cool. gj
Thank you Styles.

Also, Thank you for your feedback Patria. I actually originally tried doing it that way and recieved some kind of indentation error (Something along those lines).

I will attempt to get it working that way. Is it bad that I use brackets though? I find it easier to read.


Oops, I thought I made it for DoD. My bad. Thank you for pointing that out arkshine!
__________________
amXXX The new generation......



Last edited by Elite_Fallen_Angel; 10-03-2007 at 10:33. Reason: Preventing double posting
Elite_Fallen_Angel is offline
Send a message via AIM to Elite_Fallen_Angel Send a message via Yahoo to Elite_Fallen_Angel
M249-M4A1
I <3 Mac
Join Date: May 2005
Location: Not interested
Old 10-03-2007 , 11:11   Re: Dynamic KD
Reply With Quote #6

Although not necessary, you should comment your code
__________________
M249-M4A1 is offline
Elite_Fallen_Angel
Member
Join Date: Dec 2006
Location: HELL.....AkA, Texas
Old 10-03-2007 , 11:12   Re: Dynamic KD
Reply With Quote #7

Yea, I wasn't sure whether to do it or not since this was a pretty simplistic code but I will do that in the future.

Thank you.
__________________
amXXX The new generation......


Elite_Fallen_Angel is offline
Send a message via AIM to Elite_Fallen_Angel Send a message via Yahoo to Elite_Fallen_Angel
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 10-03-2007 , 11:18   Re: Dynamic KD
Reply With Quote #8

With the "if" indentation, you can put it in braces if you want, there's no reason not to.

Some people prefer just indenting it, some people put it on the same line.

As a general rule, my theory is "if the command is just a return, don't use braces."
Anything else, I tend to, just in case I want to add more there later or w/e.

Just as long as you don't open braces on the same line as the if it's hard to go far wrong ;-)

Code:
if ( expression == true ) {     some_code()     } else {     some_more_code() }
is just the ugliest thing I have ever seen, and it's so much harder to work out what starts where.
Code:
if ( expression == true ) {     some_code() } else {     some_more_code() }
is infinitely better.

But so long as you don't get a compiler warning it's all idiosyncrasy / preference anyway.

Nice plugin, btw.

Last edited by purple_pixie; 10-03-2007 at 11:20.
purple_pixie is offline
Elite_Fallen_Angel
Member
Join Date: Dec 2006
Location: HELL.....AkA, Texas
Old 10-03-2007 , 11:21   Re: Dynamic KD
Reply With Quote #9

Yea, I noticed some of the examples in the Wiki did that. It's so much easier for me with Brackets positioned the way I have them for now (As an uber beginner). Over time if I can get this down well enough I may move onto your theory.

Until such time I will just use brackets since it isn't really "hurting" the plugin.
__________________
amXXX The new generation......


Elite_Fallen_Angel is offline
Send a message via AIM to Elite_Fallen_Angel Send a message via Yahoo to Elite_Fallen_Angel
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 10-03-2007 , 11:31   Re: Dynamic KD
Reply With Quote #10

I'm sure I was saying you have them right already :-S

I always think a brace deserves its own line.
And they definitely deserve indentation afterwards.

Code:
if ( x ) {     y() } else {     z() }
is how I like to put it - undisputedly the most easily readable.

And just to be uber-pedantic ...

These are brackets: []
These are braces: {}
And these are parentheses: ()
purple_pixie 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 12:48.


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