19.04.2009, 12:01
Hello!
I got this code and i want it to make its only work in cop car...
This one didnt work for me:
I got this code and i want it to make its only work in cop car...
pawn Код:
if(strcmp(cmd, "/megaphone", true) == 0 || strcmp(cmd, "/m", true) == 0)
{
LimitGlobalChatRadius(50); // i think 25-35 is best
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_RED, "USAGE: (/m)egaphone [text]");
return 1;
}
format(string, sizeof(string), "(POLICE MEGAPHONE) Officer %s: %s!!", sendername, result);
ProxDetector(30.0, playerid, string,COLOR_BLUE,COLOR_BLUE,COLOR_BLUE,COLOR_BLUE,COLOR_BLUE);
printf("%s", string);
}
return 1;
}
pawn Код:
if(strcmp(cmd, "/megaphone", true) == 0 || strcmp(cmd, "/m", true) == 0)
{
LimitGlobalChatRadius(50); // i think 25-35 is best
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_RED, "USAGE: (/m)egaphone [text]");
return 1;
}
new tmpcar = GetPlayerVehicleID(playerid);
if (!IsACopCar(tmpcar) && GetPlayerInterior(playerid) == 0)
{
SendClientMessage(playerid, COLOR_RED, " You are not in a cop car!");
return 1;
}
format(string, sizeof(string), "(POLICE MEGAPHONE) Officer %s: %s!!", sendername, result);
ProxDetector(30.0, playerid, string,COLOR_BLUE,COLOR_BLUE,COLOR_BLUE,COLOR_BLUE,COLOR_BLUE);
printf("%s", string);
}
return 1;
}