w00t ? - 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: w00t ? (
/showthread.php?tid=90175)
w00t ? -
UsaBoy91 - 06.08.2009
I've tryed to make an "anti-repeat-myself" , but i fail ...
I don't like to use strfind , so i decied to use strcmp ...
# How this proceed:
If i type : hello ( then i press enter )
And after a second i type again , hello
He must send me that message : * Don't repeat yourself !
But he send me that message at the first hello ...
Code Here:
http://pastebin.com/d23d09b60
Re: w00t ? -
kaisersouse - 06.08.2009
strmid and a player array like lastchat[playerid]
compare lastchat[playerid] with text in OnPlayerText
Re: w00t ? -
UsaBoy91 - 06.08.2009
so i can't use strcmp in a command ?
Re: w00t ? -
UsaBoy91 - 06.08.2009
bump
Re: w00t ? -
kaisersouse - 06.08.2009
bumping is the best way to make a topic disappear
I told you one method of doing it already. If anyone has more input, they'll post.
Re: w00t ? -
UsaBoy91 - 06.08.2009
oh sorry , but i didn't understand you
Could you like to make / post an example ?
Thanks
Re: w00t ? -
UsaBoy91 - 06.08.2009
okey , i've tryed , but now i don't recive the antispam message
http://pastebin.com/m49bbc559
Re: w00t ? -
JaTochNietDan - 06.08.2009
This is what I would do, I made a simple function to set a string so that you don't need to use string = string;, which will give you trouble if the target string is a different size.
pawn Код:
stock strset(source[],destination[])
{
for(new i; i < strlen(source); i++)
{
destination[i] = source[i];
}
}
Now this is what I would do for an anti-repeat in OnPlayerText:
pawn Код:
new LastSentance[MAX_PLAYERS][128]; //At top of script
public OnPlayerText(playerid,text[])
{
if(strcmp(LastSentance[playerid],text,true) == 0)
{
SendClientMessage(playerid,red,"Please don't repeat yourself!");
return 0;
}
strset(text,LastSentance[playerid]);
return 1;
}
Re: w00t ? -
UsaBoy91 - 07.08.2009
oh , i don't want a antirepeatmyself in OnPlayerText
I want it in that command
Re: w00t ? -
kc - 07.08.2009
Quote:
Originally Posted by MJφ
oh , i don't want a antirepeatmyself in OnPlayerText
I want it in that command 
|
Well its the same thing, just move it to a command..
Quote:
Originally Posted by JaTochNietDan
This is what I would do, I made a simple function to set a string so that you don't need to use string = string;, which will give you trouble if the target string is a different size.
pawn Код:
stock strset(source[],destination[]) { for(new i; i < strlen(source); i++) { destination[i] = source[i]; } }
|
Why not use format?