AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Motd background too small [Solved] (https://forums.alliedmods.net/showthread.php?t=275651)

~Ice*shOt 12-05-2015 09:50

Motd background too small [Solved]
 
Here is the code

PHP Code:

public MotdiPlayer )
{
    new 
szMotd1024 ], szTitle128 ], iPos 0;

    
formatexszTitlecharsmaxszTitle ), "Motd" );

    
iPos += formatexszMotdiPos ], charsmaxszMotd ) - iPos"<html>" );

    
iPos += formatexszMotdiPos ], charsmaxszMotd ) - iPos"<head>" );
    
iPos += formatexszMotdiPos ], charsmaxszMotd ) - iPos"<style type=^"text/css^">" );
    
iPos += formatexszMotdiPos ], charsmaxszMotd ) - iPos"html {height:100%;}" );
    
iPos += formatexszMotdiPos ], charsmaxszMotd ) - iPos"body {height:100%; margin:0; padding:0;}" );
    
iPos += formatexszMotdiPos ], charsmaxszMotd ) - iPos"#bg {position:fixed; top:0; left:0; width:100%; height:100%;}" );
    
iPos += formatexszMotdiPos ], charsmaxszMotd ) - iPos"#content {position:relative; z-index:1;}" );
    
iPos += formatexszMotdiPos ], charsmaxszMotd ) - iPos"</style>" );
    
iPos += formatexszMotdiPos ], charsmaxszMotd ) - iPos"</head>" );

    
iPos += formatexszMotdiPos ], charsmaxszMotd ) - iPos"<body>" );
    
iPos += formatexszMotdiPos ], charsmaxszMotd ) - iPos"<div id=^"bg^"><img src=^"http://i.imgur.com/ufLyCar.png^" width=^"100%^" height=^"100%^" alt=^"^"></div>" );
    
iPos += formatexszMotdiPos ], charsmaxszMotd ) - iPos"</body>" );

    
iPos += formatexszMotdiPos ], charsmaxszMotd ) - iPos"</html>" );

    
show_motdiPlayerszMotd szTitle );


why image appears like this, but not fully backgrounded?

http://i.imgur.com/SDsjir3.jpg

klippy 12-05-2015 10:48

Re: Motd background too small
 
It's probably that '%' characters are getting erased because you are using formatex() to format your page. In formatex() (and every other string formatting function), to display a single percentage character, you have to write two, e.g:
Code:

#bg {width:100%%}

~Ice*shOt 12-05-2015 11:05

Re: Motd background too small
 
Quote:

Originally Posted by wickedd (Post 2368995)
Because the the height and width is 100.

Edit: That's the size of my avatar.

No, it's 100% there's difference between 100 and 100%

Quote:

Originally Posted by KliPPy (Post 2369006)
It's probably that '%' characters are getting erased because you are using formatex() to format your page. In formatex() (and every other string formatting function), to display a single percentage character, you have to write two, e.g:
Code:

#bg {width:100%%}

Thanks! It's perfect now.

wickedd 12-05-2015 11:12

Re: Motd background too small
 
Quote:

Originally Posted by ~Ice*shOt (Post 2369014)
No, it's 100% there's difference between 100 and 100%

Oops you're right, I don't know how I didn't see that. :oops:


All times are GMT -4. The time now is 18:02.

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