14.04.2011, 11:51
Quote:
Well, I haven't noticed what you've done, but I done this :
Код:
new fuck[1][] = { "fuck" }; Код:
for(new f; f < sizeof(fuck); f++){ new string[256]; if(strfind(text, fuck[f], true) != -1) { new name[MAX_PLAYER_NAME]; new string[128]; GetPlayerName(playerid, name, sizeof(name)); format(string,sizeof(string), "%s: I'm gay", name); SendClientMessageToAll(GetPlayerColor(playerid), string); } } PHP код:
|
He wants it so when someone says 'fuck you' it'll turn into '**** you' - not remove the whole message.
strfind returns the position of the first character in the string that is found, it's basically the number of letters before the word you're searching for. So you can strfind 'fuck' then strdel the characters strfind to strfind+4 - that'll remove fuck. Then strins at the strfind position four *'s. Simples.