Raised This Month: $ Target: $400
 0% 

2D array with strings


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GuskiS
Veteran Member
Join Date: Aug 2007
Location: Latvia
Old 07-20-2013 , 16:06   2D array with strings
Reply With Quote #1

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? :/
__________________
Finished mods:
Trouble in Terrorist Town
MurderMod
The Hidden
Cowboys vs Indians
JailBreak Supreme
Survival Madness

Last edited by GuskiS; 07-20-2013 at 16:07.
GuskiS is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-20-2013 , 19:06   Re: 2D array with strings
Reply With Quote #2

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.
__________________
fysiks is offline
GuskiS
Veteran Member
Join Date: Aug 2007
Location: Latvia
Old 07-21-2013 , 06:39   Re: 2D array with strings
Reply With Quote #3

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 :/
__________________
Finished mods:
Trouble in Terrorist Town
MurderMod
The Hidden
Cowboys vs Indians
JailBreak Supreme
Survival Madness

Last edited by GuskiS; 07-21-2013 at 06:45.
GuskiS is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-21-2013 , 15:13   Re: 2D array with strings
Reply With Quote #4

Quote:
Originally Posted by GuskiS View Post
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.
__________________
fysiks is offline
GuskiS
Veteran Member
Join Date: Aug 2007
Location: Latvia
Old 07-21-2013 , 18:28   Re: 2D array with strings
Reply With Quote #5

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 :/
__________________
Finished mods:
Trouble in Terrorist Town
MurderMod
The Hidden
Cowboys vs Indians
JailBreak Supreme
Survival Madness
GuskiS is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-21-2013 , 21:16   Re: 2D array with strings
Reply With Quote #6

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.
__________________
fysiks is offline
1023168216
Member
Join Date: Jun 2013
Location: Tokyo
Old 07-22-2013 , 07:24   Re: 2D array with strings
Reply With Quote #7

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
1023168216 is offline
GuskiS
Veteran Member
Join Date: Aug 2007
Location: Latvia
Old 07-22-2013 , 08:43   Re: 2D array with strings
Reply With Quote #8

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?
__________________
Finished mods:
Trouble in Terrorist Town
MurderMod
The Hidden
Cowboys vs Indians
JailBreak Supreme
Survival Madness
GuskiS is offline
1023168216
Member
Join Date: Jun 2013
Location: Tokyo
Old 07-24-2013 , 23:15   Re: 2D array with strings
Reply With Quote #9

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 View Post
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 is offline
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 06:29.


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