is invalidname
#1

Hey guys i wanna ask you how to check is that player name exist in dialog system. Thanks
Reply
#2

use " if " statement to check input using strcmp()

Like:
Код:
if(strcmp(inputtext, "AnyName", true) == 0) //name matched
else //name not matched
Reply
#3

but if i want to check if this name/id not exist i get a message ****** what can you say about that?
My idea correct or not?
Quote:

if(sscanf(inputtext,"u",playeridd) == INVALID_PLAYER_ID))

new playeridd[MAX_PLAYER_NAME];
Reply
#4

still not working do that:
Quote:

new play[MAX_PLAYER_NAME];
new playID = StrFind(play);
if(sscanf(inputtext,"u",playID)) return ShowPlayerDialog(playerid,44,DIALOG_STYLE_INPUT,"b la bla
if(playID == INVALID_PLAYER_ID)

what to do?
Reply
#5

Let's give you an example command. You're not interpreting what ****** is actually meaning by this. When you use sscanf, you would only return something if they have got the syntax wrong or are missing a parameter.

For example:
pawn Код:
CMD:kick(playerid, params[]) //My command /kick to kick players
{
    new playersID; //This is what we use to save the ID of the player we want to kick
    if(sscanf(params, "u", playersID)) return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /kick [playerid]"); //Is returned because I did not add the 'playerid' part of the command
    if(playersID == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000FF, "Player is not connected."); //Is only returned if you have included all parameters
   //continues...
So your code would be something like:
pawn Код:
new play[MAX_PLAYER_NAME];
new playID;
if(sscanf(inputtext, "u", playID)) return SendClientMessage(playerid, 0xFF0000FF, "You must enter an id.");
if(playID == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000FF, "Player is not connected.");
//Code continues
Obviously, you don't have to return with SendClientMessage, you can use ShowPlayerDialog if that is what you're wanting to do.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)