Table Problem -
ThatFag - 23.08.2016
hej i made a system where players can talk to each other in a table
the problem is now that chat doesnt show for players that are in table
even to the hoster
codes
Код:
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);}}
return 1;
}
COMMAND:jointt(playerid, params[])
{
new iPlayer;
if(sscanf (params, "d",iPlayer)) return SCP(playerid, "[playerid]");
if(GetPVarInt(iPlayer,"hosting") == 1) { SetPVarInt(playerid, "ontable", GetPVarInt(iPlayer,"ontable")); }
return 1;
}
Re: Table Problem -
Shinja - 23.08.2016
Change
PHP код:
for(new i, j=GetPlayerPoolSize(); i<j; i++){if(GetPVarInt(i,"ontable") == GetPVarInt(playerid,"ontable")) {SendClientMessage(i, 0x216B98FF, iStr);}}
to
PHP код:
for(new i, j=GetPlayerPoolSize(); i<=j; i++){if(GetPVarInt(i,"ontable") == GetPVarInt(playerid,"ontable")) {SendClientMessage(i, 0x216B98FF, iStr);}}
You was alone when you tested it in the server?
Re: Table Problem -
ThatFag - 23.08.2016
Thanks worked
Textdraw shows only 1 name
the first one
Код:
for(new i; i < MAX_PLAYERS; i++)
{
new tmpid = IsPlayerInBiz(playerid), tmpf[80];
format(tmpf, sizeof(tmpf), "%s.txt", biz[tmpid][bizname]);
if(!IsPlayerConnected(i)) continue;
if(!IsPlayerInRangeOfPoint(i, 20.0, rPos[0], rPos[1], rPos[2])) continue;
if(PlayerInfo[i][playerteam] != PlayerInfo[playerid][playerteam]) continue;
new cashrobbing = dini_Int(tmpf,"bizcash")/ 5;
SetPVarInt(playerid, "robbingtime", GetPVarInt(playerid, "robbingtime") + 1 );
new tst[500];
format(tst,sizeof(tst),"Robbers:~n~%s~n~%s",tst,RPName(i));
TextDrawSetString(robbTDD1[playerid],tst);
TextDrawShowForPlayer(i,robbTDD1[playerid]);
}
Re: Table Problem -
Shinja - 23.08.2016
Try this
PHP код:
for(new i; i < MAX_PLAYERS; i++)
{
new tmpid = IsPlayerInBiz(playerid), tmpf[80];
format(tmpf, sizeof(tmpf), "%s.txt", biz[tmpid][bizname]);
if(!IsPlayerConnected(i)) continue;
if(!IsPlayerInRangeOfPoint(i, 20.0, rPos[0], rPos[1], rPos[2])) continue;
if(PlayerInfo[i][playerteam] != PlayerInfo[playerid][playerteam]) continue;
new cashrobbing = dini_Int(tmpf,"bizcash")/ 5;
SetPVarInt(i, "robbingtime", GetPVarInt(i, "robbingtime") + 1 );
new tst[500];
format(tst,sizeof(tst),"Robbers:~n~%s~n~%s",tst,RPName(i));
TextDrawSetString(robbTDD1[i],tst);
TextDrawShowForPlayer(i,robbTDD1[i]);
}
Re: Table Problem -
ThatFag - 24.08.2016
tried
doesnt work still shows only 1 name on it
Re: Table Problem -
Shinja - 24.08.2016
PHP код:
new tst[500], ts[100];
format(tst, 500, "Robbers:~n~");
for(new i; i < MAX_PLAYERS; i++)
{
new tmpid = IsPlayerInBiz(playerid), tmpf[80];
format(tmpf, sizeof(tmpf), "%s.txt", biz[tmpid][bizname]);
if(!IsPlayerConnected(i)) continue;
if(!IsPlayerInRangeOfPoint(i, 20.0, rPos[0], rPos[1], rPos[2])) continue;
if(PlayerInfo[i][playerteam] != PlayerInfo[playerid][playerteam]) continue;
new cashrobbing = dini_Int(tmpf,"bizcash")/ 5;
SetPVarInt(i, "robbingtime", GetPVarInt(i, "robbingtime") + 1 );
format(ts, 100, "%s~n~", RPName(i));
strcat(tst, ts);
}
TextDrawSetString(robbTDD1[i],tst);
TextDrawShowForPlayer(i,robbTDD1[i]);