SA-MP Forums Archive
[Help]SendRconCommand - 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: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [Help]SendRconCommand (/showthread.php?tid=489628)



[Help]SendRconCommand - cr33d - 23.01.2014

So, my problem is, i want to mek admin changde for examle hostname (name of server). I want to do it trough dialog. Can i change hostname with the text tiped in dialog. For example i have made:

Код:
if(dialogid == DIALOG_RCON)
	{
		if(!response) return 1;
		switch(listitem)
		{
			case 0:
			{
				SPD(playerid,DIALOG_HOST, DIALOG_STYLE_INPUT, ""BELA"Panel", "Change Hostname\nType new name!\n", "Enter", "Exit");
			}
bla bla bla
And ofc DIALOG_HOST where the inputtext should be new name of server:
Код:
if(dialogid == DIALOG_HOST)
	{
	    new host,string[256];
	    host = strval(inputtext);
	    SendRconCommand("hostname inputtext"); //He always change to text typed here (inputtext) but i want to know can i make it change to name typed in dialog (Inputtext host) :)
	    format(string,sizeof(string),""ZUTA"Admin %s has changed hostname to %d",GetName(playerid),host);
		SendClientMessageToAll(-1,string);
	}
Thanks


Re: [Help]SendRconCommand - FailerZ - 23.01.2014

{wrong}
Sorry ^


Re: [Help]SendRconCommand - EmilLykke - 23.01.2014

Not to sound rude or anything... But what did you change to the code? :3


Re: [Help]SendRconCommand - FailerZ - 23.01.2014

Quote:
Originally Posted by EmilLykke
Посмотреть сообщение
Not to sound rude or anything... But what did you change to the code? :3
this
pawn Код:
SendRconCommand("hostname inputtext");//He always change to text typed here (inputtext) but i want to know can i make it change to name typed in dialog (Inputtext host) :)
to this
pawn Код:
SendRconCommand("hostname "inputtext"");
as he said in his comment it always print inputtext but he want it to change to what player types


Re: [Help]SendRconCommand - cr33d - 23.01.2014

errors:
error 001: expected token: "-string end-", but found "-identifier-"
warning 215: expression has no effect
error 001: expected token: ";", but found "-string-"
warning 215: expression has no effect
error 001: expected token: ";", but found ")"
fatal error 107: too many error messages on one line


Re: [Help]SendRconCommand - FailerZ - 23.01.2014

nvm.


Re: [Help]SendRconCommand - Scottas - 23.01.2014

pawn Код:
if(dialogid == DIALOG_HOST)
    {
        new host,string[256];
        host = strval(inputtext);
            format(string, sizeof string, "hostname %s", inputtext);
        SendRconCommand(string);
        format(string,sizeof(string),""ZUTA"Admin %s has changed hostname to %d",GetName(playerid),host);
        SendClientMessageToAll(-1,string);
    }
You have to format string if you want to add variable value to it. Also you need to check which button is clicked.


Re: [Help]SendRconCommand - FailerZ - 23.01.2014

Quote:
Originally Posted by Scottas
Посмотреть сообщение
pawn Код:
if(dialogid == DIALOG_HOST)
    {
        new host,string[256];
        host = strval(inputtext);
            format(string, sizeof string, "hostname %s", inputtext);
        SendRconCommand(string);
        format(string,sizeof(string),""ZUTA"Admin %s has changed hostname to %d",GetName(playerid),host);
        SendClientMessageToAll(-1,string);
    }
You have to format string if you want to add variable value to it. Also you need to check which button is clicked.
Oh my bad, Yes this will work.
I really forget how to do it but i tried to help :/
Sorry cr33d


Re: [Help]SendRconCommand - cr33d - 23.01.2014

Yes, this is working, help you veru much +1rep, i am so stupid and forgot on this. This is similiar to updating the textdraws on which i have working yesterday but i couldn match those two. Thank you very much again