Name of selected class

InfinityScript plugins for dedicated servers.
SwaggerBobLee
TeknoCow
TeknoCow
Posts: 69
Joined: Mon Apr 18, 2016 8:26 am

Name of selected class

Postby SwaggerBobLee » Fri May 20, 2016 10:00 am

Hi, what are the addresses of selected (not in use, because player can change and will be setted on next respawn) class for each player?

I've found these addresses, but seems that are same addresses for all players: when a player change his class, in these addresses there is the name of class that he selected.
The problem is that are same addresses, so there is only the classname of the last player that chose.

Image
User avatar
~Lambder
TeknoSheep
Posts: 448
Joined: Thu Apr 11, 2013 5:40 pm
Location: Meadow.
Contact:

Re: Name of selected class

Postby ~Lambder » Fri May 20, 2016 11:35 am

Don't know what the actual question is, but there is a notify for when somebody changes his class.
You should check it out.
SwaggerBobLee
TeknoCow
TeknoCow
Posts: 69
Joined: Mon Apr 18, 2016 8:26 am

Re: Name of selected class

Postby SwaggerBobLee » Fri May 20, 2016 6:37 pm

Lambder wrote:Don't know what the actual question is, but there is a notify for when somebody changes his class.
You should check it out.

I'm already getting class name choosed by players, using method of notify, but i'm checking all notification to find the correct one.

Code: Select all

OnNotify("joined_team", () =>
                {
                    Player.Notified += (str, args) =>
                    {
                        if (str.ToString().Equals("menuresponse") && args[0].ToString().Equals("changeclass") && !(args[1].ToString().ToString().Contains("back") || args[1].ToString().ToString().Contains("none")))
                        {
                            Player.SetField("PlayerClass", args[1]);
                        }
                    };
                });


I'm searching a fastest and efficient way to get class name, maybe through some address. There is something like this?
User avatar
~Lambder
TeknoSheep
Posts: 448
Joined: Thu Apr 11, 2013 5:40 pm
Location: Meadow.
Contact:

Re: Name of selected class

Postby ~Lambder » Fri May 20, 2016 7:48 pm

Jesus Christ.

Use Entity.OnNotify(). It's way cleaner.

Entity.Notified is only for debugging and logging purposes.



SwaggerBobLee
TeknoCow
TeknoCow
Posts: 69
Joined: Mon Apr 18, 2016 8:26 am

Re: Name of selected class

Postby SwaggerBobLee » Fri May 20, 2016 8:37 pm

Lambder wrote:Jesus Christ.

Use Entity.OnNotify(). It's way cleaner.

Entity.Notified is only for debugging and logging purposes.

Ahahah sorry i'm at first experiences and i'm still learning :D

Anyway, now is ok?

Code: Select all

PlayerConnecting += new Action<Entity>(Player =>
            {
                OnNotify("menuresponse", (cmd, choice) =>
                {
                    if (cmd.ToString().Contains("changeclass") && !(choice.ToString().ToString().Contains("back") || choice.ToString().ToString().Contains("none")))
                        Player.SetField("PlayerClass", choice);
                });
            });
User avatar
~Seraphim
TeknoHorse
TeknoHorse
Posts: 1186
Joined: Sun Jan 12, 2014 10:36 pm

Re: Name of selected class

Postby ~Seraphim » Fri May 20, 2016 10:02 pm

Classes names aren't sent in reliable commands.
The format of a "class change" is usually something like

Code: Select all

menuResponse < match id > < custom/default class word >< 1-15 ( For custom ) or 1-5 ( For default )

menuResponse 2 custom1 - First custom class
menuResponse 2 custom15 - Fifteenth ( And last ) custom class
menuResponse 2 default1 - First default class
menuResponse 2 default5 - Fifth ( And last ) default class


If you want the ACTUAL class name what they named it as ( Though I have no idea why you would ), you'll need to parse the clients' mpdata profile which is sent to the server upon connection.
Parsing it normally would yield the class name they use. You however would need to find the offset strictly related to iw5mp_server.

