Any ideas about putting string end here? Can't compile - 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: Any ideas about putting string end here? Can't compile (
/showthread.php?tid=490729)
Any ideas about putting string end here? Can't compile -
Riwerry - 27.01.2014
TEXT is formatted inputtext
if (TEXT [_+1] == '\0') return SendClientMessage (playerid, -1, "Underscore is in end of the string!");
if (TEXT [_-1] == '\0') return SendClientMessage (playerid, -1, "Underscore is in begin of the string!");
Invalid expression assumed zero
Re: Any ideas about putting string end here? Can't compile -
Hansrutger - 27.01.2014
As far as my experience goes (not that long lol), you can't use strings in if-statements. Also not sure what you're trying to do there lol. :P
Re: Any ideas about putting string end here? Can't compile -
Riwerry - 27.01.2014
Well its dialog where is inputtext character name that means if he put undesrcore to first start of string or to end of string he will got returned im tryiing to do it but idk how
Becouse name is firstname_lastname
Re: Any ideas about putting string end here? Can't compile -
Vince - 27.01.2014
Simply use sscanf. It's not solely for commands;
pawn Код:
if(sscanf(text, "{p<_>s[20]s[20]}"))
{
// Invalid
}
Re: Any ideas about putting string end here? Can't compile -
Riwerry - 27.01.2014
Gonna to try it, but quite don't understand that code..

I was using time ago sscanf but just for parameters in commands.. Anyway thx..
//EDIT WONDERFUL thanx lol it works

Re: Any ideas about putting string end here? Can't compile -
Riwerry - 27.01.2014
hmm it works.. but how can I make, so it will check underscore not only begin and end of the string? Except one type which is Name_Lastname