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

Death Note


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Fun Stuff        Approver:   HamletEagle (36)
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 04-11-2016 , 08:06   Death Note
Reply With Quote #1



< Death Note >

With this plugin players can set up a death note which will appear to the players they kill.

Cvars:

  • dn_type <default: "3"> -- Type (1 = chat; 2 = HUD; 3 = DHUD).
  • dn_hud_red <default: "0"> -- RGB for the note (if dn_type > 1): red color.
  • dn_hud_green <default: "255"> -- RGB for the note (if dn_type > 1): green color.
  • dn_hud_blue <default: "0"> -- RGB for the note (if dn_type > 1): blue color.
  • dn_hud_xpos <default: "-1.0"> -- X position for the note (if dn_type > 1).
  • dn_hud_ypos <default: "0.80"> -- Y position for the note (if dn_type > 1).
  • dn_hud_time <default: "-1.0"> -- How long before the note disappears (if dn_type > 1).


Commands:

  • /note set <note> -- Sets your death note. You can use <name> to use your current name in the note. Example: /note set Pwned by <name>!
  • /note remove -- Removes your death note.
  • /note current -- Shows your current death note.
  • /note load -- Reloads the plugin's cvars (admins only).
  • /note delete <player> -- Removes player's death note (admins only).
  • /note player <player> -- Shows the player's current death note (admins only).
  • /note help -- List of basic commands.


* You can use /dn instead of /note.
* You can use only the first letter of the command instead of the whole word (set => s; remove => r; delete => d etc).
* Example: /dn s hello

Images:






Languages:
  • English: by me (OciXCrom)
  • Macedonian: by me (OciXCrom)
  • Bulgarian: by me (OciXCrom)
  • Spanish: by ACM1PT

Servers using this plugin





Last edited by OciXCrom; 07-17-2018 at 09:04.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
didoWEE
Senior Member
Join Date: Oct 2012
Location: Bulgaria
Old 04-11-2016 , 08:23   Re: Death Note
Reply With Quote #2

Let the insulting begin!


*****
Quote:
Originally Posted by OciXCrom View Post
/note delete <играч> -- Removes player's death note (admins only).
/note player <играч> -- Shows the player's current death note (admins only).
didoWEE is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 04-11-2016 , 08:38   Re: Death Note
Reply With Quote #3

Guess I missed that. Fixed.

Last edited by OciXCrom; 04-11-2016 at 08:38.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Syturi0
Veteran Member
Join Date: Aug 2014
Location: Your mom house -Portugal
Old 04-11-2016 , 08:53   Re: Death Note
Reply With Quote #4

??

I dont get it.
Syturi0 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 04-11-2016 , 12:25   Re: Death Note
Reply With Quote #5

For approval:
  • Not every function needs to be "public". You would use it for functions that can be called from outside of your plugin, like a task, menu handler, registered command, forward. Your readCvars function should be private, so remove "public". Same reasoning applies to LoadData and SaveData
  • I would advice you to do LoadData in client_putinserver, not client_connect
  • In SaveData:
    • szVaultKey and szVaultData are not needed, work directly with szAuthId and g_szNote[id].
    • FYI generally you should use formatex, not format. The only case in which you need to use format is when you format in the same buffer from where you get values. Example:
      Code:
      format(Buffer, charsmax(Buffer), "some_%s", Buffer)
    • Moreover, when you want to copy a string into another, you would use copy native, not formatex.
    • Returning something does not make sense here.
  • Now, do the same thing for LoadData function. Use directly szAuthId and g_szNote[id] in nvault_get. Returning something does not make sense here.
  • In cmdSay, as I told you before, use copy, not formatex(
    Code:
    formatex(g_szNote[id], charsmax(g_szNote[]), "%s", szSay)
    ). Same for eventPlayerKilled
  • In clearNote: to clear a string, simply do g_szNote[id][0] = EOS. EOS is the null terminator. If the first cell of a string is EOS you can be sure that this string is empty.
  • In is_blank, instead of equal(szMessage, "") do if(szMessage[0] == EOS).
  • In ColorChat, use charsmax() as you do in the rest of the code.
  • Cache get_user_msgid("SayText"), get_user_msgid("TeamInfo") and get_maxplayers() in plugin_init. This are constant values and won't change during run time.
  • Remove stock keyword from your functions. stock is useful in include files where not all functions will be used, but everything you have in your code should be used.
__________________

Last edited by HamletEagle; 04-11-2016 at 12:50.
HamletEagle is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 04-11-2016 , 15:19   Re: Death Note
Reply With Quote #6

@HamletEagle: All done! I updated the code. Thank you for the advices.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 04-11-2016 , 17:56   Re: Death Note
Reply With Quote #7

Grrrr you stole my idea! lol jk
redivcram is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 04-12-2016 , 09:17   Re: Death Note
Reply With Quote #8

Close g_iVault in plugin_end.
Inside eventPlayerKilled why do you create szNote when you could use directly g_szNote[iAttacker]?
Use charsmax() everywhere, also in your stocks(for example herevformat(message[1], 251, msg, 4);).

That's all for now.
__________________
HamletEagle is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 04-12-2016 , 10:05   Re: Death Note
Reply With Quote #9

I use szNote because I want to replace <name> with the player's current name. The other stuff are fixed. I updated the code again.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 04-12-2016 , 10:14   Re: Death Note
Reply With Quote #10

Fastly read the code, it looks ok. Hope I did not miss anything.

I would like you to put cvars + description inside source file and also add ML. That way it's easier for the end user to configure the plugin and use it.

Approved.
__________________

Last edited by HamletEagle; 04-12-2016 at 10:15.
HamletEagle 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 06:23.


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