AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   html (https://forums.alliedmods.net/showthread.php?t=333023)

MacL 06-14-2021 14:02

html
 
hey alliedmodders, i have problem with html and i have some questions. problem is why this code does not support 12 parts and is completely broken.
How can I change the background and replace it with a photo?
and how can i put image in <th> tags or how can i change font and color? thanks
code
PHP Code:

    len format(buffer[len], 2367-len"<style>body{background:#112233;font-family:Arial}th{background:#2E2E2E;color:#FFF;padding:5px 2px;text-align:left}td{padding:5px 2px}table{width:100%%;background:#EEEECC;font-size:12px;}h2{color:#FFF;font-family:Verdana;text-align:center}#nr{text-align:center}#c{background:#E2E2BC}</style><h2>Something</h2><table border=^"0^" align=^"center^" cellpadding=^"0^" cellspacing=^"1^"><tbody>";
    
len += format(buffer[len], 2367-len"<tr><th id=nr>#</th><th>Name<th>Persoal<th>Andowna<th>Money<th>Armor<th>Health<th>Gapo<th>Time<th>stats<th>Last time<th>Points");
        
    for(new 
startgNumi++) {
        
get_user_name(idname31);
        
get_stats(iiStatsiBodyname31);
            
        new 
Float:fstats[8];
        for (new 
08j++)
            
fstats[j] = float(iStats[j]);
            
        while(
containi(name"<") != -1)
            
replace(name31"<""<");
        while(
containi(name">") != -1)
            
replace(name31">"">");
            
        
len += format(buffer[len], 2367-len"<tr %s><td id=nr>%d<td>%s<td>%d<td>%d<td>%d<td>%d<td>%d<td>%d<td>%d<td>%d<td>%d",((i%2)==0) ? "" " id=c", (i+1), namepart4part5part6part7part8part9part10part11part12);
    }
        
    new 
server_name[64];
    
get_cvar_string("hostname"server_name63);
    
len += format(buffer[len], 2367-len"<tr><th colspan=^"7^" id=nr>%s"server_name);
        
    
len += format(buffer[len], 2367-len"</tbody></table></body>");
    
show_motd(idbuffer"Moda"); 

something like this:
change the background with photo and font and colors.

jimaway 06-14-2021 16:07

Re: html
 
https://forums.alliedmods.net/showthread.php?t=109369

you'll have to host a website if you want to get past this limitation and show more characters in the motd window

MacL 06-14-2021 16:14

Re: html
 
Quote:

Originally Posted by jimaway (Post 2749742)
https://forums.alliedmods.net/showthread.php?t=109369

you'll have to host a website if you want to get past this limitation and show more characters in the motd window

Goddamn it. thanks, but how can i change font style or color? for color, I tried:
Code:


style="color:blue;"

but it did not work

MacL 06-14-2021 17:23

Re: html
 
Quote:

Originally Posted by jimaway (Post 2749742)
https://forums.alliedmods.net/showthread.php?t=109369

you'll have to host a website if you want to get past this limitation and show more characters in the motd window

If so, how can I do this? Please explain more and give an example

jimaway 06-14-2021 17:40

Re: html
 
Quote:

Originally Posted by MacL (Post 2749749)
If so, how can I do this? Please explain more and give an example

Code:

show_motd(playerid, "http://yourmotdwebsite.com", "header")

MacL 06-14-2021 18:00

Re: html
 
Quote:

Originally Posted by jimaway (Post 2749750)
Code:

show_motd(playerid, "http://yourmotdwebsite.com", "header")

For example, if I want to get money, point, Played time of the player (I used to do this in the plugin itself, like that code i wrote), should this be done in the site file itself or..?

Bugsy 06-14-2021 20:01

Re: html
 
You'll need to send the info from your game server to the web server. Will be easier to just go simpler with format and use the standard MOTD.

731 06-14-2021 22:05

Re: html
 
1 Attachment(s)
Create a "htm" folder under the "cstrike" folder, put "top15.htm" in this "htm" folder, open "top15.htm" with Notepad or other text editing software, and change the url inside Change the following address to a URL address where others can access the "top15_result.htm" file. (Note: The "top15_result.htm" file is generated by the plug-in)

  To use the TOP15 of this plug-in, you need to enable the web service in your server and use the "htm" folder as the root address of your web server or one of its virtual directories. The content of the web service is beyond the scope of this discussion, so I won’t introduce it here, please check the information yourself to solve it.

top15.htm details
<Meta http-equiv="Refresh" Content="0.1; Url=http://....../top15_result.htm">
<body bgcolor=black></body>

Code:

public show_top15(param[])
{
        new id=param[0]
        new iMax = get_statsnum()
        new izStats[8], izBody[8]
        new iLen = 0

        if (iMax > 15)
                iMax = 15
        // modified by Rulzy
        new lNick[26], lKills[16], lDeaths[16], lHits[16], lShots[16], lHs[16], lEff[16], lAcc[16], name[128]

        format(lNick, 25, "%L", id, "NICK_ANSI")
        format(lKills, 15, "%L", id, "KILLS_ANSI")
        format(lDeaths, 15, "%L", id, "DEATHS_ANSI")
        format(lHits, 15, "%L", id, "HITS_ANSI")
        format(lShots, 15, "%L", id, "SHOTS_ANSI")
        format(lHs, 15, "%L", id, "HS_ANSI")
        format(lEff, 15, "%L", id, "EFF_ANSI")
        format(lAcc, 15, "%L", id, "ACC_ANSI")

        ucfirst(lEff)
        ucfirst(lAcc)


        new file = fopen("htm/top15_result.htm","wt")
        if(!file)
        {
                set_task(random_float(0.1, 0.3), "show_top15", id, param, 1)
                return
        }
        fprintf(file,"<html><head><body><style type=^"text/css^">")
        fprintf(file,"body{font-family:Arial,sans-serif;color:#FFCC99;background-color:#000000;margin-left:8px;margin-top:3px}td{text-align=right}")
        fprintf(file,".header{background-color:#9C0000;}.one{background-color:#310000;}.two{background-color:#630000;}</style></head><body>")
        fprintf(file,"<table style='font-size:12px;'><tr class=^"header^"><th>#<th>%s<th>%s<th>%s<th>%s<th>%s<th>%s<th>%s<th>%s",lNick, lKills, lDeaths, lHits, lShots, lHs, lEff, lAcc)

        for (new i = 0; i < iMax && MAX_BUFFER_LENGTH - iLen > 0; i++)
        {
                get_stats(i, izStats, izBody, name, 127)
                replace_all(name, 127, "&","&amp;")
                replace_all(name, 127, "<","&lt;")
                replace_all(name, 127, ">","&gt;")
                fprintf(file,"<tr class=^"%s^">", i % 2 ? "one":"two")
                fprintf(file,"<td>%d<td style='text-align=left'>%s<td>%d<td>%d<td>%d<td>%d<td>%d<td>%3.1f%%<td>%3.1f%%", i + 1, name, izStats[STATS_KILLS],
                        izStats[STATS_DEATHS], izStats[STATS_HITS], izStats[STATS_SHOTS], izStats[STATS_HS], effec(izStats), accuracy(izStats))
        }
        fprintf(file,"</table></body></html>")
        fclose(file)
        show_motd(id, "htm/top15.htm", "Top 15")
}



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

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