how to allow only character and number in string - 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: how to allow only character and number in string (
/showthread.php?tid=659113)
how to allow only character and number in string -
3417512908 - 24.09.2018
hi i want to let player type a hex color.
just like FF0000 (yellow).but if player type "F$0000", ":" will make colors bug
how to limit only 26 english characters and number in string?limit player type special character
Re: how to allow only character and number in string -
Logic_ - 24.09.2018
Regular Expressions maybe?
Re: how to allow only character and number in string -
3417512908 - 24.09.2018
Quote:
Originally Posted by Logic_
Regular Expressions maybe?
|
good idea.but i don't want to install plugin.have others way?some simple pawn code to do it...
Re: how to allow only character and number in string -
Calisthenics - 24.09.2018
Limit text to 6 characters long (RRGGBB) and check if it is a hex number:
pawn Код:
// example:
new colour;
if (strlen(inputtext) == 6 && !sscanf(inputtext, "x", colour))
{
// your code
}
Re: how to allow only character and number in string -
3417512908 - 24.09.2018
Quote:
Originally Posted by ******
sscanf "x"
|
Quote:
Originally Posted by Calisthenics
Limit text to 6 characters long (RRGGBB) and check if it is a hex number
|
NICE!!!I DONE!!!THANK A LOT!!!
Код:
if(sscanf(playercolor, "{x}")) return Warning(playerid,"please type a color code");
Re: how to allow only character and number in string -
3417512908 - 24.09.2018
Quote:
Originally Posted by ******
So you didn't notice all the responses after you saying you didn't want to use a plugin were to use a plugin?
|
hmm...nobody will install a complexity plugin for a simple function and use ram of idle(just talk from my script).but sscanf service too many functions.sscanf no only solve this problem