Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Chicken

#1
Quote from: habi on May 23, 2023, 03:28 PM
Quote from: Chicken on May 22, 2023, 01:05 PMHabi, I want to ask a question, if  NPC dies, I want to respawn it, but I add player.spwan(); in the event onPlayerRequestClass does not work, why? How to do?

Chicken, currently they do not have the function to request class and spawn. I will add these functions so that when dead, they can spawn again.



OKay,You're great now. npc plugin is the best plugin,My friend
#2
Habi, I want to ask a question, if  NPC dies, I want to respawn it, but I add player.spwan(); in the event onPlayerRequestClass does not work, why? How to do?
#3
Hey habi, I used the SetMaxPlayersOut function, but I'm not sure what this function is for. Is it used to exceed the maxplayer slot? However,  I use this function, the server directly crashes.
#4
Quote from: habi on Jan 14, 2023, 12:44 PMThanks Chicken. However, there is no way to save player slots.

Npcs can be hidden from the VCMP Browser. see here


I have tried, using the HideNPC plugin, NPC will not display it on the browser, but it will still be counted as a player in the server
#5
Good Plugins habi,but  It would be great if this plugin can be used without occupying Max player, and I think less than 100 NPCs is not enough to satisfy developers
#6
Quote from: habi on Mar 12, 2022, 01:13 AMYou want to make the NPC face the player?
You want to make the player face the NPC?
Which one of above?

Please post some codes so that we get an idea of what you are doing.
Thank you habi my math is not ideal. Now I have finished the production
#7
Quote from: habi on Mar 11, 2022, 11:22 AM
Quote from: Chicken on Mar 11, 2022, 09:43 AMI created an NPC object, how can I make it always face him?
Did you refer the NPC object a 'bot' or a regular object created using CreateObject?

Either way, you will be needing this
Is there a way to judge the direction of the npc?
#8
I created an NPC object, how can I make it always face him?
#9
Quote from: habi on Feb 24, 2022, 07:40 AMI will show you a live demonstration. This will be helpful for others too in learning wireshark.
See i opened VCMPBrowser and

I clicked on a server shown in the image. At that moment Browser sends packets to that server.

I had already opened wireshark( packet capturing tool) and see what it captured

The data section of packet which is highlighted in blue. Its ASCII equivalent is shown on right.

56 43 4d 50 41 02 41 d3 00 20 69

Lets investigate what this is.
56 means 5*16+6=80+6=86 and 86 means 'V' in ascii table. ascii table
So first 4 bytes( each of these two digits is called byte) 56 43 4d 50 means VCMP

Now, what is 41=16*4+1=65
02=2
41=again, 65
d3=d*16+3=13*16+3=211
So the 4 bytes 41 02 41 d3 gives 65 2 65 211
Now what is the server ip from VCMP Browser?

Ha. it is exactly the same.

The next 2 bytes viz 00 20 and port 8192 on investigation showed me. port= 00 +( 20 *256 )= 00 + (32*256)=00+8192. This is becauses 20 means 2*16+0=32

The last byte is 69. This is the ASCII equivalent of 'i'. You can see it on the right panel of wireshark window.
i means we want information about server name, gamemode etc.

Having learnt this. you could do the reverse. Will you?

In fact, I have already captured the package and extracted the data a few days ago, but I don't know how to specify an IP address and port, maybe your explanation will help me, thank you Habi :D
#10
Quote from: habi on Feb 24, 2022, 01:40 AMWhen sending request to server, there is no need to convert hex or byte. It is the same packet every time. I remember last byte of packet is i or c. if it is i, you want information no.1
If it is c, you want information no.2 from server.
And information no.1 is servers name, gamemode, no.of players.
Information 2 contains names of all the players.
wiki
Could you be more specific in asking about convert hex to bytes?
like I have this byte, how i convert this bytes to ascii, etc.
Iterate through the buffer received from server. Or Post the buffer received here. We can help you
http://wiki.thijn.ovh/index.php?title=Query_Mechanism said that Byte4-10 is composed of IP address and port. If I enter a specified IP address to request a query, what should I do?
#11
Quote from: Xmair on Feb 22, 2022, 11:12 AM
Quote from: Chicken on Feb 21, 2022, 12:17 PMI probably understand, is it possible to get the server name by sending a data packet whose protocol is UDP and whose format is byte set 32+strlen to the server IP and port?
Yes it is possible to get the server name by sending a UDP dgram packet. However I don't think you understand how to parse the result properly so I would suggest you to just use premade code. Fleka did something a few years ago: https://forum.vc-mp.org/?topic=5530.msg39171#msg39171

