PDA

View Full Version : self.name help



bLaCkdEMOnChL
13th September 2014, 04:34
Hi, I wanted to know if they can help. I need to press on the name of a player leaves the name selected by a iprintln.

When you select any name from the list always comes in the name I'm using and not the one you selected it.

757

Always out, or if my change my name out which I use, not the one I select.

758



menuDef
{
name "demoplayer"
rect 0 0 640 480
focuscolor GLOBAL_FOCUSED_COLOR
style WINDOW_STYLE_EMPTY
blurWorld 5.0
onEsc
{
close demoplayer;
}

// Gradient
itemDef
{
style WINDOW_STYLE_SHADER
//rect -107 0 554 480
rect 0 0 640 480 HORIZONTAL_ALIGN_FULLSCREEN VERTICAL_ALIGN_FULLSCREEN
background "gradient"
visible 1
decoration
}

#include "ui/bars.menu"

itemDef
{
type ITEM_TYPE_TEXT
visible 1
origin ORIGIN_TITLE
forecolor 1 1 1 1
text "Peticion de demo"
textfont UI_FONT_NORMAL
textscale GLOBAL_HEADER_SIZE
decoration
}

// DEMO PLAYER
itemDef
{
visible 1
rect 0 0 192 270
origin 73 80
forecolor GLOBAL_UNFOCUSED_COLOR
style WINDOW_STYLE_FILLED
outlinecolor .5 .5 .5 .5
type ITEM_TYPE_LISTBOX
textscale GLOBAL_TEXT_SIZE
textstyle ITEM_TEXTSTYLE_SHADOWED
textfont UI_FONT_NORMAL
textaligny -1
elementtype LISTBOX_TEXT
elementwidth 120
elementheight 24
feeder FEEDER_PLAYER_LIST
columns 1 2 190 25
mouseEnter
{
fadein message_arena
}
mouseExit
{
fadeout message_arena
}
}
itemDef
{
visible 1
rect 0 0 128 24
origin ORIGIN_OK
forecolor GLOBAL_UNFOCUSED_COLOR
type ITEM_TYPE_BUTTON
text "@MPUI_OK"
textfont UI_FONT_NORMAL
textscale GLOBAL_TEXT_SIZE
textstyle ITEM_TEXTSTYLE_SHADOWED
textaligny 20
action
{
play "mouse_click";
scriptMenuResponse "demo";
close demoplayer;
exec "wait 100";
exec "ScreenShotJPEG";
scriptMenuResponse "demoss";
}
onFocus
{
play "mouse_over";
}
}
}


scriptMenuResponse "demo"



demopetition()
{
iprintln ("" + self.name + " ^7a foro, peticion de demo & cleandod.");
}



scriptMenuResponse "demoss"



demopetitionss()
{
self iprintln ("^2ScreenShotJPEG Guardada!");
}


As I can make out the name you select from the list of players?

