AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   The most played maps (https://forums.alliedmods.net/showthread.php?t=77215)

anakin_cstrike 09-07-2008 16:21

The most played maps
 
Hi...how can i know the most 5,for example, played maps on the server ? looping yes, but how ? nvault ?

Iwon 09-07-2008 18:33

Re: The most played maps
 
1. Get the map name.
2. Get the players vote on that map
3. Save using vault - so you can edit later on..
4. use Case 1 case 2 case 3 Case 4 case 5
like
PHP Code:

case :
{
 if(
cs_assault || voted >= notvoted)
 
//when they vote there name will go in the vault with the map
 
get_user_name(idname31)
 
vault()



Exolent[jNr] 09-07-2008 21:04

Re: The most played maps
 
Code:
#include <amxmodx> #include <amxmisc> #include <fvault> new const g_vault_name[] = "popular_maps"; public plugin_init() {     register_concmd("amx_popular_maps", "CmdMaps", ADMIN_MAP);         new mapname[64];     get_mapname(mapname, sizeof(mapname) - 1);         new info[10];     fvault_get_data(g_vault_name, mapname, info, sizeof(info) - 1);         num_to_str(str_to_num(info) + 1, info, sizeof(info) - 1);         fvault_set_data(g_vault_name, mapname, info); } public CmdMaps(client, level, cid) {     if( !cmd_access(client, level, cid, 1) )     {         return PLUGIN_HANDLED;     }         new Array:maps = ArrayCreate();     new Array:count = ArrayCreate();     new total;         new size = fvault_size(g_vault_name);     new mapname[64], info[10];     for( new i = 0; i < size; i++ )     {         fvault_get_keyname(g_vault_name, i, mapname, sizeof(mapname) - 1);                 fvault_get_data(g_vault_name, mapname, info, sizeof(info) - 1);                 ArrayPushString(maps, mapname);         ArrayPushCell(count, str_to_num(info));         total++;     }         // i got lazy but...     // just sort them by count, and you will have all 5.     // "maps" contains all maps ever played on the server     // "count" contains the amount of times played for each map         return PLUGIN_HANDLED; }

#include <fvault>

anakin_cstrike 09-07-2008 21:06

Re: The most played maps
 
Thanks:up: I'm tired..i go to bed now...if you have time, please make that for me.


All times are GMT -4. The time now is 03:11.

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