AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   2D array with strings (https://forums.alliedmods.net/showthread.php?t=221326)

GuskiS 07-20-2013 16:06

2D array with strings
 
PHP Code:

new const g_IconNames[31][] = 
{
    
"",
    
"p228",
    
""// shield
    
"scout",
    
"hegrenade",
    
"xm1014",
    
""// c4
    
"mac10",
    
"aug",
    
"smokegrenade",
    
"elites",
    
"fiveseven",
    
"ump45",
    
"sg550",
    
"galil",
    
"famas",
    
"usp45",
    
"glock18",
    
"awp",
    
"mp5",
    
"m249",
    
"m3",
    
"m4a1",
    
"tmp",
    
"g3sg1",
    
"flashbang",
    
"deagle",
    
"sg552",
    
"ak47",
    
"not_available"// knife
    
"p90"
}

enum _:DeadData
{
    
g_KilledBy,
    
g_KilledWeap,
    
g_KilledTime
}

On client death:
g_StoredInfo[victim][g_KilledWeap] = get_user_weapon(killer

When I kill with glock, g_StoredInfo[victim][g_KilledWeap] shows 18 which is right, but when I do g_IconNames[g_StoredInfo[victim][g_KilledWeap]] it shows me 103 but it should show me the string which is glock18, right? What I'm doing wrong? :/

fysiks 07-20-2013 19:06

Re: 2D array with strings
 
103 is the letter 'g'. Whatever you are doing, you are not treating it as a string but instead as an integer. You need to use it as a string.

GuskiS 07-21-2013 06:39

Re: 2D array with strings
 
Sorry, my bad. I should never code when I need to sleep that bad, was using %d instead of %s.

Another question, how to display .tga image in motd? It seems I can't :/

fysiks 07-21-2013 15:13

Re: 2D array with strings
 
Quote:

Originally Posted by GuskiS (Post 1995580)
Sorry, my bad. I should never code when I need to sleep that bad, was using %d instead of %s.

Another question, how to display .tga image in motd? It seems I can't :/

If it doesn't work then use a different format.

GuskiS 07-21-2013 18:28

Re: 2D array with strings
 
Well, I would like to use gfx\vgui images to show who killed that person via motd. It would need too much resource for every weapon :/

fysiks 07-21-2013 21:16

Re: 2D array with strings
 
As far as I know, tga files are only rendered by the game. The MOTD is not part of the game (in this sense), it's a web browser.

1023168216 07-22-2013 07:24

Re: 2D array with strings
 
if you want to show tga file in game,i think you need to use ACG.dll or metahook.dll.it 's easier and more convenient to use ACG than metahook. to get ACG,u can get into the website "http://lolifun.net/en/index.html" to download it

GuskiS 07-22-2013 08:43

Re: 2D array with strings
 
I need to show it in motd, not in game itself. Now I know that HTML can't show TGA images, but then again, is there other local storage place for CS weapon images that could be used in MOTD?

1023168216 07-24-2013 23:15

Re: 2D array with strings
 
maybe the following code is what you need.
Code:

"Resource/UI/MOTD.res"
{
        "ClientMOTD"
        {
                "ControlName"                "Frame"
                "fieldName"                "ClientMOTD"
                "xpos"                "0"
                "ypos"                "0"
                "wide"                "640"
                "tall"                "480"
                "autoResize"                "0"
                "pinCorner"                "0"
                "visible"                "1"
                "enabled"                "1"
                "tabPosition"                "0"
                "setTitleBarVisible"        "0"
        }
        "Image1"
        {
                "ControlName"                "ImagePanel"
                "fieldName"                "Picture"
                "xpos"                        "0"
                "ypos"                        "0"
                "wide"                        "160"
                "tall"                        "240"
                "autoResize"                "0"
                "pinCorner"                "0"
                "visible"                "1"
                "enabled"                "1"
                "image"                        "motd/motd_01" //the tga file(in cstrike/motd/motd_01.tga)
                "scaleImage"                "1"
        }
        "Image2"
        {
                "ControlName"                "ImagePanel"
                "fieldName"                "Picture"
                "xpos"                        "160"
                "ypos"                        "0"
                "wide"                        "160"
                "tall"                        "240"
                "autoResize"                "0"
                "pinCorner"                "0"
                "visible"                "1"
                "enabled"                "1"
                "image"                        "motd/motd_02"
                "scaleImage"                "1"
        }
        "Image3"
        {
                "ControlName"                "ImagePanel"
                "fieldName"                "Picture"
                "xpos"                        "320"
                "ypos"                        "0"
                "wide"                        "160"
                "tall"                        "240"
                "autoResize"                "0"
                "pinCorner"                "0"
                "visible"                "1"
                "enabled"                "1"
                "image"                        motd/motd_03
                "scaleImage"                "1"
        }
        "Image4"
        {
                "ControlName"                "ImagePanel"
                "fieldName"                "Picture"
                "xpos"                        "480"
                "ypos"                        "0"
                "wide"                        "160"
                "tall"                        "240"
                "autoResize"                "0"
                "pinCorner"                "0"
                "visible"                "1"
                "enabled"                "1"
                "image"                        motd/motd_04
                "scaleImage"                "1"
        }
        "Image5"
        {
                "ControlName"                "ImagePanel"
                "fieldName"                "Picture"
                "xpos"                        "0"
                "ypos"                        "240"
                "wide"                        "160"
                "tall"                        "240"
                "autoResize"                "0"
                "pinCorner"                "0"
                "visible"                "1"
                "enabled"                "1"
                "image"                        motd/motd_05
                "scaleImage"                "1"
        }
        "Image6"
        {
                "ControlName"                "ImagePanel"
                "fieldName"                "Picture"
                "xpos"                        "160"
                "ypos"                        "240"
                "wide"                        "160"
                "tall"                        "240"
                "autoResize"                "0"
                "pinCorner"                "0"
                "visible"                "1"
                "enabled"                "1"
                "image"                        motd/motd_06
                "scaleImage"                "1"
        }
        "Image7"
        {
                "ControlName"                "ImagePanel"
                "fieldName"                "Picture"
                "xpos"                        "320"
                "ypos"                        "240"
                "wide"                        "160"
                "tall"                        "240"
                "autoResize"                "0"
                "pinCorner"                "0"
                "visible"                "1"
                "enabled"                "1"
                "image"                        motd/motd_07
                "scaleImage"                "1"
        }
        "Image8"
        {
                "ControlName"                "ImagePanel"
                "fieldName"                "Picture"
                "xpos"                        "480"
                "ypos"                        "240"
                "wide"                        "160"
                "tall"                        "240"
                "autoResize"                "0"
                "pinCorner"                "0"
                "visible"                "1"
                "enabled"                "1"
                "image"                        motd/motd_08
                "scaleImage"                "1"
        }
        "ok"
        {
                "ControlName"                "Button"
                "fieldName"                        "ok"
                "xpos"                "34"
                "ypos"                "407"
                "wide"                "575"
                "tall"                "42"
                "autoResize"                "0"
                "pinCorner"                "2"
                "visible"                "1"
                "enabled"                "1"
                "tabPosition"                "0"
                "labelText"                " "
                "textAlignment"                "center"
                "dulltext"                "0"
                "brighttext"                "0"
                "command"                "okay"
        }
}

Quote:

Originally Posted by GuskiS (Post 1996343)
I need to show it in motd, not in game itself. Now I know that HTML can't show TGA images, but then again, is there other local storage place for CS weapon images that could be used in MOTD?



All times are GMT -4. The time now is 06:29.

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