Don't spectate vehicle when admin enters it
#2

Try this
pawn Код:
if(dialogid==105_2)//Spectating vehicle
    {
        if(response)
        {
            new tmp[255];
            tmp = strtOK(inputtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, " You didn't enter vehicle ID.");
                return 1;
            }
            specvehicleid = strval(tmp);
            for(new i=0; i<MAXPLAYERS; i++)
            {
                if(IsPlayerInVehicle(i, specvehicleid)&&((tmpAdmin[i]==1&&admin[i]==1))||IsPlayerAdmin(i))
                {
                    SendClientMessage(playerid,COLOR_RED," You are not allowed to spectate this vehicle, since an admin is sitting in it.");
                    return 1;
                }
            }
            if(GetPlayerVehicleID(playerid)==specvehicleid) SendClientMessage(playerid,COLOR_RED," You cannot spectate vehicle you are sitting in.");
            if(specvehicleid < MAX_VEHICLES)
            {
                TogglePlayerSpectating(playerid, 1);
                PlayerSpectateVehicle(playerid, specvehicleid);
                gSpectateID[playerid] = specvehicleid;
                gSpectateType[playerid] = ADMIN_SPEC_TYPE_VEHICLE;
                camer[playerid]=1;
                format(string, sizeof(string), " You are spectating vehicle with ID %d. Press 2 to exit.",specvehicleid);
                SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
                for(new i=0; i<MAXPLAYERS; i++)
                {
                    if(IsPlayerInVehicle(i, specvehicleid)&&((tmpAdmin[i]==1&&admin[i]==1))||IsPlayerAdmin(i))
                    {
                        TogglePlayerSpectating(playerid, 0);
                        gSpectateID[playerid] = INVALID_PLAYER_ID;
                        gSpectateType[playerid] = ADMIN_SPEC_TYPE_NONE;
                        SetPlayerVirtualWorld(playerid,0);
                        camer[playerid]=0;
                        ShowDialog(playerid,43,DIALOG_STYLE_MSGBOX,"Info","{FCAC00}Another administrator has entered    the vehicle you're spectating,\nso spectating is stopped.","OK","");
                      }
                }
        return 1;
            }
            else SendClientMessage(playerid, COLOR_LIGHTBLUE, " Wrong ID.");
            return 1;
        }
        else ShowDialog105(playerid);
    }
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)