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

Online Map


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   General Purpose       
silkker
Member
Join Date: May 2009
Location: Germany
Old 03-05-2013 , 11:14   Online Map
Reply With Quote #1

Online Map Fix: v2.5

An online map so you can watch what's happening on your server without joining the game. I made it for my own purposes and wanted to share with you guys. It's my first plugin so don't be to hard with your judgement. Most of the credit for helping me with the code goes to Arkshine

Pictures
Spoiler


Online preview: (Note: The server could use a testversion that is not released yet)
currently offline: http://onlinemap.waweasy.com/

How it works:
It acts like a webserver that creates JSON data that can be fetched with a little jQuery - even if it's not on the same domain. You just have to set up the server ip in the index.php and you're good to go. It works on port 1107 (TCP) but you can change that if you want.

I tested it on a server with some bots and it always worked fine. If you have any suggestions on making it even better go ahead.



How to use Online Map:


1. Requirements

- a running hlds server with counter strike 1.6 mod ;)
- port TCP 1107 has to be opened on the server!
- sockets2 (by Bugsy https://forums.alliedmods.net/showthread.php?p=1573388)

2. Prepare your webspace


You now have to download and unzip the onlinemap.zip. Open the index.html and edit the line

PHP Code:
window.server '127.0.0.1'
to fit your needs. For example your server has the IP 85.114.13.88 then the line should look like

PHP Code:
window.server '85.114.13.88'
Save it. Now you can upload the whole unzipped folder to your webspace put it whereever you want it.

You can leave the port as it is. But if you want you can use the CVar "sv_onlinemap" to change the port how you want it.

3. Adding custom overviews (not necessary)


Open the overview file you want to add with some kind of image editing program (e.g. Photoshop, Paint.net). You can swap the green background with the color (Hex #404040) if you want. Then save it as jpeg into the onlinemap/overviews folder. Next step is to add the overviews txt-file (<mapname>.txt) to the onlinemap/overviews folder and thats pretty much it. The overview file should now be recognized and working with Online Map.



Update 2.2

Fixed some bugs.
Updated the onlinescripts - now working without PHP ;)

Update 2.3

Rewrote the code. Should be more efficient now.

Update 2.4

Fixed a problem where strings > ~ 2000 could not be sent.
Press space and see the stats.

Update 2.5

Fixed a bug where the bomb didn't disappear when planted after round end.


Attached Thumbnails
Click image for larger version

Name:	overview_one.jpg
Views:	4861
Size:	64.5 KB
ID:	117116   Click image for larger version

Name:	overview_two.jpg
Views:	4761
Size:	87.7 KB
ID:	117117  
Attached Files
File Type: zip onlinemap.zip (2.28 MB, 744 views)
File Type: sma Get Plugin or Get Source (onlinemap.sma - 1836 views - 4.0 KB)
__________________
404 - Signature not found.

Last edited by YamiKaitou; 06-08-2013 at 20:15. Reason: Updating URL for sockets2 module
silkker is offline
Send a message via ICQ to silkker
bibu
Veteran Member
Join Date: Sep 2010
Old 03-05-2013 , 11:55   Re: Online Map
Reply With Quote #2

Wow, really nice job!
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Location: Siiiiiiiiuu
Old 03-05-2013 , 13:02   Re: Online Map
Reply With Quote #3

Sounds cool
But if mod is mod like furien that players have speed or if server have noclip, does it shows player fast or player going inside walls?
And if have semiclip does it shows players getting inside of others players?
If yes to both, man thats awesome
__________________
Jhob94 is offline
silkker
Member
Join Date: May 2009
Location: Germany
Old 03-05-2013 , 13:05   Re: Online Map
Reply With Quote #4

it basically just gets the coordinates of the players so it will show the real speed and the real position - even if they are like standing in walls or something.
__________________
404 - Signature not found.
silkker is offline
Send a message via ICQ to silkker
FanatikSVK
Member
Join Date: Aug 2012
Location: Slovakia
Old 03-05-2013 , 14:10   Re: Online Map
Reply With Quote #5

WOW .. this is great work! .. I think of this Take advantage of 10000 people.
__________________
FanatikSVK is offline
Send a message via Skype™ to FanatikSVK
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-05-2013 , 15:58   Re: Online Map
Reply With Quote #6

It reminds me of Psycholive, plugin I've converted long time ago.

About your plugin, there are room for improvements.
Considering you use a task to 0.1s, it would be a good idea to keep that in mind, and using as less as natives you can, for the purpose to have an efficient plugin.

Some random remarks :

- You use 4 times socket_send, can't you concatenate to one string and using one socket_send ? Others place too, try to use one string when you can.
- It would be more appropriate to use static instead of new.
- Precompile the regex pattern
- Use formatex, faster.
- Instead of using get_playersnum, and is_user_connected, use get_players. You save a lot of natives call.
- Don't declare variable inside a loop

Start with that.
__________________
Arkshine is offline
n0br41ner
Senior Member
Join Date: May 2012
Location: Planet Earth
Old 03-05-2013 , 16:12   Re: Online Map
Reply With Quote #7

This is an awesome work. I will definitely be trying this plugin on.
__________________
n0br41ner is offline
quilhos
Veteran Member
Join Date: Jun 2010
Old 03-05-2013 , 18:10   Re: Online Map
Reply With Quote #8

Son rly GOOD JOB!
__________________
ELO RATING SYSTEM - SQL [COMPLETE]
Quote:
Originally Posted by Liverwiz View Post
DDDRRRRAAAAMMMMAAAAA!!!???

Put this shit on pause while i go get some popcorn!!

Last edited by quilhos; 03-06-2013 at 08:12.
quilhos is offline
silkker
Member
Join Date: May 2009
Location: Germany
Old 03-06-2013 , 06:18   Re: Online Map
Reply With Quote #9

Update 1.1

socket_send is now more concentrated and used less often.
Now instead of "new", "static" is used to declare variables.
The regex pattern is now precompiled and it doesn't have to do it every 100ms.
Instead of format, formatex is now used.
The variables are now declared outside of the loop.
__________________
404 - Signature not found.

Last edited by silkker; 03-16-2013 at 17:50.
silkker is offline
Send a message via ICQ to silkker
Daddy-K
Junior Member
Join Date: Jun 2010
Location: Romania/Mangalia
Old 03-06-2013 , 07:01   Re: Online Map
Reply With Quote #10

1. Where upload files from onlinemap.zip?
2. How to add maps overviews folder?
Daddy-K 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 22:50.


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