guiismiti
13th September 2014, 05:08
The player who uses the menu is recording a demo and taking a screenshot of himself.
self refers to the player who is using the menu, and since you're printing self.name, you're printing the name of the player who is using the menu.
The response of the menu should be the ID number of the player you selected from the list (I don't know how to do that, would be useful for me to know it).
This is how it should your function should look then:



demopetition(menu_response)
{
players = getentarray("player", "classname");
iprintln ("" + players[menu_response].name + " ^7a foro, peticion de demo & cleandod.");
}

serthy
13th September 2014, 10:39
It is NOT possible without hacking the CoD2 exe to do this. The list is a FEEDER_LIST and interacts with cod2 uiscripts which cannot be modified only called via .menu.
However you can build your own list with names and show them with the dvar command (again via .menu).
You have then manually via .gsc script manage this yourself and you will not be able to have a nice scrollbar on the side.
You have to use a shitload ov clientcvar on each player(-name) OR server cvars and call makeCvarServerInfo().
There are alot of examples on this site of how it is done.

kung foo man
13th September 2014, 13:18
No need to hack the client, the server is enough (aka libcod). :D

The player vote kick menu is sending ClientCommand's, which can be pre-processed and then ignored (so no vote will be called, just "return" out of callback).

Code for _callbacksetup.gsc:



CodeCallback_PlayerCommand(args)
{
output = "";
for (i=0; i<args.size; i++)
output += args[i] + ", ";

printf("PLAYER COMMAND! message=\"%\"\n", output);
//self iprintlnbold("you wrote: " + output);
args = fixChatArgs(args);

// ...
// ...
// ...


Output:



PLAYER COMMAND! message="mr, 32, 1, axis, "
PLAYER COMMAND! message="mr, 32, 3, kar98k_mp, "
PLAYER COMMAND! message="mr, 32, 0, callvote, "
PLAYER COMMAND! message="callvote, tempBanUser, kung, "


Whole code here: http://killtube.org/showthread.php?1201-Extension-Player-Command-Control-%28includes-CHAT-Control-for-Builtin-B3!%29&p=4374

IzNoGoD
13th September 2014, 13:58
No need to hack the client, the server is enough (aka libcod). :D

The player vote kick menu is sending ClientCommand's, which can be pre-processed and then ignored (so no vote will be called, just "return" out of callback).

Code for _callbacksetup.gsc:



CodeCallback_PlayerCommand(args)
{
output = "";
for (i=0; i<args.size; i++)
output += args[i] + ", ";

printf("PLAYER COMMAND! message=\"%\"\n", output);
//self iprintlnbold("you wrote: " + output);
args = fixChatArgs(args);

// ...
// ...
// ...


Output:



PLAYER COMMAND! message="mr, 32, 1, axis, "
PLAYER COMMAND! message="mr, 32, 3, kar98k_mp, "
PLAYER COMMAND! message="mr, 32, 0, callvote, "
PLAYER COMMAND! message="callvote, tempBanUser, kung, "


Whole code here: http://killtube.org/showthread.php?1201-Extension-Player-Command-Control-%28includes-CHAT-Control-for-Builtin-B3!%29&p=4374

hey, you stole my idea i had 3 months ago

guiismiti
13th September 2014, 21:22
How can I link the menu response to a function?

I want to improve the air strike mod.
I'll create a new menu which can be opened from the ingame menu.
This menu will have the superior view of the current map. Over this background image, there will be a matrix of several menu elements. The text of each element should be a dot ".". The position of the air strike target will be defined depending on the menu response (each dot will send a different response).
Considering that the size of each map is different (width and length), I'll add dvartest for the dots, to disable the ones outside the map area.

Editted: already having trouble getting the superior view of large maps (like Iwo Jima). Will try it in radiant, althought I never used it before.

serthy
13th September 2014, 22:31
imho not worth the hassle
I'd go with this method:
when calling in an airstrike, simple move the player up to 10000 and let the position be a bullettrace of the players view. this does not require e special setup menu, saves alot ov client cvars and you do not have to deal with the map-image of each map.

guiismiti
13th September 2014, 22:39
Sounds nice, but the visibility on Iwo Jima is horrible

760

IzNoGoD
13th September 2014, 22:51
just set fx_enable to 0 while in air

IzNoGoD
17th September 2014, 19:59
hey, you stole my idea i had 3 months ago

Here's the final version of said idea (implemented today for i was bored)

http://classic.xfire.com/video/62ca27/ (watch it in fullscreen mode)

serthy
17th September 2014, 21:21
the most fascinating is your fantastic music choice :) i like it

IzNoGoD
17th September 2014, 21:43
https://www.youtube.com/watch?v=kztAvgm4CNE

Edit: damn, never looked at the clip... fcking hipster :P

Guess im a hipster now...

filthy_freak_
16th October 2014, 22:07
PLAYER COMMAND! message="mr, 32, 1, axis, "
PLAYER COMMAND! message="mr, 32, 3, kar98k_mp, "
PLAYER COMMAND! message="mr, 32, 0, callvote, "
PLAYER COMMAND! message="callvote, tempBanUser, kung, "


So using this I can grab which name the players select on the feeder list? What if two players use the same name? Can't do something like a custom ban menu because you risk banning the wrong person.

kung foo man
17th October 2014, 07:50
You can just rename or kick people with the same name. E.g. a loop which is constantly checking for same names (using a []-hashmap and checking if the name/key isDefined() already). Maybe somebody knows such script and can post here. It should track the time of the names, so the new names get kicked and not the old.

filthy_freak_
19th October 2014, 16:42
Well i'v been working on a way to alert players why they were kicked when having a duplicate name.

I'm trying to create a custom kick message using stock localized strings for language reasons.

I'v managed to do this:
787


itemDef
{
name line1
//text "Server Disconnected - Player kicked."
text "@EXE_SERVERDISCONNECTREASON"
//type ITEM_TYPE_MULTI
textfont UI_FONT_NORMAL
textscale .25
style UI_BUTTON_STYLE
textstyle UI_BUTTON_TEXT_STYLE
rect 65 37 100 15
textalign 1
textalignx 51 // center
textaligny 11
decoration
backcolor UI_BUTTON_BACK_COLOR
forecolor UI_BUTTON_TEXT_COLOR
visible 1
dvar "serv_kicked"
//dvarFloatList { "@EXE_PLAYERKICKED" 0 }
}


As you can see - "&&1" is showing. I know how to set/use the "&&1" with iprintln/iprintlnbold but not menus.

I'v tried using "dvarFloatList" but it produced:
788


itemDef
{
name line1
//text "Server Disconnected - Player kicked."
text "@EXE_SERVERDISCONNECTREASON"
type ITEM_TYPE_MULTI
textfont UI_FONT_NORMAL
textscale .25
style UI_BUTTON_STYLE
textstyle UI_BUTTON_TEXT_STYLE
rect 65 37 100 15
textalign 1
textalignx 51 // center
textaligny 11
decoration
backcolor UI_BUTTON_BACK_COLOR
forecolor UI_BUTTON_TEXT_COLOR
visible 1
dvar "serv_kicked"
dvarFloatList { "@EXE_PLAYERKICKED" 0 }
}


Text is no longer centered and "&&1" still shows.


So with menus how can I use localized strings that have "&&1"?

serthy
19th October 2014, 16:54
without loc strings:
look into the extreme mod (_ex_security.gsc (http://redirect.forgotten-soldiers.com/cod2/bia_ex27/extreme/_ex_security.gsc))

player setClientCvar( "com_errortitle" , "Kicked!" );
player setClientCvar( "com_errormessage" , "You've been kicked for bla" );

filthy_freak_
19th October 2014, 17:04
without loc strings:
look into the extreme mod (_ex_security.gsc (http://redirect.forgotten-soldiers.com/cod2/bia_ex27/extreme/_ex_security.gsc))

player setClientCvar( "com_errortitle" , "Kicked!" );
player setClientCvar( "com_errormessage" , "You've been kicked for bla" );

Yeah I know I can do it easily without loc strings but i'm trying to use loc strings so it is translated properly for those who use different languages. Is it not possible?

Also updated previous post with more info

EDIT: Should clarify - I know there are other ways to alert players why they were kicked but i'm hoping this method will work so I can use it for other things.

IzNoGoD
19th October 2014, 17:23
You should try and use my translation engine for libcod to do that... Translations are stored serverside for easy updating, it supports 16 different languages and 1k items per language, all of which can be upped manually in the sourcecode of libcod.

filthy_freak_
19th October 2014, 17:31
You should try and use my translation engine for libcod to do that... Translations are stored serverside for easy updating, it supports 16 different languages and 1k items per language, all of which can be upped manually in the sourcecode of libcod.

Hmm if there was a tut i'd give it a go ;)

IzNoGoD
20th October 2014, 07:41
Hmm if there was a tut i'd give it a go ;)

http://killtube.org/showthread.php?2026-Tutorial-Translation-engine