Using Inputtext > pID
#1

How to use inputtext as pID?

Like that

if(dialogid == DIALOG_MDCCHECK)
{

new mdccheck[128];
new pid = strval(inputtext); // that doesnt / wouldnt work
format(mdccheck,sizeof(mdccheck),"Name:%s\nWanted: %d\nWanted Reason:%s",inputtext[pid],PlayerInfo[pid][pWanted],PlayerInfo[pid][pWantedReason]);
ShowPlayerDialog(playerid,105,DIALOG_STYLE_MSGBOX, "Data",mdccheck,"Exit","");
return 1;
}
Reply
#2

what ?
Reply
#3

Quote:
Originally Posted by sonn51280
Посмотреть сообщение
what ?
The code explains everything
Reply
#4

What doesn't works? You need to give more details and stuff like that instead of just "that doesn't works"
Reply
#5

What you are doing?
Inputtext is text which you put in the input dialog.



Код:
if(dialogid == DIALOG_MDCCHECK)
{
new mdccheck[128];
new Playername[24];
new pid = strval(inputtext); 
if(pid == INVALID_PLAYER_ID)
		return SendClientMessage(playerid, -1, "Player not connected!");
GetPlayerName(pid, Playername, sizeof(Playername));
format(mdccheck,sizeof(mdccheck),"Name:%s\nWanted: %d\nWanted Reason:%s", Playername ,PlayerInfo[pid][pWanted],PlayerInfo[pid][pWantedReason]);
ShowPlayerDialog(playerid,105,DIALOG_STYLE_MSGBOX, "Data" ,mdccheck,"Exit","");
return 1;
}
This code will check the wanted of online players using their id(playerid). You can use playerid instead of player name in input dialog(which executes DIALOG_MDCCHECK).
Reply
#6

Quote:
Originally Posted by UFF
Посмотреть сообщение
What you are doing?
Inputtext is text which you put in the input dialog.



Код:
if(dialogid == DIALOG_MDCCHECK)
{
new mdccheck[128];
new Playername[24];
new pid = strval(inputtext); 
if(pid == INVALID_PLAYER_ID)
		return SendClientMessage(playerid, -1, "Player not connected!");
GetPlayerName(pid, Playername, sizeof(Playername));
format(mdccheck,sizeof(mdccheck),"Name:%s\nWanted: %d\nWanted Reason:%s", Playername ,PlayerInfo[pid][pWanted],PlayerInfo[pid][pWantedReason]);
ShowPlayerDialog(playerid,105,DIALOG_STYLE_MSGBOX, "Data" ,mdccheck,"Exit","");
return 1;
}
This code will check the wanted of online players using their id(playerid). You can use playerid instead of player name in input dialog(which executes DIALOG_MDCCHECK).

Your code isnt working too, I just get the Name of the playerid
Reply
#7

Quote:
Originally Posted by playstores
Посмотреть сообщение
Your code isnt working too, I just get the Name of the playerid
Well, can you explain what doesn't work? or provide the screenshot of the dialog 'DIALOG_MDCCHECK'(which shows the informations) of ingame.
Reply
#8

Quote:
Originally Posted by ******
Посмотреть сообщение
`strval` will work, but the better solution is to use `sscanf` so you can enter names and partial matches too.
Hm, yeah but how to use it in a Dialog, I am only using it by normal command xd
Reply
#9

Quote:
Originally Posted by playstores
Посмотреть сообщение
Hm, yeah but how to use it in a Dialog, I am only using it by normal command xd
There is no big difference. params will become inputtext and the rest are the same.
Reply
#10

works perferctly with sccanf, thx mates,

sscanf never let me down :3

closed
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)