Chat is mixed with another - 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: Chat is mixed with another (
/showthread.php?tid=615316)
Chat is mixed with another -
ThatFag - 20.08.2016
hey there
i was trying to create a private chat for players that are in table
but if there are 1+ tables created the chat goes mixed for both
can you help me out please
Код:
COMMAND:tt(playerid, params[])
{
if(GetPVarInt(playerid,"ontable") == 1)
{
new iText[ 128 ];
if(sscanf(params, "s", iText)) return SCP(playerid, "[msg]");
PlayerLoop(i)
{
format(iStr, sizeof(iStr),"(( [TABLE] %s: %s ))", RPName(playerid), iText);
SendClientMessage(i, 0x216B98FF, iStr);
}
}
return SendClientMessage(playerid, -1 , "You are not in any table");
}
Re: Chat is mixed with another -
Shinja - 20.08.2016
When you create tables you must assign to each table a different number, from your script i see that you just assign "1" to all tables, well the tt cmd must be like that
PHP код:
COMMAND:tt(playerid, params[])
{
if(GetPVarInt(playerid,"ontable") == 0) return SendClientMessage(playerid, -1 , "You are not in any table");
new iText[ 128 ];
if(sscanf(params, "s", iText)) return SCP(playerid, "[msg]");
format(iStr, sizeof(iStr),"(( [TABLE] %s: %s ))", RPName(playerid), iText);
for(new i, j=GetPlayerPoolSize(); i<j; i++)
{
if(GetPVarInt(i,"ontable") == GetPVarInt(playerid,"ontable"))
{
SendClientMessage(i, 0x216B98FF, iStr);
}
}
}
and if you don't know how to do the rest post creating tables code