Raised This Month: $32 Target: $400
 8% 

Server's Map Information


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Admin Commands       
red_bull2oo6
Senior Member
Join Date: Mar 2012
Location: Braila, Romania
Old 03-14-2015 , 03:13   Server's Map Information
Reply With Quote #1

Server's Map Information
version 2.1.1 by
Ulquiorra |aka| Askhanar


Introduction

I saw on a server a plugin that was showing all server's maps ( inside maps folder ) via motd.
It was showing information like: mapname, spawns, and a map thumbnail.

In the next second i got this idea.

This plugin shows you via motd ( using a php script parsing url ) All maps information you need.

Information about Current&Next Map:
-Current MapName, Current Played Time.
-Nextmap MapName, Current TimeLeft.

If the cvar amx_nextmap is empty ( "" ), It'll say 'Not voted yet'.

Information about Last 10 Played Maps:
-Each MapName + preview in thumbnail.
-For how long the map was played.
-The max players record on specific map ( ex: 15/32 ).
-How long ago the map was played. ( kind of useless, but added it to have all corners occupied [ watch preview link ] ).


You can see a preview by clicking Here

Commands:
  • /maps, /mapsinfo, /minfo, /mi, /lastmaps - opens motd.
  • /currentmap, /nextmap - opens motd ( if enabled by cvar, default functions still triggered ).


CVars:


  • smi_override_cmd "0/1/2/3" 0=OFF, 1= Only /currentmap, 2= Only /nextmap, 3 = both. If enabled opens the motd too.
  • smi_script_url "http://yourdomain.com/script" Here you set your script location.
    EX: http://mysite.ro/smi/smi.php"



Required modules:
  • basic

Instalation:

Instal this plugin just like any other plugin.
Put smi.amxx ( after compiling localy ) into plugins folder.
Add smi.amxx line to plugins.ini.

Upload the files inside the smi_web.rar to your website.


ChangeLog:

Code:
[15.03.2015]
2.1.1   -  All suggestions done.
          -  Added new cvar ( smi_override_cmd ), read description.
          -  Added new commands ( /currentmap, /nextmap ), read description.

[14.03.2015]
1.1.1   -  Fixed and changed all thethings from suggestions.

[10.03.2015]
1.0.1   -  Added Curren&Next Map information.

[01.03.2015]
1.0.0   -  First stable version of plugin.


Notes:

Map's thumbnail is directly token from GameTracker. If the map has no preview the thumbnail is being replaced by a 'NoImage.png' image.
No SQL or Sockets required.


If anyone can help me improve that 'php script' i'll give him a huge hug. Because i suck at php.
After installing the plugin, please change your map 10 times, this way you wont have empty statistics.

PHP Code:
Played Time           Players Record
      ________________________
     
|                        |
     |                        |
     |                        |
     |     
Map Thumbnail      |
     |                        |
     |                        |
     |                        |
      
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Map Name               How long ago 
Attached Files
File Type: zip smi_web.zip (2.9 KB, 575 views)
File Type: sma Get Plugin or Get Source (smi.sma - 892 views - 4.9 KB)
__________________

My PC Themes . .

Last edited by red_bull2oo6; 05-10-2017 at 18:02. Reason: Renew the Preview link
red_bull2oo6 is offline
choloo
Senior Member
Join Date: Nov 2014
Location: Groznyj, Chechnya
Old 03-14-2015 , 03:22   Re: Server's Map Information
Reply With Quote #2

Finally here you are, I'll test it soon, thanks Askhanar
choloo is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 03-14-2015 , 04:23   Re: Server's Map Information
Reply With Quote #3

PHP Code:
register_plugin
    
(
        
PLUGIN,
        
VERSION,
        
"Ulquiorra"
    
); 
Seeing a bit of my style here

For readability purposes instead of sizeof -1 use charsmax.
When you parse map file or whatever it is you have a string-array called szCrap. This makes me think that it is an unused param of some string manipulation func or sth like that, but in fact you need it, consider a better name.

In cmd_MapsInfo static is used wrong, it's just a player command, no need of static. Even if not wrong, in my opinion static should only be used when it's really needed, in the other cases let's use new.

In plugin_end check if file pointer is valid before writing to it.

Anyway, this seems to be an interesting ideea + glad to see you here. But, really, change your coding style, too many spaces :O.
__________________

Last edited by HamletEagle; 03-14-2015 at 04:24.
HamletEagle is offline
red_bull2oo6
Senior Member
Join Date: Mar 2012
Location: Braila, Romania
Old 03-14-2015 , 04:34   Re: Server's Map Information
Reply With Quote #4

My coding style is just fine. It's more readable.

All done except sizeof -1 , it's the same.
__________________

My PC Themes . .
red_bull2oo6 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 03-14-2015 , 04:43   Re: Server's Map Information
Reply With Quote #5

Quote:
Originally Posted by red_bull2oo6 View Post
My coding style is just fine. It's more readable.

All done except sizeof -1 , it's the same.
Well, I'm not here to argue, but I need to make some things clear:
1)I said that sizeof -1 should be changed only for readability purpose, not that it's a different thing. This is up to you, I'm just giving suggestions.
2)About coding style, this is a subjective opinion, but with no extra spaces it is more readable than with all of this HN and spaces. Up to you, again.
__________________

Last edited by HamletEagle; 03-14-2015 at 04:49.
HamletEagle is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-14-2015 , 04:44   Re: Server's Map Information
Reply With Quote #6

Quote:
Originally Posted by HamletEagle View Post
PHP Code:
register_plugin
    
(
        
PLUGIN,
        
VERSION,
        
"Ulquiorra"
    
); 
Seeing a bit of my style here
That just happens to be the worst part of the code (style-wise) ;). The excessive use of spaces comes in a close second.
__________________

Last edited by fysiks; 03-14-2015 at 04:47.
fysiks is offline
red_bull2oo6
Senior Member
Join Date: Mar 2012
Location: Braila, Romania
Old 03-14-2015 , 04:52   Re: Server's Map Information
Reply With Quote #7

@HemletEagle: charsmax done, coding style will be changed in next version.
@Fysiks: That was funny ^^, changed that too.. ( default style ).

btw i hope that huge url i'm formatting won't get problematic for some reason, whatever would it be.
__________________

My PC Themes . .

Last edited by red_bull2oo6; 03-14-2015 at 04:56.
red_bull2oo6 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-14-2015 , 05:00   Re: Server's Map Information
Reply With Quote #8

You are limited to 1536 characters in the MOTD (your URL).
__________________
fysiks is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 03-14-2015 , 08:25   Re: Server's Map Information
Reply With Quote #9

In .CSS file found:

Code:
    background: #242424 url(http://www.ulqtech.tk/css/images/bg-pattern.png) 0 0;
Expected:

Code:
   background: #242424 url(bg-pattern.png) 0 0;
All Website resources must be zipped inside.
Plug-in seems really fine now, but you can sometimes avoid using 'copy'. Especially if the size matches.

Code:
copy( g_szMapsName[ i ], charsmax( g_szMapsName[ ] ), "NoMap" );
Might be, optional:

Code:
g_szMapsName[i] = "NoMap";
And in plugin_end():

Code:
fclose( iFile );
Check if opened before closing.
__________________

Last edited by claudiuhks; 03-14-2015 at 09:16.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 03-14-2015 , 08:42   Re: Server's Map Information
Reply With Quote #10

No need of 3 checks to see if pointer is valid, make one and put everything inside it. Also, you left a static in the command public.
__________________

Last edited by HamletEagle; 03-14-2015 at 08:43.
HamletEagle 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 06:41.


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