strval(inputtext) Leaves no message
#1

I have a problem with the /kick command where the message from ( strval(inputtext) ) wont show.

Here is the code to open the dialog:
Код:
ShowPlayerDialog(playerid, 005, DIALOG_STYLE_INPUT, "Kick", "Please enter the reason.", "Kick", "Cancel");
And here is the dialog code:
Код:
	if(dialogid == 005)
	{
	    if(!response) {
	    }
	    else {
		new vname[MAX_PLAYER_NAME];
		new vname2[MAX_PLAYERS];
		new pname[MAX_PLAYER_NAME];
		new string[256];
		GetPlayerName(inputid[playerid], vname, sizeof(vname));
		format(vname2[playerid], 128, "%s", vname);
		if(victim[playerid] == vname2[playerid]) {
		GetPlayerName(playerid, pname, sizeof(pname));
		format(string,sizeof(string),"[PN-Admin] Player %s [%d] was kicked by admin %s.",victim[playerid], inputid[playerid], pname);
		SendClientMessageToAll(red, string);
		format(string,sizeof(string),"[PN-Admin] Reason: %s.",strval(inputtext));
		SendClientMessageToAll(red, string);
		//Kick(inputid[playerid]);
                victim[playerid] = -1;
		inputid[playerid] = -1;
		vname2[playerid] = -1;
		}
		else {
		format(string,sizeof(string),"[PN-Admin] Player %s [%d] has disconnected.",victim[playerid], inputid[playerid]);
		SendClientMessage(playerid, orange, string);
		inputid[playerid] = -1;
		victim[playerid] = -1;
		vname2[playerid] = -1;
		}
	    }
	}
The message thats going to show the ( strval(inputtext) ) is this:
Код:
format(string,sizeof(string),"[PN-Admin] Reason: %s.",strval(inputtext));
SendClientMessageToAll(red, string);
Please help me solve the problem.

Thanks.
Reply
#2

Код:
format(string,sizeof(string),"[PN-Admin] Reason: %d.",strval(inputtext));
This forum requires that you wait 120 seconds between posts. Please try again in 20 seconds.
Reply
#3

Quote:
Originally Posted by Grim_
Посмотреть сообщение
Код:
format(string,sizeof(string),"[PN-Admin] Reason: %d.",strval(inputtext));
This leaves only the number 0 as a reason. It's supposed that the kick reason admin made in the dialog will show.
Reply
#4

You have the wrong function then, strval turns the string into an integer.

Simply do:
Код:
format(string,sizeof(string),"[PN-Admin] Reason: %s.",inputtext);
Reply
#5

Problem solved, thanks Grim!
Reply
#6

If reason is not a number why do you strval it?

Edit: ah too late, damn new forum
Reply
#7

Quote:
Originally Posted by Grim_
Посмотреть сообщение
You have the wrong function then, strval turns the string into an integer.

Simply do:
Код:
format(string,sizeof(string),"[PN-Admin] Reason: %s.",inputtext);
I were just about to tell.
-If you have a string, you dont have to do anything with it, when you want to show it with %s
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)