01.02.2010, 10:55
Hey! I'm tired of when ever i write in my radio it sends the message twice because of the proxdetector and "sendfactionmessage"
Anybody who could help me with changin' the proxdetector so it sends a "SendClientMessage" that would fix the double message for the guy who types the message.
Or is there any other solution? Because right now it looks like this everytime i type in the radio.
The faction message -
[Radio] Chief Patrick: Hi
// And then the proxdetector -
[Radio] Chief Patrick: Hi
i want people around him to be able to see it, thats why i use the proxdetector but can i do so it doesn't send the proxdetector to the guy who typed it?
Anybody who could help me with changin' the proxdetector so it sends a "SendClientMessage" that would fix the double message for the guy who types the message.
Or is there any other solution? Because right now it looks like this everytime i type in the radio.
The faction message -
[Radio] Chief Patrick: Hi
// And then the proxdetector -
[Radio] Chief Patrick: Hi
i want people around him to be able to see it, thats why i use the proxdetector but can i do so it doesn't send the proxdetector to the guy who typed it?
pawn Код:
if(strcmp(cmd, "/radio", true) == 0 || strcmp(cmd, "/r", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new wstring[128];
new faction = PlayerInfo[playerid][pFaction];
new rank = PlayerInfo[playerid][pRank];
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_WHITE, "[Usage] (/r)adio");
return 1;
}
if(Muted[playerid])
{
SendClientMessage(playerid, COLOR_GREY, "[Error] You can not use the radio, You are muted");
return 1;
}
if(PlayerInfo[playerid][pFaction] == 5)
{
if(rank == 1)
{
format(wstring, sizeof(wstring), "[Radio] %s %s: %s, over",DynamicFactions[faction][fRank1],GetPlayerNameEx(playerid),result);
FactionChatLog(wstring);
}
else if(rank == 2)
{
format(wstring, sizeof(wstring), "[Radio] %s %s: %s, over",DynamicFactions[faction][fRank2],GetPlayerNameEx(playerid),result);
FactionChatLog(wstring);
}
else if(rank == 3)
{
format(wstring, sizeof(wstring), "[Radio] %s %s: %s, over",DynamicFactions[faction][fRank3],GetPlayerNameEx(playerid),result);
FactionChatLog(wstring);
}
else if(rank == 4)
{
format(wstring, sizeof(wstring), "[Radio] %s %s: %s, over",DynamicFactions[faction][fRank4],GetPlayerNameEx(playerid),result);
FactionChatLog(wstring);
}
else if(rank == 5)
{
format(wstring, sizeof(wstring), "[Radio] %s %s: %s, over",DynamicFactions[faction][fRank5],GetPlayerNameEx(playerid),result);
FactionChatLog(wstring);
}
else if(rank == 6)
{
format(wstring, sizeof(wstring), "[Radio] %s %s: %s, over",DynamicFactions[faction][fRank6],GetPlayerNameEx(playerid),result);
FactionChatLog(wstring);
}
else if(rank == 7)
{
format(wstring, sizeof(wstring), "[Radio] %s %s: %s, over",DynamicFactions[faction][fRank7],GetPlayerNameEx(playerid),result);
FactionChatLog(wstring);
}
else if(rank == 8)
{
format(wstring, sizeof(wstring), "[Radio] %s %s: %s, over",DynamicFactions[faction][fRank8],GetPlayerNameEx(playerid),result);
FactionChatLog(wstring);
}
else if(rank == 9)
{
format(wstring, sizeof(wstring), "[Radio] %s %s: %s, over",DynamicFactions[faction][fRank9],GetPlayerNameEx(playerid),result);
FactionChatLog(wstring);
}
else if(rank == 10)
{
format(wstring, sizeof(wstring), "[Radio] %s %s: %s, over",DynamicFactions[faction][fRank10],GetPlayerNameEx(playerid),result);
FactionChatLog(wstring);
}
SendFactionMessage(10, COLOR_LSPD, wstring);
format(wstring, sizeof(wstring), "[Radio] %s: %s", GetPlayerNameEx(playerid), result);
ProxDetector(15.0, playerid, wstring,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "[Error] Invalid faction");
}
}
return 1;
}