Looking for a Script for automatic reply. -
alvin6 - 12.12.2017
Hi,
I am looking for script for auto reply to a question like when a player ask How to be a police? then in chatbox server reply automatic like Hey, (Playernamehere) you can start police job by entering in a police vehicle and type /job.
Just like that...
Can anyone help?
Re: Looking for a Script for automatic reply. -
solstice_ - 12.12.2017
PHP код:
#define COLOR_WHITE 0xFFFFFFAA
PHP код:
public OnPlayerText(playerid, text[])
{
{
new string[400], playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
format(string, sizeof(string), "%s: %s", playername, text);
SendClientMessageToAll(-1, string);
}
if(strfind(text, "How to be a police", true) != -1)
{
new string[400];
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
format(string, sizeof(string), "Hey, %s you can be a police by entering in a police vehicle and type /job. ", GetPlayerNameEx(playerid));
SendClientMessage(playerid, COLOR_WHITE, string);
}
return 0;
}
}
PHP код:
stock GetPlayerNameEx(playerid)
{
new
sz_playerName[MAX_PLAYER_NAME],
i_pos;
GetPlayerName(playerid, sz_playerName, MAX_PLAYER_NAME);
while ((i_pos = strfind(sz_playerName, "_", false, i_pos)) != -1) sz_playerName[i_pos] = ' ';
return sz_playerName;
}
Not sure if it will work it's not tested as i can't compile it right now, tell me if it works or not.
Re: Looking for a Script for automatic reply. -
Sithis - 12.12.2017
Sign up for an account at
http://wit.ai -> Create intent "police duty" using their system -> Send every OnPlayerText to Wit.ai -> Respond with police explanation when intent "police duty" is detected.
Re: Looking for a Script for automatic reply. -
jasperschellekens - 12.12.2017
use a timer or else it will send the answer before the player send his message.
Код:
//==============================================================================
public OnPlayerText(playerid,text[])
{
if(strfind(text, "Hello Chatman", true) != -1 || strfind(text, "Hey chatman", true) != -1 || strfind(text, "Hi chatman", true) != -1 ||
strfind(text, "Hey chatman", true) != -1 || strfind(text, "Hey, chatman", true) != -1|| strfind(text, "Hi, chatman", true) != -1 || strfind(text, "Hello, chatman", true) != -1)
{
Chatman(playerid, 1000);
}
return 1;
}
//==============================================================================
stock Chatman(playerid, time)
{
SetTimerEx("Chatman2", time, false, "i", playerid);
}
forward Chatman2(playerid);
public Chatman2(playerid)
{
new String[128];
format(String,sizeof(String),"{FFFFFF}{FF0000}Chatman(1337): {FFFFFF}Hello there, %s .",GetPlayerName(playerid));
SendClientMessageToAll(RED,String);
}