SA-MP Forums Archive
Using Inputtext > pID - 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: Using Inputtext > pID (/showthread.php?tid=658617)



Using Inputtext > pID - playstores - 08.09.2018

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;
}


Re: Using Inputtext > pID - sonn51280 - 08.09.2018

what ?


Re: Using Inputtext > pID - playstores - 08.09.2018

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


Re: Using Inputtext > pID - Dayrion - 08.09.2018

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


Re: Using Inputtext > pID - UFF - 08.09.2018

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).


Re: Using Inputtext > pID - playstores - 08.09.2018

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


Re: Using Inputtext > pID - UFF - 08.09.2018

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.


Re: Using Inputtext > pID - playstores - 08.09.2018

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


Re: Using Inputtext > pID - Calisthenics - 08.09.2018

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.


Re: Using Inputtext > pID - playstores - 08.09.2018

works perferctly with sccanf, thx mates,

sscanf never let me down :3

closed