[Help]SendRconCommand
#1

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
Reply
#2

{wrong}
Sorry ^
Reply
#3

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

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
Reply
#5

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
Reply
#6

nvm.
Reply
#7

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.
Reply
#8

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
Reply
#9

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)