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

Help Showing a HUD and player list.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 05-29-2007 , 21:48   Help Showing a HUD and player list.
Reply With Quote #1

PHP Code:
public updateHud(id)
{
    
//if(isOfficer(id) == 0) return PLUGIN_HANDLED
    
new jaillist[2048] = "Players in jail:^n" 
    
new player_id[32], players_numplayer_name[32], jailName[64], flagtemp[128]
    
get_players(player_idplayers_num)
    for (new 
0players_numi++)
    {
        
flag getFlag(player_id[i]) 
        
get_user_name(player_id[i], player_name31)
        if(
flag 0)
        {
            
jailName jailPlace(flag)
            
format(temp,127,"%s -  %s^n",player_namejailName
            
add(jaillist,sizeof(jaillist),temp
        }
    }
    if(
strfind(jaillist,"-") == -1) {
        
add(jaillist,2047,"-  None")
    } 
    
set_hudmessage(025500.570.1206.012.0)
    
show_hudmessage(idjaillist)

    return 
PLUGIN_CONTINUE

What im attempting to do is show a player list like so.

Eathier:
Players in jail:
- none

or

Players in jail:
Peter - CELL NAME
John - CELL NAME
Bob - CELL NAME
Styles is offline
Send a message via AIM to Styles
Deviance
Veteran Member
Join Date: Nov 2004
Location: Sweden
Old 05-30-2007 , 00:01   Re: Help Showing a HUD and player list.
Reply With Quote #2

Code:
public updateHud(id) {     //if(isOfficer(id) == 0) return PLUGIN_HANDLED     new jaillist[2048], len         len = format(jaillist, 2047, "Players in jail:^n")         new player_id[32], players_num, player_name[32], jailName[64], flag        get_players(player_id, players_num)         for (new i = 0; i < players_num; i++)     {         flag = getFlag(player_id[i])         get_user_name(player_id[i], player_name, 31)             if(flag > 0)         {             jailName = jailPlace(flag)             len += format(jaillist[len], 2047-len,"%s -  %s^n", player_name, jailName)         }     }         if(strfind(jaillist,"-") == -1) {         len += format(jaillist[len], 2047-len, "-  None")     }         set_hudmessage(0, 255, 0, 0.57, 0.12, 0, 6.0, 12.0)     show_hudmessage(id, jaillist)     return PLUGIN_CONTINUE }
Deviance is offline
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 05-30-2007 , 03:05   Re: Help Showing a HUD and player list.
Reply With Quote #3

I now have

PHP Code:
public updateHud(id)
{
    
//if(isOfficer(id) == 0) return PLUGIN_HANDLED
    
new jaillist[2048], len
    set_hudmessage
(025500.570.12,0,0.0,99.9,0.0,0.0,3)
    
len format(jaillist2047"Players in jail:^n")
    
    new 
player_id[32], players_numplayer_name[32], jailName[64], flag
    get_players
(player_idplayers_num)
    
    for (new 
0players_numi++)
    {
        new 
temp player_id[i]
        
flag getFlag(temp
        
get_user_name(tempplayer_name31)
    
//flag = getFlag(i)
    //get_user_name(1, player_name, sizeof(player_name))
    
client_print(tempprint_chat"%s is Flag Num "flag)
        if(
flag != 0)
        {
            
jailName jailPlace(tempflag)
            
len += format(jaillist[len], 2047-len,"%s -  %s^n"player_namejailName
        }
    }
    
    if(
strfind(jaillist,"-") == -1) {
        
len += format(jaillist[len], 2047-len"-  None")
    } 
    
    
    
show_hudmessage(idjaillist)

    return 
PLUGIN_CONTINUE

But it prints out is flag num not the name or anything. idk why.. noob fix porobally.
Styles is offline
Send a message via AIM to Styles
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 05-30-2007 , 03:48   Re: Help Showing a HUD and player list.
Reply With Quote #4

You're going to need to show more code. Like your jailPlace function, for example.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 05-30-2007 , 05:04   Re: Help Showing a HUD and player list.
Reply With Quote #5

Just have something like this in the jailPlace function.
PHP Code:
public jailPlace(flagstring[], len)
{
 switch(
flag)
 {
  case ?: 
formatex(stringlen"jailname")
 }

PHP Code:
new jailname[64]
jailPlace(flagjailname63
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.

Last edited by Cheap_Suit; 05-30-2007 at 05:13.
Cheap_Suit is offline
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 05-30-2007 , 17:35   Re: Help Showing a HUD and player list.
Reply With Quote #6

I know my funtcion is like

public publicJail(flagnum)
{
new string;
switch(flagnum)
{
case 0: string = "hi";
default: string = "error";
}
return string;
}

What Im saying is its having a problem geting the users NAME ect.. information that way i can't print out a name or a current flag num cuz it can't get them right.
Styles is offline
Send a message via AIM to Styles
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 05-30-2007 , 19:05   Re: Help Showing a HUD and player list.
Reply With Quote #7

AFAIK, you cant format strings like that.
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.
Cheap_Suit is offline
Lee
AlliedModders Donor
Join Date: Feb 2006
Old 05-30-2007 , 19:11   Re: Help Showing a HUD and player list.
Reply With Quote #8

I don't think you can use strings as a case in a switch block either.
Lee is offline
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 05-30-2007 , 23:36   Re: Help Showing a HUD and player list.
Reply With Quote #9

heres jailPlace.

Also, it doesn't even show the users name.

Code:
public jailPlace(id, flagNumber) {     new string[64]     switch(flagNumber)     {         case 0: string = "Minor Offences Cell"         case 1: string = "Robbery Cell"         case 2: string = "Major Offences Cell"         case 3: string = "Heavy Assault Cell"         case 4: string = "Firing Squad"         case 6: string = "Admin Cell 1"         case 7: string = "Admin Cell 2"         case 8: string = "Catacombes"         default: string = "Error"     }     return string }
Styles is offline
Send a message via AIM to Styles
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 06-03-2007 , 01:48   Re: Help Showing a HUD and player list.
Reply With Quote #10

Anyone, I could really use this.
Styles is offline
Send a message via AIM to Styles
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 17:04.


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