SA-MP Forums Archive
[FilterScript] K-RCON - Simple RCON system based on dialogs - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] K-RCON - Simple RCON system based on dialogs (/showthread.php?tid=604352)



K-RCON - Simple RCON system based on dialogs - iKevin - 03.04.2016





Hi everyone. I'm releasing this because it could be useful for some server. It's called K-RCON because of my firstname (Kevin). Feel free to edit it and do anything with it, but keep my original creation credits please. This is my second published filterscript, but it's not even the last! This filterscript includes a lot of simple features that will be updated. Rates and comments are always welcome!



1) Login with RCON (/rcon login [password])
2) Type /krcon.
3) A dialog will open, with some options.
4) Click on an option and press the "Select" button below.
5) You can now enter a new hostname, mapname, new URL, change RCON pass, lock and unlock server.
6) When you've chosen what you'd like to change/do, click "Proceed" and check the SA:MP client if it worked.
7) You're done, enjoy.














Code:
-Adding some more options, from the original RCON console.
-Use enums to store dialogs.
-Use less cells for the variables (strings).

Code:
version 1.0a
-Released the filterscript.

GitHub
Solidfiles


-Zeex (ZCMD)
-SA:MP Team (SA:MP)
-KevinExec (Filterscript creator)




Re: K-RCON - Simple RCON system based on dialogs - Logic_ - 03.04.2016

make a dialog, which can be used to send msg to online connected players, kick/ban them and more simply, give the user, the all features that RCON gives.


Re: K-RCON - Simple RCON system based on dialogs - iKevin - 03.04.2016

Quote:
Originally Posted by ALiScripter
View Post
make a dialog, which can be used to send msg to online connected players, kick/ban them and more simply, give the user, the all features that RCON gives.
Thanks for the suggestion, might be added in the future updates.


Re: K-RCON - Simple RCON system based on dialogs - AndySedeyn - 03.04.2016

Would be nice to see you use the same conventions that I used in your admin script (i.e.: use a switch statement instead of a bunch of if-statements, don't create variables with 128 cells when the formatted string's maximum size is only ~64 characters, use an enum to store dialog ids to avoid dialog id collisions, and so on...).


Re: K-RCON - Simple RCON system based on dialogs - iKevin - 03.04.2016

Quote:
Originally Posted by AndySedeyn
View Post
Would be nice to see you use the same conventions that I used in your admin script (i.e.: use a switch statement instead of a bunch of if-statements, don't create variables with 128 cells when the formatted string's maximum size is only ~64 characters, use an enum to store dialog ids to avoid dialog id collisions, and so on...).
Alright, thanks.


Re: K-RCON - Simple RCON system based on dialogs - AndySedeyn - 03.04.2016

Also, strings are never empty. Doing the following will therefor not work:
PHP Code:
if(!inputtext[0]) 
Use isnull instead:
PHP Code:
if(isnull(inputtext)) 
isnull is included in zcmd.


Re: K-RCON - Simple RCON system based on dialogs - Gammix - 03.04.2016

Quote:
Originally Posted by AndySedeyn
View Post
Also, strings are never empty. Doing the following will therefor not work:
PHP Code:
if(!inputtext[0]) 
Use isnull instead:
PHP Code:
if(!isnull(inputtext)) 
isnull is included in zcmd.
By default they are empty (string[0] = EOS). Isnull kind of does the same thing to that line of code.

You can use sscanf or strnull.


Re: K-RCON - Simple RCON system based on dialogs - AndySedeyn - 03.04.2016

Quote:
Originally Posted by Gammix
View Post
By default they are empty (string[0] = EOS). Isnull kind of does the same thing to that line of code.

You can use sscanf or strnull.
You are correct in case of dialogs. I read about strings not being empty and I went with the assumption that that was always the case. I tested it just now and it appears that it is only the case for params in zcmd -- I only tested it with commands and dialogs.

Test code:
http://pastebin.com/cUqQAvTj

Console prints:
Code:
[01:03:37] cmd_say --> params: 
[01:03:43] cmd_say --> params: 2
[01:03:45] cmd_say2 --> params: Empty
[01:03:48] cmd_say2 --> params: e
[01:03:56] DIALOG_TEST --> inputtext: Empty
[01:03:57] DIALOG_TEST --> inputtext: 2
[01:04:04] DIALOG_TEST2 --> inputtext: Empty
[01:04:04] DIALOG_TEST2 --> inputtext: 4
I take back my previous statement since you're using it in dialogs.


Re: K-RCON - Simple RCON system based on dialogs - SmileyForCheat - 04.04.2016

Code:
public OnFilterScriptInit()
{
	SendRconCommand("hostname Kevin's Server");
	SendRconCommand("language Any");
	SendRconCommand("mapname K-MAP");
	SetGameModeText("K-SERVER");
	print("\n--------------------------------");
	print("           K-RCON loaded.");
	print("      By Kevin Burke/KevinExec");
	print("---------------------------------\n");
	return 1;
}
why you do that? why you change the hostname, mapname, and language?


Re: K-RCON - Simple RCON system based on dialogs - SyS - 04.04.2016

Nice but you could add more features like sub rcons and restart server ....etc +rep