Help - 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: Help (
/showthread.php?tid=199429)
Help -
keller012 - 15.12.2010
How do I block the use of more than 4 numbers per sentence??
Re: Help -
SkizzoTrick - 15.12.2010
You want a message like?"Only 4 characters"
or just put there only 4 letters ?
Re: Help -
keller012 - 15.12.2010
for example:
buy house for 12mil -> ok phrase
buy home for 12345mil -> phrase blocked
I thereby avoid disclosure of other server
Re: Help -
Benjo - 15.12.2010
pawn Код:
stock IsNumber(c[])
{
new bool:match;
switch(c[0]) {
case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': match = true;
default: match = false;
}
return match;
}
pawn Код:
public OnPlayerText(playerid, text[])
{
new count;
for(new i=0; i<strlen(text); i++) {
if(IsNumber(text[i])) {
count++;
}
}
if(count > 4) {
SendClientMessage(playerid, -1, "No more than 4 numbers allowed");
return 0;
}
return 1;
}
Try that. Don't know if it's the best way to do it, but it should work!
Re: Help -
keller012 - 15.12.2010
thanks man
works 100%