When i type "LOL" "WTF" "LMAO" in IC chat... -
ChristianIvann09 - 14.03.2014
help me. how to script this?
When i type "LOL" "WTF" "LMAO" in IC chat...
and if you hit enter this what will shown
PLAYERNAME laughs out loud ..
something like that..
thanks in advance
Re: When i type "LOL" "WTF" "LMAO" in IC chat... -
MP2 - 14.03.2014
strfind
Re: When i type "LOL" "WTF" "LMAO" in IC chat... -
ChristianIvann09 - 14.03.2014
Quote:
Originally Posted by MP2
strfind
|
What
? o_O
Re: When i type "LOL" "WTF" "LMAO" in IC chat... -
Matess - 14.03.2014
under OnPlayerText
pawn Код:
if (!strcmp("LOL",text,true,3) return SendClientMessage
Re: When i type "LOL" "WTF" "LMAO" in IC chat... -
Ceathor - 14.03.2014
You need to use a custom (non-native) function to replace "LOL" with "Laughing out loud", which can be achieved using the following functions:
pawn Код:
native Strfind(const string[],const sub[],bool:ignorecase=false,pos=0);
Strfind will find a string within another string. (Search for "LOL" here)
pawn Код:
native Strdel(string[], start, end);
Strdel will delete part of your string. (Delete "LOL" here)
pawn Код:
native Strins(string[],const substr[],pos,maxlength=sizeof string);
Strins will insert a new string into your string. (Insert "Laughing out loud" here)
Re: When i type "LOL" "WTF" "LMAO" in IC chat... -
Bingo - 14.03.2014
Put this under:-
Код:
public OnPlayerText(playerid, Text [])
Код:
if(strfind(text, "hacker", true) != -1 || strfind(text, "cheat", true) != -1) {
SendClientMessage(playerid,red, "SERVER: Please use /ask to contact admin or use /report [ID] [REASON] to report!");
return 0;
}
Change "Hacker" to "lol"
&
"SERVER: Please use /ask to contact admin or use /report [ID] [REASON] to report!" ---> To your Message.
Re: When i type "LOL" "WTF" "LMAO" in IC chat... -
Ruben_Alonso - 14.03.2014
Firt you need to know how strfind/strcomp works, let's say:
pawn Код:
if(!strcmp(text,"lol")) // comparing if the string (text) is equal to "lol"
if(strfind(text,"lol") != -1) // finding on the string (text) if there is any "lol"
Now you have to know why you want to use it.
If you want the whole string (
text) to be "lol"
You use under:
pawn Код:
public OnPlayerText(playerid, text[]) // the function you will use to detect the chat
{
new name[24], string[128]; // defining the variables and their size
GetPlayerName(playerid, name, 24); // storing the player name in the variable "name"
if(!strcmp(text,"lol")){
format(string, sizeof(string), "*%s laughs out loud.", name), // formating "string"
SendLocalMessage(playerid, string); // then this will be the function you have to send to a local chat
}
And if you want to check if there is a "lol" inside the string input, no matter if they wrote anything else you use under the same circumstances:
pawn Код:
if(strfind(text,"lol") != -1)
Re: When i type "LOL" "WTF" "LMAO" in IC chat... -
ChristianIvann09 - 14.03.2014
Quote:
Originally Posted by [vTc]Patroool
Put this under:-
Код:
public OnPlayerText(playerid, Text [])
Код:
if(strfind(text, "hacker", true) != -1 || strfind(text, "cheat", true) != -1) {
SendClientMessage(playerid,red, "SERVER: Please use /ask to contact admin or use /report [ID] [REASON] to report!");
return 0;
}
Change "Hacker" to "lol"
&
"SERVER: Please use /ask to contact admin or use /report [ID] [REASON] to report!" ---> To your Message.
|
thanks for this but..
I mean if you type "LOL" "LMAO" etc on IC chat (In Character Chat) most used on roleplay
it will automatically /me Laughs out Loud
for example: i type LOL and i hit enter. then this message will be shown
** PLAYERNAME laughs out loud **
Here is my /me script
Код:
* ChristianIvann09 script
CMD:me(playerid, params[])
{
if(CheckGMX(playerid)) return 1;
if(isnull(params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /me [action]");
new string[128];
format(string, sizeof(string), "* %s %s", GetPlayerNameEx(playerid), params);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
Re: When i type "LOL" "WTF" "LMAO" in IC chat... -
ChristianIvann09 - 14.03.2014
Anyone who can send the code ?
Re: When i type "LOL" "WTF" "LMAO" in IC chat... -
Ruben_Alonso - 14.03.2014
Quote:
Originally Posted by ChristianIvann09
Anyone who can send the code ?
|
I just made a post explaining and doing like 98% of the code you need to use and you say that? I really got to stop making an effort...