Using Dialogs to Get Player ID - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Using Dialogs to Get Player ID (
/showthread.php?tid=195554)
Using Dialogs to Get Player ID -
Jacob_Venturas - 03.12.2010
Hello. When I am using a DIALOG_STYLE_INPUT, I want to be able to use the inputtext to get a players name/ID. So, basically, when someone types /setdiv, it will say in a dialog, "Enter the Player's ID/Name" and when they enter it, the response checks to see if the ID they entered is connected/isn't a invalid ID. My problem with this is, it won't let me use inputtext to find the player's ID/name and store it in a variable. The codes give me array errors.
Here is my code:
pawn Код:
new giveplayerid[MAX_PLAYER_NAME];
strmid(giveplayerid, inputtext, 0, strlen(inputtext), 24);
giveplayerid = inputtext;
if(giveplayerid == INVALID_PLAYER_ID)
{
ShowPlayerDialog(playerid,7, DIALOG_STYLE_INPUT, "Set Division", "Invalid entry. Try again\nEnter the name of the player or the ID:","Move On", "Cancel");
return 1;
}
if(!IsPlayerConnected(giveplayerid))
{
ShowPlayerDialog(playerid,7, DIALOG_STYLE_INPUT, "Set Division", "Cop is not connected. Try again\nEnter the name of the player or the ID:","Move On", "Cancel");
return 1;
}
if(PlayerInfo[giveplayerid][pMember] != 1)
{
ShowPlayerDialog(playerid,7, DIALOG_STYLE_INPUT, "Set Division", "That player is not in your faction. Try again.\nEnter the name of the player or the ID:","Move On", "Cancel");
return 1;
}
giveplayerid = SelectDivisionID;
Re: Using Dialogs to Get Player ID -
Jochemd - 05.12.2010
Use strval and not strmid xxxD Also doesnt have to be string.
pawn Код:
new giveplayerid = strval(inputtext);
if(giveplayerid == INVALID_PLAYER_ID)
{
ShowPlayerDialog(playerid,7, DIALOG_STYLE_INPUT, "Set Division", "Invalid entry. Try again\nEnter the name of the player or the ID:","Move On", "Cancel");
return 1;
}
if(!IsPlayerConnected(giveplayerid))
{
ShowPlayerDialog(playerid,7, DIALOG_STYLE_INPUT, "Set Division", "Cop is not connected. Try again\nEnter the name of the player or the ID:","Move On", "Cancel");
return 1;
}
if(PlayerInfo[giveplayerid][pMember] != 1)
{
ShowPlayerDialog(playerid,7, DIALOG_STYLE_INPUT, "Set Division", "That player is not in your faction. Try again.\nEnter the name of the player or the ID:","Move On", "Cancel");
return 1;
}