17.11.2013, 21:59
Hey guys I have this code:
This is dispatch chat for cops, but listen up what I want to make, how can I make if player will write the fallowing:
"-Suspect is in water" it will play sound id 2606
Or how can I make if player will write:
"-Suspect is driving in black "jeep" " it will play sound id 3028
So I would somehow detect what is player writing ... not full sentence maybe only 1 word, how can I script this?
pawn Код:
public OnPlayerText(playerid, text[])
{
if(text[0] == '-')
{
new string[100];
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string),"::.Dispatch.:: %s: %s", sendername,text[1]);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerCop(i))
{
SendClientMessage(i,0x0FFDD349,string);
}
}
return 0;
}
"-Suspect is in water" it will play sound id 2606
Or how can I make if player will write:
"-Suspect is driving in black "jeep" " it will play sound id 3028
So I would somehow detect what is player writing ... not full sentence maybe only 1 word, how can I script this?