Interaction with "Samp-Server.exe"-Process
#1

Hey, I'm working on a program, that should help me to maintain my server. It will be a programm (which is located on the same machine as the server), that should interact with the Server-Process. My question: How is it possible to give the Process the order to e.g. kick playerid 3?
It would be very nice if you could help me with that, I'm getting quite desperate with that at the moment.
Thanks.
Reply
#2

rcon commands, thats the only thing that i can suggest :/

https://sampwiki.blast.hk/wiki/Controlli...#RCON_Commands
for a list of all of em
Reply
#3

What kind of program? Program created in C++/C or website in PHP?
Reply
#4

I say go with using the rcon commands for it.. unless you can create your own commands..

Are you talking about something sorta like a CP?
Reply
#5

Quote:
Originally Posted by Disturbed-
Посмотреть сообщение
I say go with using the rcon commands for it.. unless you can create your own commands..

Are you talking about something sorta like a CP?
Indeed. It will be a CP, written in Java, but, if you know how it's done in other languages like C/C++ or PHP, you can tell me how it's done and I will look how I can assign it to my needs.

I think some of you misunderstood me, so i will tell you again: I want to call rcon commands from a other program, that I'll write in Java. I will just interact with the java applet, which "sends" the rcon command to the samp-server.exe, that's what my plan looks like.
Reply
#6

I wrote a java query class some time ago. It offers all query functions, including sending rcon commands. I could release it if you like, however it is just written for the functionality, the code is quite dirty.

Edit: or check this https://sampforum.blast.hk/showthread.php?tid=104299 and convert it to java on your own, it isnt much work.
Reply
#7

RCON, PHP, IRC or UDP connection thing. Forum/****** search will tell you the rest!
Reply
#8

Quote:
Originally Posted by Mauzen
Посмотреть сообщение
I wrote a java query class some time ago. It offers all query functions, including sending rcon commands. I could release it if you like, however it is just written for the functionality, the code is quite dirty.

Edit: or check this https://sampforum.blast.hk/showthread.php?tid=104299 and convert it to java on your own, it isnt much work.
okay thanks so far
Код:
		$sPacket = 'SAMP';
		$sPacket .= chr(strtok($this->aServer[0], '.'));
		$sPacket .= chr(strtok('.'));
		$sPacket .= chr(strtok('.'));
		$sPacket .= chr(strtok('.'));
		$sPacket .= chr($this->aServer[1] & 0xFF);
		$sPacket .= chr($this->aServer[1] >> 8 & 0xFF);
		$sPacket .= 'p4150';
That's the part that I need, I guess. Could you please explain to me what it exactly does, or give an example of how $sPacket could look like?
Reply
#9

All lines expcept the last one are for the packet header, it contains the server ip and port. All saved as bytes, not as string.
The last line is the real query. the first letter of the last line always signalizes the type of the query. 'p' is for pings, 'i' is a serverinfo request. 'x' would be an RCON command.

I figured out most of it myself before I took a look at other codes or even knew there is a wiki page that explains it all in detail
https://sampwiki.blast.hk/wiki/Query

Fell free to ask if you got further questions, or dont understand something in the article.
The most difficult part of it is all the byte-operation in my opinion, had not worked with it like this before
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)