Help With IsNumeric
#1

pawn Код:
new nPlayer;
    if(!sscanf(params,"u",nPlayer))
pawn Код:
if(isNumeric(params)) format(string, sizeof(string), "%d Is Not A Valid ID.", nPlayer);
                if(!isNumeric(params)) format(string,sizeof(string),"%s Is Not An Valid Name.",nPlayer);
if we type any name and that player is offline it will say an symbol "y" is not an valid name so is there any other way to do it
Reply
#2

waht do u want to do exactly check if player in online or check if user has entered a valid id?
Reply
#3

i want to check that if an player types an invalid id it will say that %d is not an valid id %d[any id]
and if it types any text and that is not an valid player name %s is not an valid name %s[any text he typed]
Reply
#4

Add this under your if(sscanf(...))
pawn Код:
else if(nPlayer == INVALID_PLAYER_ID) return SendClientMessage(/*your code*/);
if you really want to show which ID the player has entered use this:

pawn Код:
else if(nPlayer == INVALID_PLAYER_ID)
{
    format(string, sizeof(string), "%d is not a valid ID", nPlayer);
    SendClientMessage(playerid, /*COLOR here*/, string);
}
EDIT:

To optimize your code use sscanf like this:
pawn Код:
if(sscanf(params, "u", nPlayer)) return SendClientMessage(playerid, /*COLOR HERE*/, "[USAGE] /COMMAND [playerid/PartOfName]");
You don't have to, it's a tip
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)