clan chating with the same tag - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: clan chating with the same tag (
/showthread.php?tid=604780)
removed -
StackedPizza - 10.04.2016
_removed_
Re: clan chating with the same tag -
AndySedeyn - 10.04.2016
Yes. You can put that under OnPlayerText.
> Check whether the first character in the sentence is a dollar sign:
PHP код:
if(text[0] == '$')
> If it is, then send the message to every connected player THAT is in the same clan:
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
}
}
And if you want to compare names and check if the tags are equal, then use strcmp():
PHP код:
if(strcmp(tag, targetname, false, strlen(tag)) == 0)