Raised This Month: $10 Target: $400
 2% 

Map Counter


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Statistical       
GordonFreeman (RU)
Veteran Member
Join Date: Jan 2010
Location: Uzbekistan
Old 02-04-2011 , 05:48   Map Counter
Reply With Quote #1

This is my first plugin!
He makes the following:
-Counts how many times the current map was played on the server
-Counts how many times have you played on current map

Need nVault module

Commands:
say /mcount - Show the how many times you play on current map

My first plugin ^_^
Attached Files
File Type: sma Get Plugin or Get Source (mapcounter.sma - 742 views - 2.7 KB)
File Type: txt mapcounter.txt (183 Bytes, 216 views)
__________________
The functional way is the right way

Last edited by GordonFreeman (RU); 02-04-2011 at 10:05.
GordonFreeman (RU) is offline
aLaDiN
Member
Join Date: Jan 2011
Location: Bulgarian
Old 02-04-2011 , 07:21   Re: Map Counter
Reply With Quote #2

Is there any cvar's ?
aLaDiN is offline
Send a message via Skype™ to aLaDiN
GordonFreeman (RU)
Veteran Member
Join Date: Jan 2010
Location: Uzbekistan
Old 02-04-2011 , 07:23   Re: Map Counter
Reply With Quote #3

cvars?
why do I need in this easy plug-in?
__________________
The functional way is the right way
GordonFreeman (RU) is offline
Pantheon
Member
Join Date: Jan 2011
Old 02-04-2011 , 08:22   Re: Map Counter
Reply With Quote #4

PHP Code:
client_print(id,print_chat,"[Mcount] You are played on %s - %d times",map,get2
->
PHP Code:
client_print(id,print_chat,"[Mcount] You have played on %s - %d times",map,get2
__________________
Public Project Progress: [||||||||||]
Pantheon is offline
GordonFreeman (RU)
Veteran Member
Join Date: Jan 2010
Location: Uzbekistan
Old 02-04-2011 , 08:23   Re: Map Counter
Reply With Quote #5

My English is BAD
__________________
The functional way is the right way
GordonFreeman (RU) is offline
Old 02-04-2011, 08:32
Pantheon
This message has been deleted by Pantheon. Reason: Nevermind, missread it.
Old 02-04-2011, 08:37
GordonFreeman (RU)
This message has been deleted by GordonFreeman (RU).
Pantheon
Member
Join Date: Jan 2011
Old 02-04-2011 , 08:42   Re: Map Counter
Reply With Quote #6

Maybe you should add multilangual support?
__________________
Public Project Progress: [||||||||||]
Pantheon is offline
GordonFreeman (RU)
Veteran Member
Join Date: Jan 2010
Location: Uzbekistan
Old 02-04-2011 , 08:44   Re: Map Counter
Reply With Quote #7

Is it necessary? too easy plug-in. But you can follow any responses to add it yourself
__________________
The functional way is the right way
GordonFreeman (RU) is offline
Pantheon
Member
Join Date: Jan 2011
Old 02-04-2011 , 08:47   Re: Map Counter
Reply With Quote #8

Added some language changes.

PHP Code:
/* Plugin generated by AMXX-Studio */

/* 
Plugin has made:
- Count how many times current map played on server
- Count how many time you played current map on server

Commands:
say /mcount - view you played times

That is a simple plugin :)

Thaks:
Doombringer -  for "Player Counter" plugin

*/

//==========================================================

#include <amxmodx>
#include <amxmisc>
#include <nvault>

#define PLUGIN "Map Counter"
#define VERSION "1.0"
#define AUTHOR "GordonFreeman"

//==========================================================
new vault
new map[64]
//==========================================================
public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /mcount","say_mcount")
    
    
vault nvault_open("map_counter")
    
get_mapname(map,63)
    
    
check_map()
}

//===========================================================
public plugin_end(){
    
nvault_close(vault)
}
//===========================================================
public client_putinserver(id){
    
check_nickmap(id)
}
//===========================================================    
public check_map(){
    new 
get nvault_get(vault,map)

    
server_print("[Mcount] %s has been played %d times on this server",map,get)
    
update_map()
}
//===========================================================
public check_nickmap(id){
    new 
nick[32], nickmap[64]
    
get_user_name(id,nick,31)
    
formatex(nickmap63"%s-%s",nick,map)
    new 
get nvault_get(vault,nickmap)
    if(
get>0)
    {
        
server_print("[Mcount] %s has played this map %d times on this server" nick,get)
    }else{
        
server_print("[Mcount] %s has not played this map before on this server" nick)
    }
    
update_nickmap(id)
}
//===========================================================
public update_map()
{        
    new 
vaulte[32]
    
    new 
temp nvault_get(vaultmap)
    
temp++
    
    
formatex(vaulte31,"%d"temp)
    
nvault_set(vaultmapvaulte)
}
//===========================================================
public update_nickmap(id)
{        
    new 
nick[32], nickmap[64]
    
    
get_user_name(id,nick,31)
    
    
formatex(nickmap63"%s-%s",nick,map)
    
    new 
vaulte[32]
    
    new 
temp nvault_get(vaultnickmap)
    
temp++
    
    
formatex(vaulte31,"%d"temp)
    
nvault_set(vaultnickmapvaulte)
}
//===========================================================
public say_mcount(id)
{
    new 
nick[32], nickmap[64]
    
    
get_user_name(id,nick,31)
    
    
formatex(nickmap63"%s-%s",nick,map)

    new 
get1 nvault_get(vault,map)
    new 
get2nvault_get(vault,nickmap)
    
    
client_print(id,print_chat,"[Mcount] You have played on %s - %d times on this server",map,get2)
    
client_print(id,print_chat,"[Mcount] Map %s has played on server %d times on this server",map,get1)

Just cause a player hasnt played a map on the server doesnt mean the player has never played the map in his/hers life.
__________________
Public Project Progress: [||||||||||]
Pantheon is offline
GordonFreeman (RU)
Veteran Member
Join Date: Jan 2010
Location: Uzbekistan
Old 02-04-2011 , 08:58   Re: Map Counter
Reply With Quote #9

OK
__________________
The functional way is the right way
GordonFreeman (RU) is offline
Old 02-04-2011, 09:02
GordonFreeman (RU)
This message has been deleted by GordonFreeman (RU).
Old 02-04-2011, 09:18
GordonFreeman (RU)
This message has been deleted by GordonFreeman (RU).
xakintosh
I run no-steam servers!
Join Date: Feb 2010
Location: Edge of nowhere
Old 02-04-2011 , 13:16   Re: Map Counter
Reply With Quote #10

Maybe sqlx version for this it's awesome ;]
__________________
As soon as possible.
xakintosh is offline
Send a message via Yahoo to xakintosh Send a message via Skype™ to xakintosh
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 03:12.


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