chatbot help
#17

Firstly, happy birthday Grim :P

Code:
if(IsPlayerConnected(playerid)==1 && GetPlayerColor(playerid) != 0)
As explained by SA-MP, if a player doesn't have his colour changed by the script (SetPlayerColor), the players colour will be 0.

Just use a integer, when the player connects check if it's a bot (strcmp it's name), then set the integer (im_a_bot)to the playerid.
Code:
new im_a_bot = -1;
Code:
public OnPlayerConnect(playerid)
{
    if(strcmp("Rac3r(Bot)", PlayerName(playerid), true)==0)im_a_bot = playerid;
    return 1; // end of code, obviously
}
Then, instead of a MAX_PLAYERS loop, just use:
Code:
public SendBotMessage(msg[])
{    
    if(im_a_bot != -1)
    {
         new pName[18];            
         format(pName,sizeof(pName),"%s",PlayerName(im_a_bot));
         .....// and so on;
Use your head, make a check OnPlayerDisconnect, if the chatting bot disconnects, set im_a_bot to -1.
Reply


Messages In This Thread
chatbot help - by Lookin - 16.11.2010, 12:27
Re: chatbot help - by Blt950 - 16.11.2010, 20:33
Re: chatbot help - by Lookin - 16.11.2010, 21:16
Re: chatbot help - by Lookin - 21.11.2010, 05:55
Re: chatbot help - by Grim_ - 21.11.2010, 06:03
Re: chatbot help - by Lookin - 21.11.2010, 06:08
Re: chatbot help - by Grim_ - 21.11.2010, 06:11
Re: chatbot help - by Lookin - 21.11.2010, 06:14
Re: chatbot help - by Grim_ - 21.11.2010, 06:15
Re: chatbot help - by Lookin - 21.11.2010, 06:17
Re: chatbot help - by Grim_ - 21.11.2010, 06:26
Re: chatbot help - by Lookin - 21.11.2010, 06:33
Re: chatbot help - by Grim_ - 21.11.2010, 06:39
Re: chatbot help - by Lookin - 21.11.2010, 06:52
Re: chatbot help - by Lookin - 22.11.2010, 02:46
Re: chatbot help - by seifo - 22.11.2010, 07:10
Re: chatbot help - by Rac3r - 22.11.2010, 07:56

Forum Jump:


Users browsing this thread: 1 Guest(s)