22.11.2010, 07:56
(
Last edited by Rac3r; 22/11/2010 at 08:07 AM.
)
Firstly, happy birthday Grim :P
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.
Then, instead of a MAX_PLAYERS loop, just use:
Use your head, make a check OnPlayerDisconnect, if the chatting bot disconnects, set im_a_bot to -1.
Code:
if(IsPlayerConnected(playerid)==1 && GetPlayerColor(playerid) != 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 }
Code:
public SendBotMessage(msg[]) { if(im_a_bot != -1) { new pName[18]; format(pName,sizeof(pName),"%s",PlayerName(im_a_bot)); .....// and so on;