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

MapVote Ini


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DarthMan
Veteran Member
Join Date: Aug 2011
Old 02-22-2017 , 15:28   MapVote Ini
Reply With Quote #1

This is more of a request , but the thing is that I am not good at reading from ini files. I need a script that will read the map names from mapvote.ini and use it to create models in front of every mapvote_breaker entity, which is a func wall, without repeating any of them if there are more than or equal to 44 maps in the ini . For each model it should display the mapname in center if u get close to it. This is really important for me, because I want something that u can only find for CS, a map where u can vote other maps. This will be used for non-CS goldsrc servers. Thanks !
DarthMan is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 02-22-2017 , 17:47   Re: MapVote Ini
Reply With Quote #2

wrong section...
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
DarthMan
Veteran Member
Join Date: Aug 2011
Old 02-22-2017 , 17:56   Re: MapVote Ini
Reply With Quote #3

Quote:
Originally Posted by Natsheh View Post
wrong section...
Yes, how can I move it to the request section?

Btw, I did this, with no luck

Code:
    ent_light_1 = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "light"))
    set_pev(ent_light_1, pev_origin, "-417.0, 952.0, -165.0")
    //entity_set_origin(ent_light_1,Float:{-417.0,952.0,-165.0})
    DispatchKeyValue(ent_light_1, "brightness", "5");
    DispatchKeyValue(ent_light_1, "style", "0");
    DispatchKeyValue(ent_light_1, "_light", "241 241 241");
    dllfunc( DLLFunc_Spawn, ent_light_1 );
    }
DarthMan is offline
pizzahut
Senior Member
Join Date: Oct 2004
Old 02-25-2017 , 12:07   Re: MapVote Ini
Reply With Quote #4

Part of your request, that is reading an ini file and selecting random maps from it, without duplicates.
Code:
#include <amxmodx> #include <amxmisc> #define MAXNAMES 500 #define PANELCOUNT 40 new g_mapnames[MAXNAMES][32] new g_mapcount new g_mapselected[MAXNAMES] new g_mapselection[PANELCOUNT] public plugin_init() {     register_plugin("Random map selection", "1", "pizzahut")     read_cfg_file()     register_event("ResetHUD", "display_maps", "be") } read_cfg_file() {     new configfile[200]     get_configsdir(configfile, charsmax(configfile))     format(configfile, charsmax(configfile), "%s/maps.ini", configfile)     if (file_exists(configfile))     {         new mapname[32], chars_read         for (new line; (line < file_size(configfile, 1)) && (g_mapcount < MAXNAMES); line++)         {             read_file(configfile, line, mapname, charsmax(mapname), chars_read)             if (is_map_valid(mapname))             {                 copy(g_mapnames[g_mapcount], charsmax(g_mapnames[]), mapname)                 g_mapcount++             }         }     }     new map     for (new panel; (panel < PANELCOUNT) && (panel < g_mapcount); panel++)     {         map = random(g_mapcount)         while (g_mapselected[map])             map = random(g_mapcount)         g_mapselected[map] = 1         g_mapselection[panel] = map     } } public display_maps(id) {     new map     for (new panel; (panel < PANELCOUNT) && (panel < g_mapcount); panel++)     {         map = g_mapselection[panel]         client_print(id, print_console, "%d. %s", panel + 1, g_mapnames[map])     }     client_print(id, print_chat, "Check console for the list of selected maps.") }

Last edited by pizzahut; 02-26-2017 at 05:44.
pizzahut is offline
pizzahut
Senior Member
Join Date: Oct 2004
Old 02-25-2017 , 15:29   Re: MapVote Ini
Reply With Quote #5

I forgot about pre-caching, plus this probably won't even work (not tested).

Code:
#include <amxmodx> #include <amxmisc> #include <engine> #define MAXNAMES 500 #define PANELCOUNT 40 new g_mapnames[MAXNAMES][32] new g_mapcount new g_mapselected[MAXNAMES] new g_mapselection[PANELCOUNT] public plugin_init() {     register_plugin("Assign maps to panels", "1", "pizzahut")     read_cfg_file()     display_maps() } read_cfg_file() {     new configfile[200]     get_configsdir(configfile, charsmax(configfile))     format(configfile, charsmax(configfile), "%s/maps.ini", configfile)     if (file_exists(configfile))     {         new mapname[32], chars_read         for (new line; (line < file_size(configfile, 1)) && (g_mapcount < MAXNAMES); line++)         {             read_file(configfile, line, mapname, charsmax(mapname), chars_read)             if (is_map_valid(mapname))             {                 copy(g_mapnames[g_mapcount], charsmax(g_mapnames[]), mapname)                 g_mapcount++             }         }     }     new map     for (new panel; (panel < PANELCOUNT) && (panel < g_mapcount); panel++)     {         map = random(g_mapcount)         while (g_mapselected[map])             map = random(g_mapcount)         g_mapselected[map] = 1         g_mapselection[panel] = map     } } display_maps() {     new ent, panel, ent_info_target, model_path[128]     new Float:mins[3], Float:maxs[3], Float:origin[3]     while ((ent = find_ent_by_tname(ent, "glass_votemap")))     {         entity_get_vector(ent, EV_VEC_mins, mins)         entity_get_vector(ent, EV_VEC_maxs, maxs)         origin[0] = (mins[0] + maxs[0]) / 2.0         origin[1] = (mins[1] + maxs[1]) / 2.0         origin[2] = (mins[2] + maxs[2]) / 2.0         ent_info_target = create_entity("info_target")         entity_set_origin(ent_info_target, origin)         format(model_path, charsmax(model_path), "models/fm/maps/%s.mdl",g_mapnames[g_mapselection[panel]])         entity_set_model(ent_info_target, model_path)         panel++     } }

