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

Structure HUD [HELP]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
flamin
BANNED
Join Date: Jul 2009
Location: Los Teques
Old 03-24-2010 , 15:36   Structure HUD [HELP]
Reply With Quote #1

Hi! Need help structure HUD of the screenshot attached!

If they see in the hud shows the maps elected by the players and the number of votes that carries the map!

I have my code to vote on maps, can help to structure the hud with my code?


Here i leave my code and the screenshot:

PHP Code:
#define MAX_MAPS 20

new pug_votemap_votes[MAX_MAPS]
new 
pug_votemap_name[MAX_MAPS][32]
new 
pug_votemap_count;

public 
try_load_votemap_menu()
{
    
// Rukia: Get our maps.ini
    
static filename[64]
    
get_configsdirfilename63 )
    
formatfilename63"%s/maps.ini"filename )

    
// Rukia: Otherwise, just use mapcycle
    
if(file_exists(filename)) 
    {
        
load_votemap_menu(filename)
        if(
pug_votemap_count != 0) return;
    }

    
copy(filename,63,"mapcycle.txt")
    
load_votemap_menu(filename)
}

public 
load_votemap_menu(filename[])
{
    new 
file fopen(filename,"rb")

    static 
text[256], szDesc[48], num[10]
    while( (
pug_votemap_count MAX_MAPS) && !feof(file) && fgets(file,text,255) )
    {
        
// Rukia: Take out common comment conventions
        
if(text[0]==';') continue
            if( (
text[0]=='/') && (text[1]=='/') ) continue

        
// Rukia: Remove the newline character
        
text[strlen(text)] = '^0'

        
// Rukia: Get the map name and description out of what we read
        
strbreak(text,pug_votemap_name[pug_votemap_count],31,szDesc,47)
        
// Rukia: If the map is invalid, skip it
        
if( !is_map_validpug_votemap_name[pug_votemap_count] ) ) continue;

        
// Rukia: If there is no description (such as if we use mapcycle) then just use the first part of the map name
        
if(szDesc[0] == '^0'strtok(pug_votemap_name[pug_votemap_count],szDesc,47,"",0,'.',1)
    
        
// Rukia: The map number will be our index
        
formatex(num,9,"%i",pug_votemap_count)

        
// Rukia: Add the item into the menu and move on
        
menu_additem(pug_votemap_menupug_votemap_name[pug_votemap_count],num )

        
pug_votemap_count++;
    }

    
fclose(file)
}

public 
cmd_votemap(id,level,cid)
{
    if (!
cmd_access(idlevelcid1) ) return pug_msg_tmp_empty(id,"PUG_CMD_NOTALLOWED")
    
    
votemap_start()
    return 
PLUGIN_HANDLED;
}

public 
votemap_start()
{
    if(
pug_voting) { set_task(get_pcvar_float(pug_cvar_vote_time),"votemap_start",100 pug_votemap_menu); return; }

    
pug_voting 1;
    
arrayset(pug_voted,0,33)

    
arrayset(pug_votemap_votes,0,pug_votemap_count)
    
pug_display_menu_all(pug_votemap_menu)

    
client_print(0,print_chat,"",pug_headerLANG_PLAYER"PUG_VOTE_START""PUG map");
    
console_print(0,"%s %L",pug_headerLANG_PLAYER"PUG_VOTE_START""PUG map");
    
set_task(get_pcvar_float(pug_cvar_vote_time),"votemap_end",100 pug_votemap_menu)
}

public 
votemap_end()
{
    
pug_cancel_menu()

    
pug_voting 0;
    
remove_task 100 pug_votemap_menu )

    if(
votemap_count()) voteteam_start();
}

public 
votemap_handle(idmenuitem)
{
    if( 
item ) return PLUGIN_CONTINUE;
 
    static 
accesscallback
    
static cmd[3], name[32], cmdname[32]
 
    
menu_item_getinfo(menuitemaccesscmd,2,cmdname,31callback);
    
pug_votemap_votes[str_to_num(cmd)]++;

    
get_user_name(id,name,31)
        
    
client_print(0,print_chat,"",pug_headerLANG_PLAYER"PUG_VOTED_FOR"namecmdname);
    
console_print(0,"%s %L",pug_headerLANG_PLAYER"PUG_VOTED_FOR"namecmdname);

    
pug_voted[id] = 1;
    if(
pug_should_stopvote() ) votemap_end()
 
    return 
PLUGIN_HANDLED;
}

public 
votemap_count()
{
    new 
winnerwinner_votesvotes

    
for(new 0pug_votemap_count; ++i)
    {
        
votes pug_votemap_votes[i]
        if(
votes winner_votes) { winner iwinner_votes votes; }
        else if(
votes == winner_votes) if(random_num(0,1)) { winner iwinner_votes votes; }
    }

    if(
pug_votemap_votes[winner] == 0)
    { 
        
set_task1.0 "pug_votemap_change2" randompug_votemap_count ) );
    }

    new 
