Megaphone Help
#1

I'm doing a megaphone for my police/medics on my server, and I'm having a little trouble. I want them to only be able to use the megaphone whilst they're in a police car or an ambulance, this is what I've got...

pawn Код:
CMD:m(playerid, text[]) return cmd_megaphone(playerid, text);
CMD:megaphone(playerid, text[])
{
    if(PlayerMuteInfo[playerid][AllMuted])
    {
        SendClientMessage(playerid, TEAM_CYAN_COLOR, "   You can't speak, you have been silenced!");
        return 1;
    }
    if(IsACop(playerid))
    {
    else if(IsAnAmbulance(GetPlayerVehicleID(playerid)))
    (
        if(!IsPlayerInAnyVehicle(playerid) || !IsAnAmbulance(GetVehicleModel(GetPlayerVehicleID(playerid))) || !IsACopCar(GetVehicleModel(GetPlayerVehicleID(playerid))))
        {
            SendClientMessage(playerid, COLOR_LIGHTRED, "   You are not in a police vehicle!");
            return 1;
Reply
#2

I don't really know what you're doing but try this:

pawn Код:
CMD:m(playerid, text[]) return cmd_megaphone(playerid, text);
CMD:megaphone(playerid, text[])
{
    if(PlayerMuteInfo[playerid][AllMuted]) return SendClientMessage(playerid, TEAM_CYAN_COLOR, "   You can't speak, you have been silenced!");

    if(IsACop(playerid) || IsAnAmbulance(GetPlayerVehicleID(playerid)))
    {
        if(IsAnAmbulance(GetVehicleModel(GetPlayerVehicleID(playerid))) || IsACopCar(GetVehicleModel(GetPlayerVehicleID(playerid))))
        {
        // Action here
        }
        else SendClientMessage(playerid, COLOR_LIGHTRED, "   You are not in a police vehicle!");
    }
    return 1;
}
Reply
#3

Okay, you type /m and a yellow message is sent that says "LSPD - <player message>", or if you're a medic it says "SD-EMS - <player message", it's a megaphone that's used to move traffic or pull somebody over. I want it to be only usable my cops & medics in cop cars/ambulances.
Reply
#4

pawn Код:
CMD:m(playerid, text[]) return cmd_megaphone(playerid, text);
CMD:megaphone(playerid, text[])
{
    if(PlayerMuteInfo[playerid][AllMuted]) return SendClientMessage(playerid, TEAM_CYAN_COLOR, "   You can't speak, you have been silenced!");
    if(IsACop(playerid) || IsAnAmbulance(playerid))
    {
        if(IsAnAmbulance(GetVehicleModel(GetPlayerVehicleID(playerid))) || IsACopCar(GetVehicleModel(GetPlayerVehicleID(playerid))))
        {
            new string[128];
            format(string, sizeof(string), "[%s: o< %s!]", GetPlayersName(playerid), params);
            ProxDetector(20.0, playerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
        }
        else SendClientMessage(playerid, COLOR_LIGHTRED, "   You are not in a police vehicle!");
    }
    return 1;
}
Reply
#5

I've already got the message strings underneath, as there's 3 different factions that use /m. I just need it to only work for cops/medics and cop cars/ambulances
Reply
#6

Do you have the actual functions "IsAnAmbulance" and "IsACopCar"?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)