Command/text problems - 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: Command/text problems (
/showthread.php?tid=197337)
Command/text problems -
hanzen - 08.12.2010
Hello,
I'm making a function that will trigger when you type ! infront of the sentence. Example: !Hello my name is hanzen. Then it will send a clientmessage, but I really can't figure out how to solve this. Something that has to go under OnPlayerText or on OnPlayerCommandText, and how to do it?
Would appreciate answers
Regards Hanzen
Re: Command/text problems -
Mike_Peterson - 08.12.2010
I'm sure its OnPlayerText since ! isnt a command on sa-mp but this is a good question, i could make something when the question is solved. cause i have a cod4 server :P
there must be a way to detect !%s (!text)
not sure if it works but maybe you could first format a string with !%s,text); and then use strfind and use the string. like strfind(text,string,blah blah
Re: Command/text problems -
hanzen - 08.12.2010
Quote:
Originally Posted by Mike_Peterson
I'm sure its OnPlayerText since ! isnt a command on sa-mp but this is a good question, i could make something when the question is solved. cause i have a cod4 server :P
there must be a way to detect !%s (!text)
not sure if it works but maybe you could first format a string with !%s,text); and then use strfind and use the string. like strfind(text,string,blah blah
|
Yeah, code suggestions? Still pretty insecure.
Re: Command/text problems -
hanzen - 10.12.2010
I tried what you said, and it works in a way. But it also works if you type hello! I want to set it so the ! has to be at the start.
Re: Command/text problems -
Scenario - 10.12.2010
Try this:
pawn Код:
public OnPlayerText(playerid, text[])
{
if(text[0] == '!')
{
// do stuff here
}
return 1;
}