Cheat Engine could easily do this. Name your class some strange and uncommon name ( Such as "^1ASDFHELLO" ), join your server ( Ensure you're client num 0 to get the base ) and do a string scan.
Voila. Btw if I recall, class names are a max of 16 chars.
User avatar
A2ON
TeknoDog
TeknoDog
Posts: 49
Joined: Fri Jun 19, 2015 9:19 am

Re: Name of selected class

Postby A2ON » Fri Jun 17, 2016 5:56 am

c4271605 wrote:Classes names aren't sent in reliable commands.
The format of a "class change" is usually something like

Code: Select all

menuResponse < match id > < custom/default class word >< 1-15 ( For custom ) or 1-5 ( For default )

menuResponse 2 custom1 - First custom class
menuResponse 2 custom15 - Fifteenth ( And last ) custom class
menuResponse 2 default1 - First default class
menuResponse 2 default5 - Fifth ( And last ) default class


If you want the ACTUAL class name what they named it as ( Though I have no idea why you would ), you'll need to parse the clients' mpdata profile which is sent to the server upon connection.
Parsing it normally would yield the class name they use. You however would need to find the offset strictly related to iw5mp_server.

Cheat Engine could easily do this. Name your class some strange and uncommon name ( Such as "^1ASDFHELLO" ), join your server ( Ensure you're client num 0 to get the base ) and do a string scan.
Voila. Btw if I recall, class names are a max of 16 chars.


i have a question

how to get you custom default class. eg infected class

use menuResponse notify can't capture and use default 0-5 is not custom default class

:(
User avatar
~Seraphim
TeknoHorse
TeknoHorse
Posts: 1186
Joined: Sun Jan 12, 2014 10:36 pm

Re: Name of selected class

Postby ~Seraphim » Fri Jun 17, 2016 10:14 am

A2ON wrote:
c4271605 wrote:Classes names aren't sent in reliable commands.
The format of a "class change" is usually something like

Code: Select all

menuResponse < match id > < custom/default class word >< 1-15 ( For custom ) or 1-5 ( For default )

menuResponse 2 custom1 - First custom class
menuResponse 2 custom15 - Fifteenth ( And last ) custom class
menuResponse 2 default1 - First default class
menuResponse 2 default5 - Fifth ( And last ) default class


If you want the ACTUAL class name what they named it as ( Though I have no idea why you would ), you'll need to parse the clients' mpdata profile which is sent to the server upon connection.
Parsing it normally would yield the class name they use. You however would need to find the offset strictly related to iw5mp_server.

Cheat Engine could easily do this. Name your class some strange and uncommon name ( Such as "^1ASDFHELLO" ), join your server ( Ensure you're client num 0 to get the base ) and do a string scan.
Voila. Btw if I recall, class names are a max of 16 chars.


i have a question

how to get you custom default class. eg infected class

use menuResponse notify can't capture and use default 0-5 is not custom default class

:(

Weird, onNotify should hook all related menuresponse codes.
No clue then.
User avatar
Hans Krebs
TeknoGod
TeknoGod
Posts: 322
Joined: Tue Dec 23, 2014 12:44 am

Re: Name of selected class

Postby Hans Krebs » Sat Jun 18, 2016 9:48 am

Actually, the format for menuresponse commands is

Code: Select all

mr <magic num> <command id> <args>
The magic number starts at 16 and is multiplied by two every time the server spawns; the command ID is 8 or 9 for class changes; the arguments are indeed "custom0" or "default1" or so.
User avatar
Boboo
TeknoDev
Posts: 145
Joined: Thu Jul 23, 2015 3:41 pm

Re: Name of selected class

Postby Boboo » Sat Jun 18, 2016 4:42 pm

Hans Krebs wrote:Actually, the format for menuresponse commands is

Code: Select all

mr <magic num> <command id> <args>
The magic number starts at 16 and is multiplied by two every time the server spawns; the command ID is 8 or 9 for class changes; the arguments are indeed "custom0" or "default1" or so.


How everyone just calls it "magicnumber" :-D :-D :-D :-D
Image

Return to “InfinityScript”

Who is online

Users browsing this forum: No registered users and 5 guests