Megaphone command
#1

pawn Код:
if(strcmp(cmd, "/megaphone", true) == 0 || strcmp(cmd, "/m", true) == 0)
    {
        new tmpcar = GetVehicleModel(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_GRAD2, "USAGE: (/m)egaphone [megaphone chat]");
            return 1;
        }
        if (gTeam[playerid] != 2)
        {
            SendClientMessage(playerid, COLOR_GRAD2, "  you are not part of a team");
            return 1;
        }
        if(!IsACopCar(tmpcar))
        {
            SendClientMessage(playerid, COLOR_GRAD2, "  you are not in a police vehicle");
            return 1;
        }
        else
        {
        format(string, sizeof(string), "[Officer %s:o< %s]", sendername, result);
        ProxDetector(60.0, playerid, string,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
        printf("%s", string);
        return 1;
        }
    }
IsACopCar:
pawn Код:
public IsACopCar(carid)
{
    if((carid >= 35) && (carid <= 60))
    {
        return 1;
    }
    return 0;
}
Taken out of PenSF

I need to know why the carid is 35 - 60, while the vehicle ID's for the police cars are 596-599 & 601.
The command also tells me that "I'm not in a police vehicle". While I am.

It's PenSF so yeah.. It might not be 0.3 compatible. Could anyone tell me if this has any incompatibility?
Reply


Messages In This Thread
Megaphone command - by Ragidon - 10.05.2010, 14:29
Re: Megaphone command - by westre - 10.05.2010, 14:34
Re: Megaphone command - by Ragidon - 10.05.2010, 14:38
Re: Megaphone command - by Conroy - 10.05.2010, 15:04
Re: Megaphone command - by Ragidon - 10.05.2010, 15:05
Re: Megaphone command - by Conroy - 10.05.2010, 15:07
Re: Megaphone command - by Ragidon - 10.05.2010, 15:09
Re: Megaphone command - by Conroy - 10.05.2010, 15:12
Re: Megaphone command - by Ragidon - 10.05.2010, 15:18
Re: Megaphone command - by Conroy - 10.05.2010, 15:22

Forum Jump:


Users browsing this thread: 1 Guest(s)