AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Showing Not Ready (https://forums.alliedmods.net/showthread.php?t=162803)

Diegorkable 07-23-2011 06:58

Showing Not Ready
 
I have a mode that checks if someone is ready or not (you'll see the variable that shows it, g_IsReady), the problem is, that it shows maximum 3 or 2 players that are not ready in the server, and sometimes it doesnt show the name fully, so if my name would be Diegorkable, it would show Diegorka or something like that that is my name and not fully, so it displays just a part of my name, I tried making the variables with [2000] many cells available so it'll let it copy, but still it doesnt, wierd, check the code tell me if you see something please. The Public ShowLeft() refreshes every 1 minute in order to check if he did .rdy or not

PHP Code:

/* Global Variables in the code */
new playersleft 10
new bool:g_bIsReady[11]
new 
notrdy[400] = "Not Ready:^n"
/* Global ... */

public ShowLeft()
{
    if (
playersleft != 0)
    {
        new 
players[32], pnumtempid
     
        
get_players(playerspnum"ch"); 
     
        for( new 
ii<pnumi++ ) 
        { 
            
tempid players[i]; 
            if (
g_bIsReady[tempid] == false)
            {
                new 
playername[200]
                
get_user_name(tempidplayername31)
                new 
toadd[32] = "^n"
                
add(toadd31playername)
                
add(notrdy31toadd)
            }
            
        } 
            
        if (
equali(notrdy"Not Ready:^n"))
        {
            
notrdy "Not Ready:^n^nNone."
        
}
        
        
set_hudmessage(1272552550.030.0506.012.0)
        
show_hudmessage(0notrdy)
        
        
notrdy "Not Ready:^n"
        
set_task(1.0"ShowLeft")
    }
    
    else
    {
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_HANDLED



^SmileY 07-23-2011 09:52

Re: Showing Not Ready
 
get_user_name(tempid, playername, 31)??

new toadd[32] = "^n" ??

Diegorkable 07-23-2011 10:56

Re: Showing Not Ready
 
It gets if the player is not ready (if g_bIsReady is false) then it copies his name into a variable (playername) and adds to it a ^n, so if my name would be "Diego" then it adds it to it "Diego^n", The reason I wanted to do this is that the Not Ready will be a column, list.

Can't hudmessage be a column?

nikhilgupta345 07-23-2011 11:27

Re: Showing Not Ready
 
Are you not getting index out of bounds errors?

The first thing I can see is that this:

new bool:g_bIsReady[11]


needs to be

new bool:g_bIsReady[33]


because you need to hold every player index (1-32).

Try this:

PHP Code:

if (playersleft != 0
    { 
        new 
players[32], pnumtempid;  
      
        
get_players(playerspnum"ch");  
      
        new 
szPlayerName32 ];
        
        for( new 
ii<pnumi++ )  
        {  
            
tempid players[i];  
            if (
g_bIsReady[tempid] == false
            { 
                
get_user_name(tempidplayername31)
                
                
addnotrdycharsmaxnotrdy ), playername );
                
addnotrdycharsmaxnotrdy ), "^n" );
            } 
             
        }  
             
        if (
equali(notrdy"Not Ready:^n")) 
        { 
            
notrdy "Not Ready:^n^nNone." 
        

         
        
set_hudmessage(1272552550.030.0506.012.0
        
show_hudmessage(0notrdy
         
        
notrdy "Not Ready:^n" 
        
set_task(1.0"ShowLeft"
    } 


HBxander 07-23-2011 11:27

Re: Showing Not Ready
 
Show us the whole code, else we can't help you.

Diegorkable 07-23-2011 11:39

Re: Showing Not Ready
 
You don't need the whole code, the rest of the code is that it refreshes that public through a recursive public.... thats all. and nikhilpug..qt13-15813681-36 ill test your code

Diegorkable 07-23-2011 12:18

Re: Showing Not Ready
 
i think it works great :) tyvm


All times are GMT -4. The time now is 00:47.

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