10.04.2016, 01:47
Yes. You can put that under OnPlayerText.
> Check whether the first character in the sentence is a dollar sign:
> If it is, then send the message to every connected player THAT is in the same clan:
And if you want to compare names and check if the tags are equal, then use strcmp():
> Check whether the first character in the sentence is a dollar sign:
PHP код:
if(text[0] == '$')
PHP код:
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i ++) // When you're not using foreach or y_iterate
PHP код:
foreach(new i : Player) // when you are using foreach or y_iterate
PHP код:
{
// This is inside the for-loop or inside foreach
if(pInfo[i][Clan] == pInfo[playerid][Clan]) { // Change these variables to the ones you have
// The player with ID equal to the current loop index is in the same clan as the player sending the message
SendClientMessage(i, -1, text[1]);
// You don't want to send the dollar sign along with the message, thus start sending the message from the second character. Array indexes start counting from 0 and not from 1!
return 0; // Cancel sending the message to global chat
}
}
PHP код:
if(strcmp(tag, targetname, false, strlen(tag)) == 0)