AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   Death Note (https://forums.alliedmods.net/showthread.php?t=281429)

OciXCrom 04-11-2016 08:06

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:

http://i.imgur.com/bjXuNBh.jpg
http://i.imgur.com/vSX0AY5.jpg
http://i.imgur.com/bmvebgu.jpg
http://i.imgur.com/7y261yS.jpg

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

Servers using this plugin


https://raw.githubusercontent.com/Oc...using_this.png
https://raw.githubusercontent.com/Oc...plugin_lab.png
https://raw.githubusercontent.com/Oc...ad_default.png

didoWEE 04-11-2016 08:23

Re: Death Note
 
Let the insulting begin!


*****
Quote:

Originally Posted by OciXCrom (Post 2410030)
/note delete <играч> -- Removes player's death note (admins only).
/note player <играч> -- Shows the player's current death note (admins only).


OciXCrom 04-11-2016 08:38

Re: Death Note
 
Guess I missed that. :D Fixed.

Syturi0 04-11-2016 08:53

Re: Death Note
 
??

I dont get it.

HamletEagle 04-11-2016 12:25

Re: Death Note
 
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.

OciXCrom 04-11-2016 15:19

Re: Death Note
 
@HamletEagle: All done! I updated the code. Thank you for the advices.

redivcram 04-11-2016 17:56

Re: Death Note
 
Grrrr you stole my idea! lol jk

HamletEagle 04-12-2016 09:17

Re: Death Note
 
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.

OciXCrom 04-12-2016 10:05

Re: Death Note
 
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.

HamletEagle 04-12-2016 10:14

Re: Death Note
 
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.


All times are GMT -4. The time now is 18:17.

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