One small thing to note is you should try changing the magic to 'VCMP' instead of 'MP04' since back when I was coding a browser, some servers wouldn't work if you used 'MP04' as magic.
I understand what you mean, but now there is a question, how should I convert hex and bytes to each other
#12
Quote from: Chicken on Feb 21, 2022, 12:10 PM
Quote from: Xmair on Feb 21, 2022, 12:04 PMI don't really understand what you really mean but if you want to make something such as a server browser, here's what you need to do:

Firstly, you make a GET request to a master list URL (I usually use https://master.thijn.ovh/). This returns a JSON array of servers. You are provided with each announced server's IP, port and official status.

Afterwards, you loop through the server list received from the master list and you send a UDP packet to each of them. There's more information about this in the following wiki page:
http://wiki.thijn.ovh/index.php?title=Query_Mechanism

The page is pretty self explanatory but if you still face issues, you can always use a reference such as:
https://github.com/BigETI/SAMPLauncherNET/blob/master/SAMPLauncherNET/Source/SAMPLauncherNET/Core/Server.cs
It's the same as you said, but I took out the IP and port and there is no way to convert it to the server name and the names of all online players
Quote from: Xmair on Feb 21, 2022, 12:04 PMI don't really understand what you really mean but if you want to make something such as a server browser, here's what you need to do:

Firstly, you make a GET request to a master list URL (I usually use https://master.thijn.ovh/). This returns a JSON array of servers. You are provided with each announced server's IP, port and official status.

Afterwards, you loop through the server list received from the master list and you send a UDP packet to each of them. There's more information about this in the following wiki page:
http://wiki.thijn.ovh/index.php?title=Query_Mechanism

The page is pretty self explanatory but if you still face issues, you can always use a reference such as:
https://github.com/BigETI/SAMPLauncherNET/blob/master/SAMPLauncherNET/Source/SAMPLauncherNET/Core/Server.cs
Quote from: Xmair on Feb 21, 2022, 12:04 PMI don't really understand what you really mean but if you want to make something such as a server browser, here's what you need to do:

Firstly, you make a GET request to a master list URL (I usually use https://master.thijn.ovh/). This returns a JSON array of servers. You are provided with each announced server's IP, port and official status.

Afterwards, you loop through the server list received from the master list and you send a UDP packet to each of them. There's more information about this in the following wiki page:
http://wiki.thijn.ovh/index.php?title=Query_Mechanism

The page is pretty self explanatory but if you still face issues, you can always use a reference such as:
https://github.com/BigETI/SAMPLauncherNET/blob/master/SAMPLauncherNET/Source/SAMPLauncherNET/Core/Server.cs
I probably understand, is it possible to get the server name by sending a data packet whose protocol is UDP and whose format is byte set 32+strlen to the server IP and port?
#13
Quote from: Xmair on Feb 21, 2022, 12:04 PMI don't really understand what you really mean but if you want to make something such as a server browser, here's what you need to do:

Firstly, you make a GET request to a master list URL (I usually use https://master.thijn.ovh/). This returns a JSON array of servers. You are provided with each announced server's IP, port and official status.

Afterwards, you loop through the server list received from the master list and you send a UDP packet to each of them. There's more information about this in the following wiki page:
http://wiki.thijn.ovh/index.php?title=Query_Mechanism

The page is pretty self explanatory but if you still face issues, you can always use a reference such as:
https://github.com/BigETI/SAMPLauncherNET/blob/master/SAMPLauncherNET/Source/SAMPLauncherNET/Core/Server.cs
It's the same as you said, but I took out the IP and port and there is no way to convert it to the server name and the names of all online players
#14
Quote from: habi on Feb 21, 2022, 11:36 AMSure. add socket04rel64 to server.cfg
Then, in your main.nut after the bottom line or in onScriptLoad add
s<-NewSocket(dataReceived);Before this, somewhere you must define dataReceived function.
function dataReceived( data )
{
print("Received data: "+data+"\n");
if(data=="players")
s.Send(GetPlayerCount()+"");
}
Try and tell what Happened

Ref:Ref: wiki NewSocket
used your method and didn't return a value
#15
Quote from: habi on Feb 21, 2022, 11:36 AMSure. add socket04rel64 to server.cfg
Then, in your main.nut after the bottom line or in onScriptLoad add
s<-NewSocket(dataReceived);Before this, somewhere you must define dataReceived function.
function dataReceived( data )
{
print("Received data: "+data+"\n");
if(data=="players")
s.Send(GetPlayerCount()+"");
}
Try and tell what Happened

Ref:Ref: wiki NewSocket
Do I want to use Socket.Start(port,maxConn)??