walkie talkie chat help
#1

so this is my Walkie Talkie command,/wt is like /sms but its a global chat for everyone that has a walkie talkie.But my problem is,when im alone the command works,i can speak on the wt chat,if its turned off i cant speak if i dont have one i cant speak,everthing works perfect,but if i am with a friend and he has his walkie talkie turned of,i can't write on the chat,is simply doesn't show my text,but if my friend has his walkie on everything work again




CMD:wt(playerid, params[])
{ new szText[128],string[128],string2[64];
if(PlayerInfo[playerid][pWalkie] == 0) return SendClientMessage(playerid, COLOR_GREY, "You need a walkie talkie to speak on the frequency");
if(PlayerInfo[playerid][pWalkieOn] == 0) return SendClientMessage(playerid, COLOR_GREY, "Your walkie talkie is turned off");
if(sscanf(params,"s[128]",szText)) return SendClientMessage(playerid, COLOR_RED, "USAGE:{FFFFFF}/wt <text>");
if(PlayerInfo[playerid][pMuted] == 1)
{
format(string2,sizeof(string2), "You are muted,you will be able to use the /wt chat in %d seconds", PlayerInfo[playerid][pMuteTime]);
SendClientMessage(playerid, COLOR_LIGHTRED, string2);
return 1;
}
foreach(Player,i)
{
if(PlayerInfo[i][pWalkieOn] == 0) return 1;
format(string,sizeof(string),"(Frequency) %s:%s", GetName(playerid),szText);
SendClientMessage(i, COLOR_ORANGE, string);
}
return 1;
}
Reply
#2

Код:
if(PlayerInfo[i][pWalkieOn] == 0) return 1;
Should become

Код:
if(PlayerInfo[i][pWalkieOn] == 0) continue;
Using return will break the loop as soon as someone doesn't have his Talkie Walkie ON, while continue will just skip and keep the loop going.
Reply
#3

ok so if someone doesn't have their walkie talkie on they won't see the messages written in the wt chat right?because that's what i am trying to do here
Reply
#4

Yup. But definitely the author will see, as when the loop is ran it should've checked his state too, so it will print the message for him & users having talkie walkie ON.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)