From DarthMan:

Code:
public plugin_precache() {     new conffile_mdl[200]     new configdir_mdl[200]     get_configsdir(configdir_mdl,199)     format(conffile_mdl,199,"%s/mapvote_precache.ini",configdir_mdl)     if(!file_exists(conffile_mdl))     {         log_amx("amxmodx/configs/mapvote_precache.ini is missing!")         return 0     }     new lines = file_size(conffile_mdl,1)     new file[1024], len     for(new i=0;i<=lines;i++)     {         read_file(conffile_mdl,i,file,1023,len)         if(equal(file,"")) continue;         if(!equal(file,";",1)) precache_model(file);     }     return PLUGIN_HANDLED }

Last edited by pizzahut; 02-25-2017 at 15:50.
pizzahut is offline
pizzahut
Senior Member
Join Date: Oct 2004
Old 02-26-2017 , 13:12   Re: MapVote Ini
Reply With Quote #6

Known bug: May find several panels for a player.
Code:
public display_map_name(task_id) {     new ent     new entcount, entlist[32]     new panel     while ((ent = find_ent_by_tname(ent, "target_map")))     {         entcount = find_sphere_class(ent, "player", 100.0, entlist, sizeof(entlist))         if (entcount > 0) client_print(0, print_chat, "Found %d players at panel %d.", entcount, panel + 1)         for(new player_index; player_index < entcount; player_index++)         {             set_hudmessage(g_hud_colour[0], g_hud_colour[1], g_hud_colour[2], -1.0, -1.0, 0, 0.0, 0.8, 0.1, 0.1, -1)             show_hudmessage(entlist[player_index], g_mapnames[g_mapselection[panel]])         }         panel++     } }

Last edited by pizzahut; 02-26-2017 at 16:54.
pizzahut is offline
DarthMan
Veteran Member
Join Date: Aug 2011
Old 02-27-2017 , 03:52   Re: MapVote Ini
Reply With Quote #7

Quote:
Originally Posted by pizzahut View Post
Known bug: May find several panels for a player.
Code:
public display_map_name(task_id) {     new ent     new entcount, entlist[32]     new panel     while ((ent = find_ent_by_tname(ent, "target_map")))     {         entcount = find_sphere_class(ent, "player", 100.0, entlist, sizeof(entlist))         if (entcount > 0) client_print(0, print_chat, "Found %d players at panel %d.", entcount, panel + 1)         for(new player_index; player_index < entcount; player_index++)         {             set_hudmessage(g_hud_colour[0], g_hud_colour[1], g_hud_colour[2], -1.0, -1.0, 0, 0.0, 0.8, 0.1, 0.1, -1)             show_hudmessage(entlist[player_index], g_mapnames[g_mapselection[panel]])         }         panel++     } }
If possible, please no longer post the code here because I would not like the mapvote plugin to be public for everyone to be able to use it on any goldsrc game. Only post if I request something there or if someone else asks for smth related to mapvote.

Last edited by DarthMan; 02-27-2017 at 03:53.
DarthMan is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 02-27-2017 , 06:24   Re: MapVote Ini
Reply With Quote #8

Quote:
Originally Posted by DarthMan View Post
If possible, please no longer post the code here because I would not like the mapvote plugin to be public for everyone to be able to use it on any goldsrc game. Only post if I request something there or if someone else asks for smth related to mapvote.
Then go post somewhere else.
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
DarthMan
Veteran Member
Join Date: Aug 2011
Old 02-27-2017 , 08:13   Re: MapVote Ini
Reply With Quote #9

Quote:
Originally Posted by wickedd View Post
Then go post somewhere else.
I did not ask here for the things that pizzahut did the last time. Yes, I told him to help me, but the thing is that what I actually asked for was not asked here, he just posted the code because I beleive he thinks thinked that it would be better to post it here for other people in case they want to make something simillar but they don't know how to.
DarthMan is offline
pizzahut
Senior Member
Join Date: Oct 2004
Old 02-27-2017 , 13:22   Re: MapVote Ini
Reply With Quote #10

It was not asked here, what?
Quote:
Originally Posted by DarthMan View Post
I need a script that will read the map names from mapvote.ini and use it to create models in front of every mapvote_breaker entity, which is a func wall, without repeating any of them if there are more than or equal to 44 maps in the ini . For each model it should display the mapname in center if u get close to it.
pizzahut 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 09:21.


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