11.07.2012, 16:45
pawn Код:
stock GetPlayerShortName(playerid)
{
new playerName[MAX_PLAYER_NAME], findString;
GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
findString = strfind(playerName, "_", true);
if(findString != 0)
{
strdel(playerName, 1, findString+1);
strins(playerName, ". ", 1);
}
return playerName;
}
if(strcmp(cmd, "/radio", true) == 0 || strcmp(cmd, "/r", true) == 0)
{
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
GiveNameSpace(sendername);
if(PlayerInfo[playerid][pMaskUse] == 1) { format(sendername, sizeof(sendername), "Stranger_%d", PlayerInfo[playerid][pRandMask]); }
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))
return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/r)adio [radio chat]");
if(PlayerInfo2[Mute][playerid] == 1)
return SendClientMessage(playerid, TEAM_CYAN_COLOR, " You can't speak, you have been silenced !");
if(PlayerInfo[playerid][pJailed] > 0)
return SendClientMessage(playerid, TEAM_CYAN_COLOR, "[INFO]: your radio has been confesgated, You will receive it at the front.");
if(PlayerInfo[playerid][pMember] == 9)
return SendClientMessage(playerid, COLOR_GREY, " Faction radio has been closed !");
if(PlayerInfo[playerid][pMember] > 0)
{
format(string, sizeof(string), "** %s(radio): %s, over. **", GetPlayerShortName(playerid), result);// <<
ProxRadio(20.0, playerid, string);
SendRadioMessage(PlayerInfo[playerid][pMember], TEAM_BLUE_COLOR, string);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, " You are not part of a Faction !");
return 1;
}
}
return 1;
}