Looking for a Script for automatic reply.
#1

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?
Reply
#2

PHP код:
#define COLOR_WHITE 0xFFFFFFAA 
PHP код:
public OnPlayerText(playeridtext[])
{
    {
        new 
string[400], playername[MAX_PLAYER_NAME];
        
GetPlayerName(playeridplayernamesizeof(playername));
        
format(stringsizeof(string), "%s: %s"playernametext);
        
SendClientMessageToAll(-1string);
    }
    if(
strfind(text"How to be a police"true) != -1)
    {
        new 
string[400];
        new 
playername[MAX_PLAYER_NAME];
        
GetPlayerName(playeridplayernamesizeof(playername));
        
format(stringsizeof(string), "Hey, %s you can be a police by entering in a police vehicle and type /job. "GetPlayerNameEx(playerid));
        
SendClientMessage(playeridCOLOR_WHITEstring);
    }
    return 
0;
}

PHP код:
stock GetPlayerNameEx(playerid)
{
    new
        
sz_playerName[MAX_PLAYER_NAME],
        
i_pos;
    
GetPlayerName(playeridsz_playerNameMAX_PLAYER_NAME);
    while ((
i_pos strfind(sz_playerName"_"falsei_pos)) != -1sz_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.
Reply
#3

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.
Reply
#4

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);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)