enum pInfo
{
pPolice
}
new PlayerInfo[MAX_PLAYERS][pInfo];
forward SendPoliceMessage(color, string[]);
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, \"/r\", true) == 0 || strcmp(cmdtext, \"/pdradio\", true) == 0)
{
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
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_0x33CCFFAA, \"Használat: /r [szöveg]\");
return 1;
}
format(string, sizeof(string), \"Rádió: %s: %s\", sendername, (result));
SendPoliceMessage(COLOR_RED,string);
}
return 1;
}
return 0;
}
public SendPoliceMessage(color, string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[pPolice] >= 1)
{
SendClientMessage(i, 0x33CCFFAA, string);
}
}
}
}
Nem teszteltem