Floattmp float(pug_get_players()) * get_pcvar_float(pug_cvar_vote_perc
    if( 
pug_votemap_votes[winner] < floatround(tmp,floatround_floor) )
    {
        
set_task1.0 "pug_votemap_change2" randompug_votemap_count ) );
    }

    
client_print(0,print_chat,"%s %L",pug_headerLANG_PLAYER"PUG_VOTE_WIN"pug_votemap_name[winner]);
    
console_print(0,"%s %L",pug_headerLANG_PLAYER"PUG_VOTE_WIN"pug_votemap_name[winner]);

    
pug_voting 0;
    
votemap_noswitch 1;
    
set_pcvar_num(pug_cvar_votemap_e,0)

    
message_begin(MSG_ALLSVC_INTERMISSION)
    
message_end()

    
set_task(3.0,"pug_votemap_change",winner)
    return 
PLUGIN_CONTINUE
}

public 
pug_votemap_change2iMapIndex )
{
    
client_printprint_chat "%s has been chosen randomly" pug_votemap_nameiMapIndex ] );
    
server_cmd"changelevel %s" pug_votemap_nameiMapIndex ] );
}  

public 
pug_votemap_change(winner)
{
    
server_cmd("changelevel %s",pug_votemap_name[winner]);

Attached Thumbnails
Click image for larger version

Name:	maps.JPG
Views:	653
Size:	77.3 KB
ID:	62114  

Last edited by flamin; 03-24-2010 at 15:55.
flamin is offline
flamin
BANNED
Join Date: Jul 2009
Location: Los Teques
Old 04-06-2010 , 00:12   Re: Structure HUD [HELP]
Reply With Quote #2

some help?
flamin is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 04-06-2010 , 00:26   Re: Structure HUD [HELP]
Reply With Quote #3

Use the type of "structure" I used in this plugin:
https://forums.alliedmods.net/showpo...39&postcount=9

Also, stop tagging your threads with [HELP]. This is Scripting Help, I assume you need help the second I open the section.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
flamin
BANNED
Join Date: Jul 2009
Location: Los Teques
Old 04-06-2010 , 01:07   Re: Structure HUD [HELP]
Reply With Quote #4

Your code has nothing to do with what asked or with what i want :S
flamin is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 04-06-2010 , 01:12   Re: Structure HUD [HELP]
Reply With Quote #5

Quote:
Originally Posted by flamin View Post
Your code has nothing to do with what asked or with what i want :S
Well what do you want...? I assumed you needed help with the hud message being displayed based on the title, description, and keywords "HUD Structure".

Explain what you want a little more.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
flamin
BANNED
Join Date: Jul 2009
Location: Los Teques
Old 04-06-2010 , 01:49   Re: Structure HUD [HELP]
Reply With Quote #6

It is easy look the screenshot attached in my question #1, i want to implement that hud identical but with my code, understand?
flamin is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 04-06-2010 , 01:58   Re: Structure HUD [HELP]
Reply With Quote #7

Quote:
Originally Posted by flamin View Post
It is easy look the screenshot attached in my question #1, i want to implement that hud identical but with my code, understand?
Yes, in the 2nd to last function (UPDATE_Hud), there is a method that is similar to what you will need.

Look at it and implement it into your code. Don't come to Scripting Help expecting people to recreate your entire plugin for you. If you want that, post in Suggestions / Requests for now on.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
flamin
BANNED
Join Date: Jul 2009
Location: Los Teques
Old 04-06-2010 , 02:14   Re: Structure HUD [HELP]
Reply With Quote #8

You have all the reason in what you say wrecked...

I have created other hud, but this i have been done quite difficult apply with my code

You can help to do? please!

If it is not very uncomfortable clear
flamin is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-06-2010 , 19:10   Re: Structure HUD [HELP]
Reply With Quote #9

It's just a HUD message with a different position.
__________________
fysiks is offline
DruGzOG
Veteran Member
Join Date: Nov 2007
Location: Unknown
Old 04-06-2010 , 20:46   Re: Structure HUD [HELP]
Reply With Quote #10

Quote:
Originally Posted by flamin View Post
You have all the reason in what you say wrecked...

I have created other hud, but this i have been done quite difficult apply with my code

You can help to do? please!

If it is not very uncomfortable clear
Obviously this isn't your code if you cannot accomplish this.
__________________
DruGzOG is offline
Send a message via AIM to DruGzOG
Old 04-07-2010, 00:00
flamin
This message has been deleted by flamin.
Old 04-09-2010, 20:28
flamin
This message has been deleted by flamin.
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 01:48.


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